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 | 4953550a | 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 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 261 | struct alc_mic_route { |
| 262 | hda_nid_t pin; |
| 263 | unsigned char mux_idx; |
| 264 | unsigned char amix_idx; |
| 265 | }; |
| 266 | |
| 267 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 268 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | struct alc_spec { |
| 270 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 271 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 273 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 274 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 276 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 277 | * don't forget NULL |
| 278 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 279 | */ |
| 280 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 282 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | struct hda_pcm_stream *stream_analog_playback; |
| 284 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 285 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 286 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 288 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | struct hda_pcm_stream *stream_digital_playback; |
| 290 | struct hda_pcm_stream *stream_digital_capture; |
| 291 | |
| 292 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 293 | struct hda_multi_out multiout; /* playback set-up |
| 294 | * max_channels, dacs must be set |
| 295 | * dig_out_nid and hp_nid are optional |
| 296 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 297 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 298 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 299 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | |
| 301 | /* capture */ |
| 302 | unsigned int num_adc_nids; |
| 303 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 304 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 305 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | |
| 307 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 308 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | const struct hda_input_mux *input_mux; |
| 310 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 311 | struct alc_mic_route ext_mic; |
| 312 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | |
| 314 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 315 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 317 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 318 | int const_channel_count; |
| 319 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | |
| 321 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 322 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 323 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 324 | /* dynamic controls, init_verbs and input_mux */ |
| 325 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 326 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 327 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 328 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 329 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 330 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 331 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 332 | /* hooks */ |
| 333 | void (*init_hook)(struct hda_codec *codec); |
| 334 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 335 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 336 | /* for pin sensing */ |
| 337 | unsigned int sense_updated: 1; |
| 338 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 339 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 340 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 341 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 342 | /* other flags */ |
| 343 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 344 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 345 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 346 | /* for virtual master */ |
| 347 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 348 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 349 | struct hda_loopback_check loopback; |
| 350 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 351 | |
| 352 | /* for PLL fix */ |
| 353 | hda_nid_t pll_nid; |
| 354 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 355 | }; |
| 356 | |
| 357 | /* |
| 358 | * configuration template - to be copied to the spec instance |
| 359 | */ |
| 360 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 361 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 362 | * with spec |
| 363 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 364 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 365 | const struct hda_verb *init_verbs[5]; |
| 366 | unsigned int num_dacs; |
| 367 | hda_nid_t *dac_nids; |
| 368 | hda_nid_t dig_out_nid; /* optional */ |
| 369 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 370 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 371 | unsigned int num_adc_nids; |
| 372 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 373 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 374 | hda_nid_t dig_in_nid; |
| 375 | unsigned int num_channel_mode; |
| 376 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 377 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 378 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 379 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 380 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 381 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 382 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 383 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 384 | struct hda_amp_list *loopbacks; |
| 385 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | }; |
| 387 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | |
| 389 | /* |
| 390 | * input MUX handling |
| 391 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 392 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 393 | struct snd_ctl_elem_info *uinfo) |
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; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 397 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 398 | if (mux_idx >= spec->num_mux_defs) |
| 399 | mux_idx = 0; |
| 400 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | } |
| 402 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 403 | static int alc_mux_enum_get(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; |
| 408 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 409 | |
| 410 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 411 | return 0; |
| 412 | } |
| 413 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 414 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 415 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | { |
| 417 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 418 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 419 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 420 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 421 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 422 | hda_nid_t nid = spec->capsrc_nids ? |
| 423 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 424 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 426 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 427 | imux = &spec->input_mux[mux_idx]; |
| 428 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 429 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 430 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 431 | /* Matrix-mixer style (e.g. ALC882) */ |
| 432 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 433 | unsigned int i, idx; |
| 434 | |
| 435 | idx = ucontrol->value.enumerated.item[0]; |
| 436 | if (idx >= imux->num_items) |
| 437 | idx = imux->num_items - 1; |
| 438 | if (*cur_val == idx) |
| 439 | return 0; |
| 440 | for (i = 0; i < imux->num_items; i++) { |
| 441 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 442 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 443 | imux->items[i].index, |
| 444 | HDA_AMP_MUTE, v); |
| 445 | } |
| 446 | *cur_val = idx; |
| 447 | return 1; |
| 448 | } else { |
| 449 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 450 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 451 | &spec->cur_mux[adc_idx]); |
| 452 | } |
| 453 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 454 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | /* |
| 456 | * channel mode setting |
| 457 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 458 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 459 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | { |
| 461 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 462 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 463 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 464 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | } |
| 466 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 467 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 468 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | { |
| 470 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 471 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 472 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 473 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 474 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | } |
| 476 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 477 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 478 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | { |
| 480 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 481 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 482 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 483 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 484 | &spec->ext_channel_count); |
| 485 | if (err >= 0 && !spec->const_channel_count) { |
| 486 | spec->multiout.max_channels = spec->ext_channel_count; |
| 487 | if (spec->need_dac_fix) |
| 488 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 489 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 490 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | } |
| 492 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 493 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 494 | * 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] | 495 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 496 | * being part of a format specifier. Maximum allowed length of a value is |
| 497 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 498 | * |
| 499 | * Note: some retasking pin complexes seem to ignore requests for input |
| 500 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 501 | * are requested. Therefore order this list so that this behaviour will not |
| 502 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 503 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 504 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 505 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 506 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 507 | "Mic 50pc bias", "Mic 80pc bias", |
| 508 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 509 | }; |
| 510 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 511 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 512 | }; |
| 513 | /* 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] | 514 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 515 | * addition, "input" pins may or may not process the mic bias option |
| 516 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 517 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 518 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 519 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 520 | #define ALC_PIN_DIR_IN 0x00 |
| 521 | #define ALC_PIN_DIR_OUT 0x01 |
| 522 | #define ALC_PIN_DIR_INOUT 0x02 |
| 523 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 524 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 525 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 526 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 527 | * For each direction the minimum and maximum values are given. |
| 528 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 529 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 530 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 531 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 532 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 533 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 534 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 535 | }; |
| 536 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 537 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 538 | #define alc_pin_mode_n_items(_dir) \ |
| 539 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 540 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 541 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 542 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 543 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 544 | unsigned int item_num = uinfo->value.enumerated.item; |
| 545 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 546 | |
| 547 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 548 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 549 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 550 | |
| 551 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 552 | item_num = alc_pin_mode_min(dir); |
| 553 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 554 | return 0; |
| 555 | } |
| 556 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 557 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 558 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 559 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 560 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 561 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 562 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 563 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 564 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 565 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 566 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 567 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 568 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 569 | /* Find enumerated value for current pinctl setting */ |
| 570 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 571 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 572 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 573 | *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] | 574 | return 0; |
| 575 | } |
| 576 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 577 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 578 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 579 | { |
| 580 | signed int change; |
| 581 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 582 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 583 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 584 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 585 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 586 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 587 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 588 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 589 | 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] | 590 | val = alc_pin_mode_min(dir); |
| 591 | |
| 592 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 593 | if (change) { |
| 594 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 595 | snd_hda_codec_write_cache(codec, nid, 0, |
| 596 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 597 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 598 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 599 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 600 | * for the requested pin mode. Enum values of 2 or less are |
| 601 | * input modes. |
| 602 | * |
| 603 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 604 | * reduces noise slightly (particularly on input) so we'll |
| 605 | * do it. However, having both input and output buffers |
| 606 | * enabled simultaneously doesn't seem to be problematic if |
| 607 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 608 | */ |
| 609 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 610 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 611 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 612 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 613 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 614 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 615 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 616 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 617 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 618 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 619 | } |
| 620 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 621 | return change; |
| 622 | } |
| 623 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 624 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 625 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 626 | .info = alc_pin_mode_info, \ |
| 627 | .get = alc_pin_mode_get, \ |
| 628 | .put = alc_pin_mode_put, \ |
| 629 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 630 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 631 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 632 | * together using a mask with more than one bit set. This control is |
| 633 | * currently used only by the ALC260 test model. At this stage they are not |
| 634 | * needed for any "production" models. |
| 635 | */ |
| 636 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 637 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 638 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 639 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 640 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 641 | { |
| 642 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 643 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 644 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 645 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 646 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 647 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 648 | |
| 649 | *valp = (val & mask) != 0; |
| 650 | return 0; |
| 651 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 652 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 653 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 654 | { |
| 655 | signed int change; |
| 656 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 657 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 658 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 659 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 660 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 661 | AC_VERB_GET_GPIO_DATA, |
| 662 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 663 | |
| 664 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 665 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 666 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 667 | gpio_data &= ~mask; |
| 668 | else |
| 669 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 670 | snd_hda_codec_write_cache(codec, nid, 0, |
| 671 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 672 | |
| 673 | return change; |
| 674 | } |
| 675 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 676 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 677 | .info = alc_gpio_data_info, \ |
| 678 | .get = alc_gpio_data_get, \ |
| 679 | .put = alc_gpio_data_put, \ |
| 680 | .private_value = nid | (mask<<16) } |
| 681 | #endif /* CONFIG_SND_DEBUG */ |
| 682 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 683 | /* A switch control to allow the enabling of the digital IO pins on the |
| 684 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 685 | * to provide something in the test model allowing digital outputs to be |
| 686 | * identified if present. If models are found which can utilise these |
| 687 | * outputs a more complete mixer control can be devised for those models if |
| 688 | * necessary. |
| 689 | */ |
| 690 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 691 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 692 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 693 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 694 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 695 | { |
| 696 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 697 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 698 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 699 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 700 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 701 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 702 | |
| 703 | *valp = (val & mask) != 0; |
| 704 | return 0; |
| 705 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 706 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 707 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 708 | { |
| 709 | signed int change; |
| 710 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 711 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 712 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 713 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 714 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 715 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 716 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 717 | |
| 718 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 719 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 720 | if (val==0) |
| 721 | ctrl_data &= ~mask; |
| 722 | else |
| 723 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 724 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 725 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 726 | |
| 727 | return change; |
| 728 | } |
| 729 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 730 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 731 | .info = alc_spdif_ctrl_info, \ |
| 732 | .get = alc_spdif_ctrl_get, \ |
| 733 | .put = alc_spdif_ctrl_put, \ |
| 734 | .private_value = nid | (mask<<16) } |
| 735 | #endif /* CONFIG_SND_DEBUG */ |
| 736 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 737 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 738 | * Again, this is only used in the ALC26x test models to help identify when |
| 739 | * the EAPD line must be asserted for features to work. |
| 740 | */ |
| 741 | #ifdef CONFIG_SND_DEBUG |
| 742 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 743 | |
| 744 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 745 | struct snd_ctl_elem_value *ucontrol) |
| 746 | { |
| 747 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 748 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 749 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 750 | long *valp = ucontrol->value.integer.value; |
| 751 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 752 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 753 | |
| 754 | *valp = (val & mask) != 0; |
| 755 | return 0; |
| 756 | } |
| 757 | |
| 758 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 759 | struct snd_ctl_elem_value *ucontrol) |
| 760 | { |
| 761 | int change; |
| 762 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 763 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 764 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 765 | long val = *ucontrol->value.integer.value; |
| 766 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 767 | AC_VERB_GET_EAPD_BTLENABLE, |
| 768 | 0x00); |
| 769 | |
| 770 | /* Set/unset the masked control bit(s) as needed */ |
| 771 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 772 | if (!val) |
| 773 | ctrl_data &= ~mask; |
| 774 | else |
| 775 | ctrl_data |= mask; |
| 776 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 777 | ctrl_data); |
| 778 | |
| 779 | return change; |
| 780 | } |
| 781 | |
| 782 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 783 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 784 | .info = alc_eapd_ctrl_info, \ |
| 785 | .get = alc_eapd_ctrl_get, \ |
| 786 | .put = alc_eapd_ctrl_put, \ |
| 787 | .private_value = nid | (mask<<16) } |
| 788 | #endif /* CONFIG_SND_DEBUG */ |
| 789 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 790 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 791 | * set up the input pin config (depending on the given auto-pin type) |
| 792 | */ |
| 793 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 794 | int auto_pin_type) |
| 795 | { |
| 796 | unsigned int val = PIN_IN; |
| 797 | |
| 798 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 799 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 800 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 801 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 802 | if (pincap & AC_PINCAP_VREF_80) |
| 803 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 804 | else if (pincap & AC_PINCAP_VREF_50) |
| 805 | val = PIN_VREF50; |
| 806 | else if (pincap & AC_PINCAP_VREF_100) |
| 807 | val = PIN_VREF100; |
| 808 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 809 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 810 | } |
| 811 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 812 | } |
| 813 | |
| 814 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 815 | */ |
| 816 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 817 | { |
| 818 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 819 | return; |
| 820 | spec->mixers[spec->num_mixers++] = mix; |
| 821 | } |
| 822 | |
| 823 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 824 | { |
| 825 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 826 | return; |
| 827 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 828 | } |
| 829 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 830 | #ifdef CONFIG_PROC_FS |
| 831 | /* |
| 832 | * hook for proc |
| 833 | */ |
| 834 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 835 | struct hda_codec *codec, hda_nid_t nid) |
| 836 | { |
| 837 | int coeff; |
| 838 | |
| 839 | if (nid != 0x20) |
| 840 | return; |
| 841 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 842 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 843 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 844 | AC_VERB_GET_COEF_INDEX, 0); |
| 845 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 846 | } |
| 847 | #else |
| 848 | #define print_realtek_coef NULL |
| 849 | #endif |
| 850 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 851 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 852 | * set up from the preset table |
| 853 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 854 | static void setup_preset(struct alc_spec *spec, |
| 855 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 856 | { |
| 857 | int i; |
| 858 | |
| 859 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 860 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 861 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 862 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 863 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 864 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 865 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 866 | spec->channel_mode = preset->channel_mode; |
| 867 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 868 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 869 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 870 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 871 | if (preset->const_channel_count) |
| 872 | spec->multiout.max_channels = preset->const_channel_count; |
| 873 | else |
| 874 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 875 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 876 | |
| 877 | spec->multiout.num_dacs = preset->num_dacs; |
| 878 | spec->multiout.dac_nids = preset->dac_nids; |
| 879 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 880 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 881 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 882 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 883 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 884 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 885 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 886 | spec->input_mux = preset->input_mux; |
| 887 | |
| 888 | spec->num_adc_nids = preset->num_adc_nids; |
| 889 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 890 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 891 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 892 | |
| 893 | spec->unsol_event = preset->unsol_event; |
| 894 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 895 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 896 | spec->loopback.amplist = preset->loopbacks; |
| 897 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 898 | } |
| 899 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 900 | /* Enable GPIO mask and set output */ |
| 901 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 902 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 903 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 904 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 905 | { } |
| 906 | }; |
| 907 | |
| 908 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 909 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 910 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 911 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 912 | { } |
| 913 | }; |
| 914 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 915 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 916 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 917 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 918 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 919 | { } |
| 920 | }; |
| 921 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 922 | /* |
| 923 | * Fix hardware PLL issue |
| 924 | * On some codecs, the analog PLL gating control must be off while |
| 925 | * the default value is 1. |
| 926 | */ |
| 927 | static void alc_fix_pll(struct hda_codec *codec) |
| 928 | { |
| 929 | struct alc_spec *spec = codec->spec; |
| 930 | unsigned int val; |
| 931 | |
| 932 | if (!spec->pll_nid) |
| 933 | return; |
| 934 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 935 | spec->pll_coef_idx); |
| 936 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 937 | AC_VERB_GET_PROC_COEF, 0); |
| 938 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 939 | spec->pll_coef_idx); |
| 940 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 941 | val & ~(1 << spec->pll_coef_bit)); |
| 942 | } |
| 943 | |
| 944 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 945 | unsigned int coef_idx, unsigned int coef_bit) |
| 946 | { |
| 947 | struct alc_spec *spec = codec->spec; |
| 948 | spec->pll_nid = nid; |
| 949 | spec->pll_coef_idx = coef_idx; |
| 950 | spec->pll_coef_bit = coef_bit; |
| 951 | alc_fix_pll(codec); |
| 952 | } |
| 953 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 954 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 955 | { |
| 956 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 957 | unsigned int present, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 958 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 959 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 960 | |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 961 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 962 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 963 | 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] | 964 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 965 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 966 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 967 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 968 | nid = spec->autocfg.speaker_pins[i]; |
| 969 | if (!nid) |
| 970 | break; |
| 971 | snd_hda_codec_write(codec, nid, 0, |
| 972 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 973 | spec->jack_present ? 0 : PIN_OUT); |
| 974 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 975 | } |
| 976 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 977 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 978 | hda_nid_t nid) |
| 979 | { |
| 980 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 981 | int i, nums; |
| 982 | |
| 983 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 984 | for (i = 0; i < nums; i++) |
| 985 | if (conn[i] == nid) |
| 986 | return i; |
| 987 | return -1; |
| 988 | } |
| 989 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 990 | static void alc_mic_automute(struct hda_codec *codec) |
| 991 | { |
| 992 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 993 | struct alc_mic_route *dead, *alive; |
| 994 | unsigned int present, type; |
| 995 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 996 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 997 | if (!spec->auto_mic) |
| 998 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 999 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1000 | return; |
| 1001 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1002 | return; |
| 1003 | |
| 1004 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1005 | |
| 1006 | present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0, |
| 1007 | AC_VERB_GET_PIN_SENSE, 0); |
| 1008 | present &= AC_PINSENSE_PRESENCE; |
| 1009 | if (present) { |
| 1010 | alive = &spec->ext_mic; |
| 1011 | dead = &spec->int_mic; |
| 1012 | } else { |
| 1013 | alive = &spec->int_mic; |
| 1014 | dead = &spec->ext_mic; |
| 1015 | } |
| 1016 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1017 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1018 | if (type == AC_WID_AUD_MIX) { |
| 1019 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1020 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1021 | alive->mux_idx, |
| 1022 | HDA_AMP_MUTE, 0); |
| 1023 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1024 | dead->mux_idx, |
| 1025 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1026 | } else { |
| 1027 | /* MUX style (e.g. ALC880) */ |
| 1028 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1029 | AC_VERB_SET_CONNECT_SEL, |
| 1030 | alive->mux_idx); |
| 1031 | } |
| 1032 | |
| 1033 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1034 | } |
| 1035 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1036 | /* unsolicited event for HP jack sensing */ |
| 1037 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1038 | { |
| 1039 | if (codec->vendor_id == 0x10ec0880) |
| 1040 | res >>= 28; |
| 1041 | else |
| 1042 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1043 | switch (res) { |
| 1044 | case ALC880_HP_EVENT: |
| 1045 | alc_automute_pin(codec); |
| 1046 | break; |
| 1047 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1048 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1049 | break; |
| 1050 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1051 | } |
| 1052 | |
| 1053 | static void alc_inithook(struct hda_codec *codec) |
| 1054 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1055 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1056 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1057 | } |
| 1058 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1059 | /* additional initialization for ALC888 variants */ |
| 1060 | static void alc888_coef_init(struct hda_codec *codec) |
| 1061 | { |
| 1062 | unsigned int tmp; |
| 1063 | |
| 1064 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1065 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1066 | 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] | 1067 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1068 | /* alc888S-VC */ |
| 1069 | snd_hda_codec_read(codec, 0x20, 0, |
| 1070 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1071 | else |
| 1072 | /* alc888-VB */ |
| 1073 | snd_hda_codec_read(codec, 0x20, 0, |
| 1074 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1075 | } |
| 1076 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1077 | static void alc889_coef_init(struct hda_codec *codec) |
| 1078 | { |
| 1079 | unsigned int tmp; |
| 1080 | |
| 1081 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1082 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1083 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1084 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1085 | } |
| 1086 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1087 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1088 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1089 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1090 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1091 | switch (type) { |
| 1092 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1093 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1094 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1095 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1096 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1097 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1098 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1099 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1100 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1101 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1102 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1103 | case 0x10ec0260: |
| 1104 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1105 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1106 | snd_hda_codec_write(codec, 0x10, 0, |
| 1107 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1108 | break; |
| 1109 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1110 | case 0x10ec0267: |
| 1111 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1112 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1113 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1114 | case 0x10ec0660: |
| 1115 | case 0x10ec0662: |
| 1116 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1117 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1118 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1119 | snd_hda_codec_write(codec, 0x14, 0, |
| 1120 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1121 | snd_hda_codec_write(codec, 0x15, 0, |
| 1122 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1123 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1124 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1125 | switch (codec->vendor_id) { |
| 1126 | case 0x10ec0260: |
| 1127 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1128 | AC_VERB_SET_COEF_INDEX, 7); |
| 1129 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1130 | AC_VERB_GET_PROC_COEF, 0); |
| 1131 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1132 | AC_VERB_SET_COEF_INDEX, 7); |
| 1133 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1134 | AC_VERB_SET_PROC_COEF, |
| 1135 | tmp | 0x2010); |
| 1136 | break; |
| 1137 | case 0x10ec0262: |
| 1138 | case 0x10ec0880: |
| 1139 | case 0x10ec0882: |
| 1140 | case 0x10ec0883: |
| 1141 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1142 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1143 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1144 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1145 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1146 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1147 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1148 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1149 | case 0x10ec0267: |
| 1150 | case 0x10ec0268: |
| 1151 | snd_hda_codec_write(codec, 0x20, 0, |
| 1152 | AC_VERB_SET_COEF_INDEX, 7); |
| 1153 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1154 | AC_VERB_GET_PROC_COEF, 0); |
| 1155 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1156 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1157 | snd_hda_codec_write(codec, 0x20, 0, |
| 1158 | AC_VERB_SET_PROC_COEF, |
| 1159 | tmp | 0x3000); |
| 1160 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1161 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1162 | break; |
| 1163 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1164 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1165 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1166 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1167 | { |
| 1168 | struct alc_spec *spec = codec->spec; |
| 1169 | |
| 1170 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1171 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1172 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1173 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1174 | if (spec->autocfg.line_out_pins[0] && |
| 1175 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1176 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1177 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1178 | else |
| 1179 | return; |
| 1180 | } |
| 1181 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1182 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1183 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1184 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1185 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1186 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1187 | spec->unsol_event = alc_sku_unsol_event; |
| 1188 | } |
| 1189 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1190 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1191 | { |
| 1192 | struct alc_spec *spec = codec->spec; |
| 1193 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1194 | hda_nid_t fixed, ext; |
| 1195 | int i; |
| 1196 | |
| 1197 | /* there must be only two mic inputs exclusively */ |
| 1198 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1199 | if (cfg->input_pins[i]) |
| 1200 | return; |
| 1201 | |
| 1202 | fixed = ext = 0; |
| 1203 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1204 | hda_nid_t nid = cfg->input_pins[i]; |
| 1205 | unsigned int defcfg; |
| 1206 | if (!nid) |
| 1207 | return; |
| 1208 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1209 | switch (get_defcfg_connect(defcfg)) { |
| 1210 | case AC_JACK_PORT_FIXED: |
| 1211 | if (fixed) |
| 1212 | return; /* already occupied */ |
| 1213 | fixed = nid; |
| 1214 | break; |
| 1215 | case AC_JACK_PORT_COMPLEX: |
| 1216 | if (ext) |
| 1217 | return; /* already occupied */ |
| 1218 | ext = nid; |
| 1219 | break; |
| 1220 | default: |
| 1221 | return; /* invalid entry */ |
| 1222 | } |
| 1223 | } |
| 1224 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1225 | return; /* no unsol support */ |
| 1226 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1227 | ext, fixed); |
| 1228 | spec->ext_mic.pin = ext; |
| 1229 | spec->int_mic.pin = fixed; |
| 1230 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1231 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1232 | spec->auto_mic = 1; |
| 1233 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1234 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1235 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1236 | spec->unsol_event = alc_sku_unsol_event; |
| 1237 | } |
| 1238 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1239 | /* check subsystem ID and set up device-specific initialization; |
| 1240 | * return 1 if initialized, 0 if invalid SSID |
| 1241 | */ |
| 1242 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1243 | * 31 ~ 16 : Manufacture ID |
| 1244 | * 15 ~ 8 : SKU ID |
| 1245 | * 7 ~ 0 : Assembly ID |
| 1246 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1247 | */ |
| 1248 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1249 | hda_nid_t porta, hda_nid_t porte, |
| 1250 | hda_nid_t portd) |
| 1251 | { |
| 1252 | unsigned int ass, tmp, i; |
| 1253 | unsigned nid; |
| 1254 | struct alc_spec *spec = codec->spec; |
| 1255 | |
| 1256 | ass = codec->subsystem_id & 0xffff; |
| 1257 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1258 | goto do_sku; |
| 1259 | |
| 1260 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1261 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1262 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1263 | * 29~21 : reserve |
| 1264 | * 20 : PCBEEP input |
| 1265 | * 19~16 : Check sum (15:1) |
| 1266 | * 15~1 : Custom |
| 1267 | * 0 : override |
| 1268 | */ |
| 1269 | nid = 0x1d; |
| 1270 | if (codec->vendor_id == 0x10ec0260) |
| 1271 | nid = 0x17; |
| 1272 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1273 | snd_printd("realtek: No valid SSID, " |
| 1274 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1275 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1276 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1277 | return 0; |
| 1278 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1279 | return 0; |
| 1280 | |
| 1281 | /* check sum */ |
| 1282 | tmp = 0; |
| 1283 | for (i = 1; i < 16; i++) { |
| 1284 | if ((ass >> i) & 1) |
| 1285 | tmp++; |
| 1286 | } |
| 1287 | if (((ass >> 16) & 0xf) != tmp) |
| 1288 | return 0; |
| 1289 | do_sku: |
| 1290 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1291 | ass & 0xffff, codec->vendor_id); |
| 1292 | /* |
| 1293 | * 0 : override |
| 1294 | * 1 : Swap Jack |
| 1295 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1296 | * 3~5 : External Amplifier control |
| 1297 | * 7~6 : Reserved |
| 1298 | */ |
| 1299 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1300 | switch (tmp) { |
| 1301 | case 1: |
| 1302 | spec->init_amp = ALC_INIT_GPIO1; |
| 1303 | break; |
| 1304 | case 3: |
| 1305 | spec->init_amp = ALC_INIT_GPIO2; |
| 1306 | break; |
| 1307 | case 7: |
| 1308 | spec->init_amp = ALC_INIT_GPIO3; |
| 1309 | break; |
| 1310 | case 5: |
| 1311 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1312 | break; |
| 1313 | } |
| 1314 | |
| 1315 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1316 | * when the external headphone out jack is plugged" |
| 1317 | */ |
| 1318 | if (!(ass & 0x8000)) |
| 1319 | return 1; |
| 1320 | /* |
| 1321 | * 10~8 : Jack location |
| 1322 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1323 | * 14~13: Resvered |
| 1324 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1325 | * when the external headphone out jack is plugged" |
| 1326 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1327 | if (!spec->autocfg.hp_pins[0]) { |
| 1328 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1329 | if (tmp == 0) |
| 1330 | spec->autocfg.hp_pins[0] = porta; |
| 1331 | else if (tmp == 1) |
| 1332 | spec->autocfg.hp_pins[0] = porte; |
| 1333 | else if (tmp == 2) |
| 1334 | spec->autocfg.hp_pins[0] = portd; |
| 1335 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1336 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1337 | } |
| 1338 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1339 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1340 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1341 | return 1; |
| 1342 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1343 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1344 | static void alc_ssid_check(struct hda_codec *codec, |
| 1345 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1346 | { |
| 1347 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1348 | struct alc_spec *spec = codec->spec; |
| 1349 | snd_printd("realtek: " |
| 1350 | "Enable default setup for auto mode as fallback\n"); |
| 1351 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1352 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1353 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1354 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1355 | } |
| 1356 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1357 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1358 | * Fix-up pin default configurations |
| 1359 | */ |
| 1360 | |
| 1361 | struct alc_pincfg { |
| 1362 | hda_nid_t nid; |
| 1363 | u32 val; |
| 1364 | }; |
| 1365 | |
| 1366 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1367 | const struct snd_pci_quirk *quirk, |
| 1368 | const struct alc_pincfg **pinfix) |
| 1369 | { |
| 1370 | const struct alc_pincfg *cfg; |
| 1371 | |
| 1372 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1373 | if (!quirk) |
| 1374 | return; |
| 1375 | |
| 1376 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1377 | for (; cfg->nid; cfg++) |
| 1378 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1379 | } |
| 1380 | |
| 1381 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1382 | * ALC888 |
| 1383 | */ |
| 1384 | |
| 1385 | /* |
| 1386 | * 2ch mode |
| 1387 | */ |
| 1388 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1389 | /* Mic-in jack as mic in */ |
| 1390 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1391 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1392 | /* Line-in jack as Line in */ |
| 1393 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1394 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1395 | /* Line-Out as Front */ |
| 1396 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1397 | { } /* end */ |
| 1398 | }; |
| 1399 | |
| 1400 | /* |
| 1401 | * 4ch mode |
| 1402 | */ |
| 1403 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1404 | /* Mic-in jack as mic in */ |
| 1405 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1406 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1407 | /* Line-in jack as Surround */ |
| 1408 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1409 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1410 | /* Line-Out as Front */ |
| 1411 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1412 | { } /* end */ |
| 1413 | }; |
| 1414 | |
| 1415 | /* |
| 1416 | * 6ch mode |
| 1417 | */ |
| 1418 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1419 | /* Mic-in jack as CLFE */ |
| 1420 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1421 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1422 | /* Line-in jack as Surround */ |
| 1423 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1424 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1425 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1426 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1427 | { } /* end */ |
| 1428 | }; |
| 1429 | |
| 1430 | /* |
| 1431 | * 8ch mode |
| 1432 | */ |
| 1433 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1434 | /* Mic-in jack as CLFE */ |
| 1435 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1436 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1437 | /* Line-in jack as Surround */ |
| 1438 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1439 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1440 | /* Line-Out as Side */ |
| 1441 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1442 | { } /* end */ |
| 1443 | }; |
| 1444 | |
| 1445 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1446 | { 2, alc888_4ST_ch2_intel_init }, |
| 1447 | { 4, alc888_4ST_ch4_intel_init }, |
| 1448 | { 6, alc888_4ST_ch6_intel_init }, |
| 1449 | { 8, alc888_4ST_ch8_intel_init }, |
| 1450 | }; |
| 1451 | |
| 1452 | /* |
| 1453 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1454 | */ |
| 1455 | |
| 1456 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1457 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1458 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1459 | /* Connect Internal HP to Front */ |
| 1460 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1461 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1462 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1463 | /* Connect Bass HP to Front */ |
| 1464 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1465 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1466 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1467 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1468 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1469 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1470 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1471 | /* Connect Mic jack to CLFE */ |
| 1472 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1473 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1474 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1475 | /* Connect Line-in jack to Surround */ |
| 1476 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1477 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1478 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1479 | /* Connect HP out jack to Front */ |
| 1480 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1481 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1482 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1483 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1484 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1485 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1486 | {} |
| 1487 | }; |
| 1488 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1489 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1490 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1491 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1492 | unsigned int val, mute, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1493 | hda_nid_t nid; |
| 1494 | int i; |
| 1495 | |
| 1496 | spec->jack_present = 0; |
| 1497 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1498 | nid = spec->autocfg.hp_pins[i]; |
| 1499 | if (!nid) |
| 1500 | break; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1501 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 1502 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 1503 | snd_hda_codec_read(codec, nid, 0, |
| 1504 | AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1505 | val = snd_hda_codec_read(codec, nid, 0, |
| 1506 | AC_VERB_GET_PIN_SENSE, 0); |
| 1507 | if (val & AC_PINSENSE_PRESENCE) { |
| 1508 | spec->jack_present = 1; |
| 1509 | break; |
| 1510 | } |
| 1511 | } |
| 1512 | |
| 1513 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1514 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1515 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1516 | nid = spec->autocfg.speaker_pins[i]; |
| 1517 | if (!nid) |
| 1518 | break; |
| 1519 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1520 | HDA_AMP_MUTE, mute); |
| 1521 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1522 | } |
| 1523 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1524 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1525 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1526 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1527 | if (codec->vendor_id == 0x10ec0880) |
| 1528 | res >>= 28; |
| 1529 | else |
| 1530 | res >>= 26; |
| 1531 | if (res == ALC880_HP_EVENT) |
| 1532 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1533 | } |
| 1534 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1535 | static void alc889_automute_init(struct hda_codec *codec) |
| 1536 | { |
| 1537 | struct alc_spec *spec = codec->spec; |
| 1538 | |
| 1539 | spec->autocfg.hp_pins[0] = 0x15; |
| 1540 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1541 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1542 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1543 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1544 | spec->autocfg.speaker_pins[4] = 0x1a; |
| 1545 | alc_automute_amp(codec); |
| 1546 | } |
| 1547 | |
| 1548 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1549 | { |
| 1550 | alc889_coef_init(codec); |
| 1551 | alc889_automute_init(codec); |
| 1552 | } |
| 1553 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1554 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) |
| 1555 | { |
| 1556 | struct alc_spec *spec = codec->spec; |
| 1557 | |
| 1558 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1559 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1560 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1561 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
| 1562 | alc_automute_amp(codec); |
| 1563 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1564 | |
| 1565 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1566 | * ALC888 Acer Aspire 4930G model |
| 1567 | */ |
| 1568 | |
| 1569 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1570 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1571 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1572 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1573 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1574 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1575 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1576 | /* Connect Internal HP to front */ |
| 1577 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1578 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1579 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1580 | /* Connect HP out to front */ |
| 1581 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1582 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1583 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1584 | { } |
| 1585 | }; |
| 1586 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1587 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1588 | * ALC888 Acer Aspire 6530G model |
| 1589 | */ |
| 1590 | |
| 1591 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1592 | /* Bias voltage on for external mic port */ |
| 1593 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1594 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1595 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1596 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1597 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1598 | /* Enable unsolicited event for HP jack */ |
| 1599 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1600 | /* Enable speaker output */ |
| 1601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1602 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1603 | /* Enable headphone output */ |
| 1604 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1605 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1606 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1607 | { } |
| 1608 | }; |
| 1609 | |
| 1610 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1611 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1612 | */ |
| 1613 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1614 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1615 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1616 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1617 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1618 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1619 | /* Enable unsolicited event for HP jack */ |
| 1620 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1621 | /* Connect Internal Front to Front */ |
| 1622 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1623 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1624 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1625 | /* Connect Internal Rear to Rear */ |
| 1626 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1627 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1628 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1629 | /* Connect Internal CLFE to CLFE */ |
| 1630 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1631 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1632 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1633 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1634 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1635 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1636 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1637 | /* Enable all DACs */ |
| 1638 | /* DAC DISABLE/MUTE 1? */ |
| 1639 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1640 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1641 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1642 | /* DAC DISABLE/MUTE 2? */ |
| 1643 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1644 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1645 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1646 | /* Enable amplifiers */ |
| 1647 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1648 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1649 | /* DMIC fix |
| 1650 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1651 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1652 | * makes the signal become a difference/sum signal instead of standard |
| 1653 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1654 | * codec replicate the sum signal to both channels, turning it into a |
| 1655 | * normal mono mic. |
| 1656 | */ |
| 1657 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1658 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1659 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1660 | { } |
| 1661 | }; |
| 1662 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1663 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1664 | /* Front mic only available on one ADC */ |
| 1665 | { |
| 1666 | .num_items = 4, |
| 1667 | .items = { |
| 1668 | { "Mic", 0x0 }, |
| 1669 | { "Line", 0x2 }, |
| 1670 | { "CD", 0x4 }, |
| 1671 | { "Front Mic", 0xb }, |
| 1672 | }, |
| 1673 | }, |
| 1674 | { |
| 1675 | .num_items = 3, |
| 1676 | .items = { |
| 1677 | { "Mic", 0x0 }, |
| 1678 | { "Line", 0x2 }, |
| 1679 | { "CD", 0x4 }, |
| 1680 | }, |
| 1681 | } |
| 1682 | }; |
| 1683 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1684 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1685 | /* Interal mic only available on one ADC */ |
| 1686 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1687 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1688 | .items = { |
| 1689 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1690 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1691 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1692 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1693 | { "Int Mic", 0xb }, |
| 1694 | }, |
| 1695 | }, |
| 1696 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1697 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1698 | .items = { |
| 1699 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1700 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1701 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1702 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1703 | }, |
| 1704 | } |
| 1705 | }; |
| 1706 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1707 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1708 | /* Digital mic only available on first "ADC" */ |
| 1709 | { |
| 1710 | .num_items = 5, |
| 1711 | .items = { |
| 1712 | { "Mic", 0x0 }, |
| 1713 | { "Line", 0x2 }, |
| 1714 | { "CD", 0x4 }, |
| 1715 | { "Front Mic", 0xb }, |
| 1716 | { "Input Mix", 0xa }, |
| 1717 | }, |
| 1718 | }, |
| 1719 | { |
| 1720 | .num_items = 4, |
| 1721 | .items = { |
| 1722 | { "Mic", 0x0 }, |
| 1723 | { "Line", 0x2 }, |
| 1724 | { "CD", 0x4 }, |
| 1725 | { "Input Mix", 0xa }, |
| 1726 | }, |
| 1727 | }, |
| 1728 | { |
| 1729 | .num_items = 4, |
| 1730 | .items = { |
| 1731 | { "Mic", 0x0 }, |
| 1732 | { "Line", 0x2 }, |
| 1733 | { "CD", 0x4 }, |
| 1734 | { "Input Mix", 0xa }, |
| 1735 | }, |
| 1736 | } |
| 1737 | }; |
| 1738 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1739 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1740 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1741 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1742 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1743 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1744 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1745 | HDA_OUTPUT), |
| 1746 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1747 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1748 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1749 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1750 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1751 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1752 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1753 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1754 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1755 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1756 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1757 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1758 | { } /* end */ |
| 1759 | }; |
| 1760 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1761 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1762 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1763 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1764 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1765 | spec->autocfg.hp_pins[0] = 0x15; |
| 1766 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1767 | alc_automute_amp(codec); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1768 | } |
| 1769 | |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1770 | static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec) |
| 1771 | { |
| 1772 | struct alc_spec *spec = codec->spec; |
| 1773 | |
| 1774 | spec->autocfg.hp_pins[0] = 0x15; |
| 1775 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1776 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1777 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1778 | alc_automute_amp(codec); |
| 1779 | } |
| 1780 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1781 | static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1782 | { |
| 1783 | struct alc_spec *spec = codec->spec; |
| 1784 | |
| 1785 | spec->autocfg.hp_pins[0] = 0x15; |
| 1786 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1787 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1788 | spec->autocfg.speaker_pins[2] = 0x1b; |
| 1789 | alc_automute_amp(codec); |
| 1790 | } |
| 1791 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1792 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1793 | * ALC880 3-stack model |
| 1794 | * |
| 1795 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1796 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1797 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1798 | */ |
| 1799 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1800 | static hda_nid_t alc880_dac_nids[4] = { |
| 1801 | /* front, rear, clfe, rear_surr */ |
| 1802 | 0x02, 0x05, 0x04, 0x03 |
| 1803 | }; |
| 1804 | |
| 1805 | static hda_nid_t alc880_adc_nids[3] = { |
| 1806 | /* ADC0-2 */ |
| 1807 | 0x07, 0x08, 0x09, |
| 1808 | }; |
| 1809 | |
| 1810 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1811 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1812 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1813 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1814 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1815 | /* ADC1-2 */ |
| 1816 | 0x08, 0x09, |
| 1817 | }; |
| 1818 | |
| 1819 | #define ALC880_DIGOUT_NID 0x06 |
| 1820 | #define ALC880_DIGIN_NID 0x0a |
| 1821 | |
| 1822 | static struct hda_input_mux alc880_capture_source = { |
| 1823 | .num_items = 4, |
| 1824 | .items = { |
| 1825 | { "Mic", 0x0 }, |
| 1826 | { "Front Mic", 0x3 }, |
| 1827 | { "Line", 0x2 }, |
| 1828 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1829 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1830 | }; |
| 1831 | |
| 1832 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1833 | /* 2ch mode */ |
| 1834 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1835 | /* set line-in to input, mute it */ |
| 1836 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1837 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1838 | /* set mic-in to input vref 80%, mute it */ |
| 1839 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1840 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1841 | { } /* end */ |
| 1842 | }; |
| 1843 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1844 | /* 6ch mode */ |
| 1845 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1846 | /* set line-in to output, unmute it */ |
| 1847 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1848 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1849 | /* set mic-in to output, unmute it */ |
| 1850 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1851 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1852 | { } /* end */ |
| 1853 | }; |
| 1854 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1855 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1856 | { 2, alc880_threestack_ch2_init }, |
| 1857 | { 6, alc880_threestack_ch6_init }, |
| 1858 | }; |
| 1859 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1860 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1861 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1862 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1863 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1864 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1865 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1866 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1867 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1868 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1869 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1870 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1871 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1872 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1873 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1874 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1875 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1876 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1877 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1878 | { |
| 1879 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1880 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1881 | .info = alc_ch_mode_info, |
| 1882 | .get = alc_ch_mode_get, |
| 1883 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1884 | }, |
| 1885 | { } /* end */ |
| 1886 | }; |
| 1887 | |
| 1888 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1889 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1890 | struct snd_ctl_elem_info *uinfo) |
| 1891 | { |
| 1892 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1893 | struct alc_spec *spec = codec->spec; |
| 1894 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1895 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1896 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1897 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1898 | HDA_INPUT); |
| 1899 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1900 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1901 | return err; |
| 1902 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1903 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1904 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1905 | unsigned int size, unsigned int __user *tlv) |
| 1906 | { |
| 1907 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1908 | struct alc_spec *spec = codec->spec; |
| 1909 | int err; |
| 1910 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1911 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1912 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1913 | HDA_INPUT); |
| 1914 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1915 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1916 | return err; |
| 1917 | } |
| 1918 | |
| 1919 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1920 | struct snd_ctl_elem_value *ucontrol); |
| 1921 | |
| 1922 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1923 | struct snd_ctl_elem_value *ucontrol, |
| 1924 | getput_call_t func) |
| 1925 | { |
| 1926 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1927 | struct alc_spec *spec = codec->spec; |
| 1928 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1929 | int err; |
| 1930 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1931 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1932 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1933 | 3, 0, HDA_INPUT); |
| 1934 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1935 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1936 | return err; |
| 1937 | } |
| 1938 | |
| 1939 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1940 | struct snd_ctl_elem_value *ucontrol) |
| 1941 | { |
| 1942 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1943 | snd_hda_mixer_amp_volume_get); |
| 1944 | } |
| 1945 | |
| 1946 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1947 | struct snd_ctl_elem_value *ucontrol) |
| 1948 | { |
| 1949 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1950 | snd_hda_mixer_amp_volume_put); |
| 1951 | } |
| 1952 | |
| 1953 | /* capture mixer elements */ |
| 1954 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1955 | |
| 1956 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1957 | struct snd_ctl_elem_value *ucontrol) |
| 1958 | { |
| 1959 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1960 | snd_hda_mixer_amp_switch_get); |
| 1961 | } |
| 1962 | |
| 1963 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1964 | struct snd_ctl_elem_value *ucontrol) |
| 1965 | { |
| 1966 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1967 | snd_hda_mixer_amp_switch_put); |
| 1968 | } |
| 1969 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1970 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1971 | { \ |
| 1972 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1973 | .name = "Capture Switch", \ |
| 1974 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1975 | .count = num, \ |
| 1976 | .info = alc_cap_sw_info, \ |
| 1977 | .get = alc_cap_sw_get, \ |
| 1978 | .put = alc_cap_sw_put, \ |
| 1979 | }, \ |
| 1980 | { \ |
| 1981 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1982 | .name = "Capture Volume", \ |
| 1983 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1984 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1985 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1986 | .count = num, \ |
| 1987 | .info = alc_cap_vol_info, \ |
| 1988 | .get = alc_cap_vol_get, \ |
| 1989 | .put = alc_cap_vol_put, \ |
| 1990 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1991 | } |
| 1992 | |
| 1993 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1994 | { \ |
| 1995 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1996 | /* .name = "Capture Source", */ \ |
| 1997 | .name = "Input Source", \ |
| 1998 | .count = num, \ |
| 1999 | .info = alc_mux_enum_info, \ |
| 2000 | .get = alc_mux_enum_get, \ |
| 2001 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2002 | } |
| 2003 | |
| 2004 | #define DEFINE_CAPMIX(num) \ |
| 2005 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2006 | _DEFINE_CAPMIX(num), \ |
| 2007 | _DEFINE_CAPSRC(num), \ |
| 2008 | { } /* end */ \ |
| 2009 | } |
| 2010 | |
| 2011 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2012 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2013 | _DEFINE_CAPMIX(num), \ |
| 2014 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2015 | } |
| 2016 | |
| 2017 | /* up to three ADCs */ |
| 2018 | DEFINE_CAPMIX(1); |
| 2019 | DEFINE_CAPMIX(2); |
| 2020 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2021 | DEFINE_CAPMIX_NOSRC(1); |
| 2022 | DEFINE_CAPMIX_NOSRC(2); |
| 2023 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2024 | |
| 2025 | /* |
| 2026 | * ALC880 5-stack model |
| 2027 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2028 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2029 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2030 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2031 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2032 | */ |
| 2033 | |
| 2034 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2035 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2036 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2037 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2038 | { } /* end */ |
| 2039 | }; |
| 2040 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2041 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2042 | /* 6ch mode */ |
| 2043 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2044 | /* set line-in to input, mute it */ |
| 2045 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2046 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2047 | { } /* end */ |
| 2048 | }; |
| 2049 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2050 | /* 8ch mode */ |
| 2051 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2052 | /* set line-in to output, unmute it */ |
| 2053 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2054 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2055 | { } /* end */ |
| 2056 | }; |
| 2057 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2058 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2059 | { 6, alc880_fivestack_ch6_init }, |
| 2060 | { 8, alc880_fivestack_ch8_init }, |
| 2061 | }; |
| 2062 | |
| 2063 | |
| 2064 | /* |
| 2065 | * ALC880 6-stack model |
| 2066 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2067 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2068 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2069 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2070 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2071 | */ |
| 2072 | |
| 2073 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2074 | /* front, rear, clfe, rear_surr */ |
| 2075 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2076 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2077 | |
| 2078 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2079 | .num_items = 4, |
| 2080 | .items = { |
| 2081 | { "Mic", 0x0 }, |
| 2082 | { "Front Mic", 0x1 }, |
| 2083 | { "Line", 0x2 }, |
| 2084 | { "CD", 0x4 }, |
| 2085 | }, |
| 2086 | }; |
| 2087 | |
| 2088 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2089 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2090 | { 8, NULL }, |
| 2091 | }; |
| 2092 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2093 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2094 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2095 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2096 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2097 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2098 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2099 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2100 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2101 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2102 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2103 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2104 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2105 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2106 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2107 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2108 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2109 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2110 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2111 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2112 | { |
| 2113 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2114 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2115 | .info = alc_ch_mode_info, |
| 2116 | .get = alc_ch_mode_get, |
| 2117 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2118 | }, |
| 2119 | { } /* end */ |
| 2120 | }; |
| 2121 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2122 | |
| 2123 | /* |
| 2124 | * ALC880 W810 model |
| 2125 | * |
| 2126 | * W810 has rear IO for: |
| 2127 | * Front (DAC 02) |
| 2128 | * Surround (DAC 03) |
| 2129 | * Center/LFE (DAC 04) |
| 2130 | * Digital out (06) |
| 2131 | * |
| 2132 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2133 | * 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] | 2134 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2135 | * There is a variable resistor to control the speaker or headphone |
| 2136 | * volume. This is a hardware-only device without a software API. |
| 2137 | * |
| 2138 | * Plugging headphones in will disable the internal speakers. This is |
| 2139 | * implemented in hardware, not via the driver using jack sense. In |
| 2140 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2141 | * disable both the speakers and headphones. |
| 2142 | * |
| 2143 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2144 | * These may not do anything useful with this driver yet, because I |
| 2145 | * haven't setup any initialization verbs for these yet... |
| 2146 | */ |
| 2147 | |
| 2148 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2149 | /* front, rear/surround, clfe */ |
| 2150 | 0x02, 0x03, 0x04 |
| 2151 | }; |
| 2152 | |
| 2153 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2154 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2155 | { 6, NULL } |
| 2156 | }; |
| 2157 | |
| 2158 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2159 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2160 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2161 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2162 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2163 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2164 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2165 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2166 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2167 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2168 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2169 | { } /* end */ |
| 2170 | }; |
| 2171 | |
| 2172 | |
| 2173 | /* |
| 2174 | * Z710V model |
| 2175 | * |
| 2176 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2177 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2178 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2179 | */ |
| 2180 | |
| 2181 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2182 | 0x02 |
| 2183 | }; |
| 2184 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2185 | |
| 2186 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2187 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2188 | { 2, NULL } |
| 2189 | }; |
| 2190 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2191 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2192 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2193 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2194 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2195 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2196 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2197 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2200 | { } /* end */ |
| 2201 | }; |
| 2202 | |
| 2203 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2204 | /* |
| 2205 | * ALC880 F1734 model |
| 2206 | * |
| 2207 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2208 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2209 | */ |
| 2210 | |
| 2211 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2212 | 0x03 |
| 2213 | }; |
| 2214 | #define ALC880_F1734_HP_DAC 0x02 |
| 2215 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2216 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2217 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2218 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2219 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2220 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2221 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2222 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2225 | { } /* end */ |
| 2226 | }; |
| 2227 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2228 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2229 | .num_items = 2, |
| 2230 | .items = { |
| 2231 | { "Mic", 0x1 }, |
| 2232 | { "CD", 0x4 }, |
| 2233 | }, |
| 2234 | }; |
| 2235 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2236 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2237 | /* |
| 2238 | * ALC880 ASUS model |
| 2239 | * |
| 2240 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2241 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2242 | * Mic = 0x18, Line = 0x1a |
| 2243 | */ |
| 2244 | |
| 2245 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2246 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2247 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2248 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2249 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2250 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2251 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2252 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2253 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2254 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2255 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2256 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2257 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2258 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2259 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2260 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2261 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2262 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2263 | { |
| 2264 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2265 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2266 | .info = alc_ch_mode_info, |
| 2267 | .get = alc_ch_mode_get, |
| 2268 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2269 | }, |
| 2270 | { } /* end */ |
| 2271 | }; |
| 2272 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2273 | /* |
| 2274 | * ALC880 ASUS W1V model |
| 2275 | * |
| 2276 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2277 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2278 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2279 | */ |
| 2280 | |
| 2281 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2282 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2283 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2284 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2285 | { } /* end */ |
| 2286 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2287 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2288 | /* TCL S700 */ |
| 2289 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2290 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2291 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2292 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2293 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2294 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2295 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2296 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2297 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2298 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2299 | { } /* end */ |
| 2300 | }; |
| 2301 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2302 | /* Uniwill */ |
| 2303 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2304 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2305 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2306 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2307 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2308 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2309 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2310 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2311 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2312 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2313 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2314 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2315 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2316 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2317 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2318 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2319 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2320 | { |
| 2321 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2322 | .name = "Channel Mode", |
| 2323 | .info = alc_ch_mode_info, |
| 2324 | .get = alc_ch_mode_get, |
| 2325 | .put = alc_ch_mode_put, |
| 2326 | }, |
| 2327 | { } /* end */ |
| 2328 | }; |
| 2329 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2330 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2331 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2332 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2333 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2334 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2335 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2336 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2337 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2338 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2339 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2340 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2341 | { } /* end */ |
| 2342 | }; |
| 2343 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2344 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2345 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2346 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2347 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2348 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2349 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2350 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2351 | { } /* end */ |
| 2352 | }; |
| 2353 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2354 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2355 | * virtual master controls |
| 2356 | */ |
| 2357 | |
| 2358 | /* |
| 2359 | * slave controls for virtual master |
| 2360 | */ |
| 2361 | static const char *alc_slave_vols[] = { |
| 2362 | "Front Playback Volume", |
| 2363 | "Surround Playback Volume", |
| 2364 | "Center Playback Volume", |
| 2365 | "LFE Playback Volume", |
| 2366 | "Side Playback Volume", |
| 2367 | "Headphone Playback Volume", |
| 2368 | "Speaker Playback Volume", |
| 2369 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2370 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2371 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2372 | NULL, |
| 2373 | }; |
| 2374 | |
| 2375 | static const char *alc_slave_sws[] = { |
| 2376 | "Front Playback Switch", |
| 2377 | "Surround Playback Switch", |
| 2378 | "Center Playback Switch", |
| 2379 | "LFE Playback Switch", |
| 2380 | "Side Playback Switch", |
| 2381 | "Headphone Playback Switch", |
| 2382 | "Speaker Playback Switch", |
| 2383 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2384 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2385 | NULL, |
| 2386 | }; |
| 2387 | |
| 2388 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2389 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2390 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2391 | |
| 2392 | static void alc_free_kctls(struct hda_codec *codec); |
| 2393 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2394 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2395 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2396 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2397 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2398 | { } /* end */ |
| 2399 | }; |
| 2400 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2401 | static int alc_build_controls(struct hda_codec *codec) |
| 2402 | { |
| 2403 | struct alc_spec *spec = codec->spec; |
| 2404 | int err; |
| 2405 | int i; |
| 2406 | |
| 2407 | for (i = 0; i < spec->num_mixers; i++) { |
| 2408 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2409 | if (err < 0) |
| 2410 | return err; |
| 2411 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2412 | if (spec->cap_mixer) { |
| 2413 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2414 | if (err < 0) |
| 2415 | return err; |
| 2416 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2417 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2418 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2419 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2420 | if (err < 0) |
| 2421 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2422 | if (!spec->no_analog) { |
| 2423 | err = snd_hda_create_spdif_share_sw(codec, |
| 2424 | &spec->multiout); |
| 2425 | if (err < 0) |
| 2426 | return err; |
| 2427 | spec->multiout.share_spdif = 1; |
| 2428 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2429 | } |
| 2430 | if (spec->dig_in_nid) { |
| 2431 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2432 | if (err < 0) |
| 2433 | return err; |
| 2434 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2435 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2436 | /* create beep controls if needed */ |
| 2437 | if (spec->beep_amp) { |
| 2438 | struct snd_kcontrol_new *knew; |
| 2439 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2440 | struct snd_kcontrol *kctl; |
| 2441 | kctl = snd_ctl_new1(knew, codec); |
| 2442 | if (!kctl) |
| 2443 | return -ENOMEM; |
| 2444 | kctl->private_value = spec->beep_amp; |
| 2445 | err = snd_hda_ctl_add(codec, kctl); |
| 2446 | if (err < 0) |
| 2447 | return err; |
| 2448 | } |
| 2449 | } |
| 2450 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2451 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2452 | if (!spec->no_analog && |
| 2453 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2454 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2455 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2456 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2457 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2458 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2459 | if (err < 0) |
| 2460 | return err; |
| 2461 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2462 | if (!spec->no_analog && |
| 2463 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2464 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2465 | NULL, alc_slave_sws); |
| 2466 | if (err < 0) |
| 2467 | return err; |
| 2468 | } |
| 2469 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2470 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2471 | return 0; |
| 2472 | } |
| 2473 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2474 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2475 | /* |
| 2476 | * initialize the codec volumes, etc |
| 2477 | */ |
| 2478 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2479 | /* |
| 2480 | * generic initialization of ADC, input mixers and output mixers |
| 2481 | */ |
| 2482 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2483 | /* |
| 2484 | * Unmute ADC0-2 and set the default input to mic-in |
| 2485 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2486 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2487 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2488 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2489 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2490 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2491 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2492 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2493 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2494 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2495 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2496 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2497 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2498 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2499 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2500 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2501 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2502 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2503 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2504 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2505 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2506 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2507 | /* |
| 2508 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2509 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2510 | /* set vol=0 to output mixers */ |
| 2511 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2512 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2513 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2514 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2515 | /* set up input amps for analog loopback */ |
| 2516 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2519 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2520 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2521 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2522 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2523 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2524 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2525 | |
| 2526 | { } |
| 2527 | }; |
| 2528 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2529 | /* |
| 2530 | * 3-stack pin configuration: |
| 2531 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2532 | */ |
| 2533 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2534 | /* |
| 2535 | * preset connection lists of input pins |
| 2536 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2537 | */ |
| 2538 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2539 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2540 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2541 | |
| 2542 | /* |
| 2543 | * Set pin mode and muting |
| 2544 | */ |
| 2545 | /* set front pin widgets 0x14 for output */ |
| 2546 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2547 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2548 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2549 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2550 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2551 | /* Mic2 (as headphone out) for HP output */ |
| 2552 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2553 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2554 | /* Line In pin widget for input */ |
| 2555 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2556 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2557 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2558 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2559 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2560 | /* CD pin widget for input */ |
| 2561 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2562 | |
| 2563 | { } |
| 2564 | }; |
| 2565 | |
| 2566 | /* |
| 2567 | * 5-stack pin configuration: |
| 2568 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2569 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2570 | */ |
| 2571 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2572 | /* |
| 2573 | * preset connection lists of input pins |
| 2574 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2575 | */ |
| 2576 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2577 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2578 | |
| 2579 | /* |
| 2580 | * Set pin mode and muting |
| 2581 | */ |
| 2582 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2583 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2584 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2585 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2586 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2587 | /* unmute pins for output (no gain on this amp) */ |
| 2588 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2589 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2590 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2591 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2592 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2593 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2594 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2595 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2596 | /* Mic2 (as headphone out) for HP output */ |
| 2597 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2598 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2599 | /* Line In pin widget for input */ |
| 2600 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2601 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2602 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2603 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2604 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2605 | /* CD pin widget for input */ |
| 2606 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2607 | |
| 2608 | { } |
| 2609 | }; |
| 2610 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2611 | /* |
| 2612 | * W810 pin configuration: |
| 2613 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2614 | */ |
| 2615 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2616 | /* hphone/speaker input selector: front DAC */ |
| 2617 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2618 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2619 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2620 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2621 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2622 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2623 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2624 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2625 | |
| 2626 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2627 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2628 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2629 | { } |
| 2630 | }; |
| 2631 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2632 | /* |
| 2633 | * Z71V pin configuration: |
| 2634 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2635 | */ |
| 2636 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2638 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2639 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2640 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2641 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2642 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2643 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2644 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2645 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2646 | |
| 2647 | { } |
| 2648 | }; |
| 2649 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2650 | /* |
| 2651 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2652 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2653 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2654 | */ |
| 2655 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2656 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2657 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2658 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2659 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2660 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2661 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2662 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2663 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2664 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2665 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2666 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2667 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2668 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2669 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2670 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2671 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2672 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2673 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2674 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2675 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2676 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2677 | { } |
| 2678 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2679 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2680 | /* |
| 2681 | * Uniwill pin configuration: |
| 2682 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2683 | * line = 0x1a |
| 2684 | */ |
| 2685 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2686 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2687 | |
| 2688 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2689 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2690 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2691 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2692 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2693 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2694 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2695 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2696 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2697 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2698 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2699 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2700 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2701 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2702 | |
| 2703 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2704 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2705 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2706 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2707 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2708 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2709 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2710 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2711 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2712 | |
| 2713 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2714 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2715 | |
| 2716 | { } |
| 2717 | }; |
| 2718 | |
| 2719 | /* |
| 2720 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2721 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2722 | */ |
| 2723 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2724 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 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_HP}, |
| 2729 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2730 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2731 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2732 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2733 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2734 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2735 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2736 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2737 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2738 | |
| 2739 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2740 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2741 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2742 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2743 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2744 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2745 | |
| 2746 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2747 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2748 | |
| 2749 | { } |
| 2750 | }; |
| 2751 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2752 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2753 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2754 | { } |
| 2755 | }; |
| 2756 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2757 | /* auto-toggle front mic */ |
| 2758 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2759 | { |
| 2760 | unsigned int present; |
| 2761 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2762 | |
| 2763 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2764 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2765 | bits = present ? HDA_AMP_MUTE : 0; |
| 2766 | 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] | 2767 | } |
| 2768 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2769 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2770 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2771 | struct alc_spec *spec = codec->spec; |
| 2772 | |
| 2773 | spec->autocfg.hp_pins[0] = 0x14; |
| 2774 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2775 | spec->autocfg.speaker_pins[0] = 0x16; |
| 2776 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2777 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2778 | } |
| 2779 | |
| 2780 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2781 | unsigned int res) |
| 2782 | { |
| 2783 | /* Looks like the unsol event is incompatible with the standard |
| 2784 | * definition. 4bit tag is placed at 28 bit! |
| 2785 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2786 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2787 | case ALC880_MIC_EVENT: |
| 2788 | alc880_uniwill_mic_automute(codec); |
| 2789 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2790 | default: |
| 2791 | alc_automute_amp_unsol_event(codec, res); |
| 2792 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2793 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2794 | } |
| 2795 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2796 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2797 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2798 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2799 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2800 | spec->autocfg.hp_pins[0] = 0x14; |
| 2801 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2802 | alc_automute_amp(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2803 | } |
| 2804 | |
| 2805 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2806 | { |
| 2807 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2808 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2809 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2810 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2811 | present &= HDA_AMP_VOLMASK; |
| 2812 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2813 | HDA_AMP_VOLMASK, present); |
| 2814 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2815 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2816 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2817 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2818 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2819 | unsigned int res) |
| 2820 | { |
| 2821 | /* Looks like the unsol event is incompatible with the standard |
| 2822 | * definition. 4bit tag is placed at 28 bit! |
| 2823 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2824 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2825 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2826 | else |
| 2827 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2828 | } |
| 2829 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2830 | /* |
| 2831 | * F1734 pin configuration: |
| 2832 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2833 | */ |
| 2834 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2835 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2836 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2837 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2838 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2839 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2840 | |
| 2841 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2842 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2843 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2844 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2845 | |
| 2846 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2847 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2848 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2849 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2850 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2851 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2852 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2853 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2854 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2855 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2856 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2857 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2858 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2859 | { } |
| 2860 | }; |
| 2861 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2862 | /* |
| 2863 | * ASUS pin configuration: |
| 2864 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2865 | */ |
| 2866 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2867 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2868 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2869 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2870 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2871 | |
| 2872 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2873 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2874 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2875 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2876 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2877 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2878 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2879 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2880 | |
| 2881 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2882 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2883 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2884 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2885 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2886 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2887 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2888 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2889 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2890 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2891 | { } |
| 2892 | }; |
| 2893 | |
| 2894 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2895 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2896 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2897 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2898 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2899 | /* Clevo m520g init */ |
| 2900 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2901 | /* headphone output */ |
| 2902 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2903 | /* line-out */ |
| 2904 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2905 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2906 | /* Line-in */ |
| 2907 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2908 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2909 | /* CD */ |
| 2910 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2911 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2912 | /* Mic1 (rear panel) */ |
| 2913 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2914 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2915 | /* Mic2 (front panel) */ |
| 2916 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2917 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2918 | /* headphone */ |
| 2919 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2920 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2921 | /* change to EAPD mode */ |
| 2922 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2923 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2924 | |
| 2925 | { } |
| 2926 | }; |
| 2927 | |
| 2928 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2929 | /* change to EAPD mode */ |
| 2930 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2931 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2932 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2933 | /* Headphone output */ |
| 2934 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2935 | /* Front output*/ |
| 2936 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2937 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2938 | |
| 2939 | /* Line In pin widget for input */ |
| 2940 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2941 | /* CD pin widget for input */ |
| 2942 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2943 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2944 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2945 | |
| 2946 | /* change to EAPD mode */ |
| 2947 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2948 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2949 | |
| 2950 | { } |
| 2951 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2952 | |
| 2953 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2954 | * LG m1 express dual |
| 2955 | * |
| 2956 | * Pin assignment: |
| 2957 | * Rear Line-In/Out (blue): 0x14 |
| 2958 | * Build-in Mic-In: 0x15 |
| 2959 | * Speaker-out: 0x17 |
| 2960 | * HP-Out (green): 0x1b |
| 2961 | * Mic-In/Out (red): 0x19 |
| 2962 | * SPDIF-Out: 0x1e |
| 2963 | */ |
| 2964 | |
| 2965 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2966 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2967 | 0x05, 0x02, 0x03 |
| 2968 | }; |
| 2969 | |
| 2970 | /* seems analog CD is not working */ |
| 2971 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2972 | .num_items = 3, |
| 2973 | .items = { |
| 2974 | { "Mic", 0x1 }, |
| 2975 | { "Line", 0x5 }, |
| 2976 | { "Internal Mic", 0x6 }, |
| 2977 | }, |
| 2978 | }; |
| 2979 | |
| 2980 | /* 2,4,6 channel modes */ |
| 2981 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2982 | /* set line-in and mic-in to input */ |
| 2983 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2984 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2985 | { } |
| 2986 | }; |
| 2987 | |
| 2988 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2989 | /* set line-in to out and mic-in to input */ |
| 2990 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2991 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2992 | { } |
| 2993 | }; |
| 2994 | |
| 2995 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2996 | /* set line-in and mic-in to output */ |
| 2997 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2998 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2999 | { } |
| 3000 | }; |
| 3001 | |
| 3002 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3003 | { 2, alc880_lg_ch2_init }, |
| 3004 | { 4, alc880_lg_ch4_init }, |
| 3005 | { 6, alc880_lg_ch6_init }, |
| 3006 | }; |
| 3007 | |
| 3008 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3009 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3010 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3011 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3012 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3013 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3014 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3015 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3016 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3017 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3018 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3019 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3020 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3021 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3022 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3023 | { |
| 3024 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3025 | .name = "Channel Mode", |
| 3026 | .info = alc_ch_mode_info, |
| 3027 | .get = alc_ch_mode_get, |
| 3028 | .put = alc_ch_mode_put, |
| 3029 | }, |
| 3030 | { } /* end */ |
| 3031 | }; |
| 3032 | |
| 3033 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3034 | /* set capture source to mic-in */ |
| 3035 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3036 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3037 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3038 | /* mute all amp mixer inputs */ |
| 3039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3042 | /* line-in to input */ |
| 3043 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3044 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3045 | /* built-in mic */ |
| 3046 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3047 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3048 | /* speaker-out */ |
| 3049 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3050 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3051 | /* mic-in to input */ |
| 3052 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3053 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3054 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3055 | /* HP-out */ |
| 3056 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3057 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3058 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3059 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3060 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3061 | { } |
| 3062 | }; |
| 3063 | |
| 3064 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3065 | static void alc880_lg_init_hook(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3066 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3067 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3068 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3069 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3070 | spec->autocfg.speaker_pins[0] = 0x17; |
| 3071 | alc_automute_amp(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3072 | } |
| 3073 | |
| 3074 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3075 | * LG LW20 |
| 3076 | * |
| 3077 | * Pin assignment: |
| 3078 | * Speaker-out: 0x14 |
| 3079 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3080 | * Built-in Mic-In: 0x19 |
| 3081 | * Line-In: 0x1b |
| 3082 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3083 | * SPDIF-Out: 0x1e |
| 3084 | */ |
| 3085 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3086 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3087 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3088 | .items = { |
| 3089 | { "Mic", 0x0 }, |
| 3090 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3091 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3092 | }, |
| 3093 | }; |
| 3094 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3095 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3096 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3097 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3098 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3099 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3100 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3101 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3102 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3103 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3104 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3105 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3106 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3107 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3108 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3109 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3110 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3111 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3112 | { |
| 3113 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3114 | .name = "Channel Mode", |
| 3115 | .info = alc_ch_mode_info, |
| 3116 | .get = alc_ch_mode_get, |
| 3117 | .put = alc_ch_mode_put, |
| 3118 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3119 | { } /* end */ |
| 3120 | }; |
| 3121 | |
| 3122 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3123 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3124 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3125 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3126 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3127 | /* set capture source to mic-in */ |
| 3128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3129 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3130 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3132 | /* speaker-out */ |
| 3133 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3134 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3135 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3136 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3137 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3138 | /* mic-in to input */ |
| 3139 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3140 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3141 | /* built-in mic */ |
| 3142 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3143 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3144 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3145 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3146 | { } |
| 3147 | }; |
| 3148 | |
| 3149 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3150 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3151 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3152 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3153 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3154 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3155 | spec->autocfg.speaker_pins[0] = 0x14; |
| 3156 | alc_automute_amp(codec); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3157 | } |
| 3158 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3159 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3160 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3161 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3162 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3164 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3165 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3166 | { } /* end */ |
| 3167 | }; |
| 3168 | |
| 3169 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3170 | .num_items = 2, |
| 3171 | .items = { |
| 3172 | { "Mic", 0x0 }, |
| 3173 | { "Internal Mic", 0x1 }, |
| 3174 | }, |
| 3175 | }; |
| 3176 | |
| 3177 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3178 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3179 | |
| 3180 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3181 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3182 | |
| 3183 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3184 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3185 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3186 | /* Mic2 (as headphone out) for HP output */ |
| 3187 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3188 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3189 | /* Internal Speaker */ |
| 3190 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3191 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3192 | |
| 3193 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3194 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3195 | |
| 3196 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3197 | { } |
| 3198 | }; |
| 3199 | |
| 3200 | /* toggle speaker-output according to the hp-jack state */ |
| 3201 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3202 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3203 | struct alc_spec *spec = codec->spec; |
| 3204 | alc_automute_amp(codec); |
| 3205 | /* toggle EAPD */ |
| 3206 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3207 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3208 | else |
| 3209 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3210 | } |
| 3211 | |
| 3212 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3213 | unsigned int res) |
| 3214 | { |
| 3215 | /* Looks like the unsol event is incompatible with the standard |
| 3216 | * definition. 4bit tag is placed at 28 bit! |
| 3217 | */ |
| 3218 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3219 | alc880_medion_rim_automute(codec); |
| 3220 | } |
| 3221 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3222 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) |
| 3223 | { |
| 3224 | struct alc_spec *spec = codec->spec; |
| 3225 | |
| 3226 | spec->autocfg.hp_pins[0] = 0x14; |
| 3227 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 3228 | alc880_medion_rim_automute(codec); |
| 3229 | } |
| 3230 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3231 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3232 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3233 | { 0x0b, HDA_INPUT, 0 }, |
| 3234 | { 0x0b, HDA_INPUT, 1 }, |
| 3235 | { 0x0b, HDA_INPUT, 2 }, |
| 3236 | { 0x0b, HDA_INPUT, 3 }, |
| 3237 | { 0x0b, HDA_INPUT, 4 }, |
| 3238 | { } /* end */ |
| 3239 | }; |
| 3240 | |
| 3241 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3242 | { 0x0b, HDA_INPUT, 1 }, |
| 3243 | { 0x0b, HDA_INPUT, 6 }, |
| 3244 | { 0x0b, HDA_INPUT, 7 }, |
| 3245 | { } /* end */ |
| 3246 | }; |
| 3247 | #endif |
| 3248 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3249 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3250 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3251 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3252 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3253 | static int alc_init(struct hda_codec *codec) |
| 3254 | { |
| 3255 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3256 | unsigned int i; |
| 3257 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3258 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3259 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3260 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3261 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3262 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3263 | |
| 3264 | if (spec->init_hook) |
| 3265 | spec->init_hook(codec); |
| 3266 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3267 | return 0; |
| 3268 | } |
| 3269 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3270 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3271 | { |
| 3272 | struct alc_spec *spec = codec->spec; |
| 3273 | |
| 3274 | if (spec->unsol_event) |
| 3275 | spec->unsol_event(codec, res); |
| 3276 | } |
| 3277 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3278 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3279 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3280 | { |
| 3281 | struct alc_spec *spec = codec->spec; |
| 3282 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3283 | } |
| 3284 | #endif |
| 3285 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3286 | /* |
| 3287 | * Analog playback callbacks |
| 3288 | */ |
| 3289 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3290 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3291 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3292 | { |
| 3293 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3294 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3295 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3296 | } |
| 3297 | |
| 3298 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3299 | struct hda_codec *codec, |
| 3300 | unsigned int stream_tag, |
| 3301 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3302 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3303 | { |
| 3304 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3305 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3306 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3307 | } |
| 3308 | |
| 3309 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3310 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3311 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3312 | { |
| 3313 | struct alc_spec *spec = codec->spec; |
| 3314 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3315 | } |
| 3316 | |
| 3317 | /* |
| 3318 | * Digital out |
| 3319 | */ |
| 3320 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3321 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3322 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3323 | { |
| 3324 | struct alc_spec *spec = codec->spec; |
| 3325 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3326 | } |
| 3327 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3328 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3329 | struct hda_codec *codec, |
| 3330 | unsigned int stream_tag, |
| 3331 | unsigned int format, |
| 3332 | struct snd_pcm_substream *substream) |
| 3333 | { |
| 3334 | struct alc_spec *spec = codec->spec; |
| 3335 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3336 | stream_tag, format, substream); |
| 3337 | } |
| 3338 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3339 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3340 | struct hda_codec *codec, |
| 3341 | struct snd_pcm_substream *substream) |
| 3342 | { |
| 3343 | struct alc_spec *spec = codec->spec; |
| 3344 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3345 | } |
| 3346 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3347 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3348 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3349 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3350 | { |
| 3351 | struct alc_spec *spec = codec->spec; |
| 3352 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3353 | } |
| 3354 | |
| 3355 | /* |
| 3356 | * Analog capture |
| 3357 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3358 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3359 | struct hda_codec *codec, |
| 3360 | unsigned int stream_tag, |
| 3361 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3362 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3363 | { |
| 3364 | struct alc_spec *spec = codec->spec; |
| 3365 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3366 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3367 | stream_tag, 0, format); |
| 3368 | return 0; |
| 3369 | } |
| 3370 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3371 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3372 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3373 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3374 | { |
| 3375 | struct alc_spec *spec = codec->spec; |
| 3376 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3377 | snd_hda_codec_cleanup_stream(codec, |
| 3378 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3379 | return 0; |
| 3380 | } |
| 3381 | |
| 3382 | |
| 3383 | /* |
| 3384 | */ |
| 3385 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3386 | .substreams = 1, |
| 3387 | .channels_min = 2, |
| 3388 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3389 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3390 | .ops = { |
| 3391 | .open = alc880_playback_pcm_open, |
| 3392 | .prepare = alc880_playback_pcm_prepare, |
| 3393 | .cleanup = alc880_playback_pcm_cleanup |
| 3394 | }, |
| 3395 | }; |
| 3396 | |
| 3397 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3398 | .substreams = 1, |
| 3399 | .channels_min = 2, |
| 3400 | .channels_max = 2, |
| 3401 | /* NID is set in alc_build_pcms */ |
| 3402 | }; |
| 3403 | |
| 3404 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3405 | .substreams = 1, |
| 3406 | .channels_min = 2, |
| 3407 | .channels_max = 2, |
| 3408 | /* NID is set in alc_build_pcms */ |
| 3409 | }; |
| 3410 | |
| 3411 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3412 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3413 | .channels_min = 2, |
| 3414 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3415 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3416 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3417 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3418 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3419 | }, |
| 3420 | }; |
| 3421 | |
| 3422 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3423 | .substreams = 1, |
| 3424 | .channels_min = 2, |
| 3425 | .channels_max = 2, |
| 3426 | /* NID is set in alc_build_pcms */ |
| 3427 | .ops = { |
| 3428 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3429 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3430 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3431 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3432 | }, |
| 3433 | }; |
| 3434 | |
| 3435 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3436 | .substreams = 1, |
| 3437 | .channels_min = 2, |
| 3438 | .channels_max = 2, |
| 3439 | /* NID is set in alc_build_pcms */ |
| 3440 | }; |
| 3441 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3442 | /* 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] | 3443 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3444 | .substreams = 0, |
| 3445 | .channels_min = 0, |
| 3446 | .channels_max = 0, |
| 3447 | }; |
| 3448 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3449 | static int alc_build_pcms(struct hda_codec *codec) |
| 3450 | { |
| 3451 | struct alc_spec *spec = codec->spec; |
| 3452 | struct hda_pcm *info = spec->pcm_rec; |
| 3453 | int i; |
| 3454 | |
| 3455 | codec->num_pcms = 1; |
| 3456 | codec->pcm_info = info; |
| 3457 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3458 | if (spec->no_analog) |
| 3459 | goto skip_analog; |
| 3460 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3461 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3462 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3463 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3464 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3465 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3466 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3467 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3468 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3469 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3470 | } |
| 3471 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3472 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3473 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3474 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3475 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3476 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3477 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3478 | if (spec->channel_mode) { |
| 3479 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3480 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3481 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3482 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3483 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3484 | } |
| 3485 | } |
| 3486 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3487 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3488 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3489 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3490 | snprintf(spec->stream_name_digital, |
| 3491 | sizeof(spec->stream_name_digital), |
| 3492 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3493 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3494 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3495 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3496 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3497 | if (spec->dig_out_type) |
| 3498 | info->pcm_type = spec->dig_out_type; |
| 3499 | else |
| 3500 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3501 | if (spec->multiout.dig_out_nid && |
| 3502 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3503 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3504 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3505 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3506 | if (spec->dig_in_nid && |
| 3507 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3508 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3509 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3510 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3511 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3512 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3513 | } |
| 3514 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3515 | if (spec->no_analog) |
| 3516 | return 0; |
| 3517 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3518 | /* If the use of more than one ADC is requested for the current |
| 3519 | * model, configure a second analog capture-only PCM. |
| 3520 | */ |
| 3521 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3522 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3523 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3524 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3525 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3526 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3527 | if (spec->alt_dac_nid) { |
| 3528 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3529 | *spec->stream_analog_alt_playback; |
| 3530 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3531 | spec->alt_dac_nid; |
| 3532 | } else { |
| 3533 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3534 | alc_pcm_null_stream; |
| 3535 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3536 | } |
| 3537 | if (spec->num_adc_nids > 1) { |
| 3538 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3539 | *spec->stream_analog_alt_capture; |
| 3540 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3541 | spec->adc_nids[1]; |
| 3542 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3543 | spec->num_adc_nids - 1; |
| 3544 | } else { |
| 3545 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3546 | alc_pcm_null_stream; |
| 3547 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3548 | } |
| 3549 | } |
| 3550 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3551 | return 0; |
| 3552 | } |
| 3553 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3554 | static void alc_free_kctls(struct hda_codec *codec) |
| 3555 | { |
| 3556 | struct alc_spec *spec = codec->spec; |
| 3557 | |
| 3558 | if (spec->kctls.list) { |
| 3559 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3560 | int i; |
| 3561 | for (i = 0; i < spec->kctls.used; i++) |
| 3562 | kfree(kctl[i].name); |
| 3563 | } |
| 3564 | snd_array_free(&spec->kctls); |
| 3565 | } |
| 3566 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3567 | static void alc_free(struct hda_codec *codec) |
| 3568 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3569 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3570 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3571 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3572 | return; |
| 3573 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3574 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3575 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3576 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3577 | } |
| 3578 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3579 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3580 | static int alc_resume(struct hda_codec *codec) |
| 3581 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3582 | codec->patch_ops.init(codec); |
| 3583 | snd_hda_codec_resume_amp(codec); |
| 3584 | snd_hda_codec_resume_cache(codec); |
| 3585 | return 0; |
| 3586 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3587 | #endif |
| 3588 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3589 | /* |
| 3590 | */ |
| 3591 | static struct hda_codec_ops alc_patch_ops = { |
| 3592 | .build_controls = alc_build_controls, |
| 3593 | .build_pcms = alc_build_pcms, |
| 3594 | .init = alc_init, |
| 3595 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3596 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3597 | #ifdef SND_HDA_NEEDS_RESUME |
| 3598 | .resume = alc_resume, |
| 3599 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3600 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3601 | .check_power_status = alc_check_power_status, |
| 3602 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3603 | }; |
| 3604 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3605 | |
| 3606 | /* |
| 3607 | * Test configuration for debugging |
| 3608 | * |
| 3609 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3610 | * enum controls. |
| 3611 | */ |
| 3612 | #ifdef CONFIG_SND_DEBUG |
| 3613 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3614 | 0x02, 0x03, 0x04, 0x05 |
| 3615 | }; |
| 3616 | |
| 3617 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3618 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3619 | .items = { |
| 3620 | { "In-1", 0x0 }, |
| 3621 | { "In-2", 0x1 }, |
| 3622 | { "In-3", 0x2 }, |
| 3623 | { "In-4", 0x3 }, |
| 3624 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3625 | { "Front", 0x5 }, |
| 3626 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3627 | }, |
| 3628 | }; |
| 3629 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3630 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3631 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3632 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3633 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3634 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3635 | }; |
| 3636 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3637 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3638 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3639 | { |
| 3640 | static char *texts[] = { |
| 3641 | "N/A", "Line Out", "HP Out", |
| 3642 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3643 | }; |
| 3644 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3645 | uinfo->count = 1; |
| 3646 | uinfo->value.enumerated.items = 8; |
| 3647 | if (uinfo->value.enumerated.item >= 8) |
| 3648 | uinfo->value.enumerated.item = 7; |
| 3649 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3650 | return 0; |
| 3651 | } |
| 3652 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3653 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3654 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3655 | { |
| 3656 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3657 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3658 | unsigned int pin_ctl, item = 0; |
| 3659 | |
| 3660 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3661 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3662 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3663 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3664 | item = 2; |
| 3665 | else |
| 3666 | item = 1; |
| 3667 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3668 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3669 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3670 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3671 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3672 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3673 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3674 | } |
| 3675 | } |
| 3676 | ucontrol->value.enumerated.item[0] = item; |
| 3677 | return 0; |
| 3678 | } |
| 3679 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3680 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3681 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3682 | { |
| 3683 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3684 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3685 | static unsigned int ctls[] = { |
| 3686 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3687 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3688 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3689 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3690 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3691 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3692 | }; |
| 3693 | unsigned int old_ctl, new_ctl; |
| 3694 | |
| 3695 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3696 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3697 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3698 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3699 | int val; |
| 3700 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3701 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3702 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3703 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3704 | HDA_AMP_MUTE : 0; |
| 3705 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3706 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3707 | return 1; |
| 3708 | } |
| 3709 | return 0; |
| 3710 | } |
| 3711 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3712 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3713 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3714 | { |
| 3715 | static char *texts[] = { |
| 3716 | "Front", "Surround", "CLFE", "Side" |
| 3717 | }; |
| 3718 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3719 | uinfo->count = 1; |
| 3720 | uinfo->value.enumerated.items = 4; |
| 3721 | if (uinfo->value.enumerated.item >= 4) |
| 3722 | uinfo->value.enumerated.item = 3; |
| 3723 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3724 | return 0; |
| 3725 | } |
| 3726 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3727 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3728 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3729 | { |
| 3730 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3731 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3732 | unsigned int sel; |
| 3733 | |
| 3734 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3735 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3736 | return 0; |
| 3737 | } |
| 3738 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3739 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3740 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3741 | { |
| 3742 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3743 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3744 | unsigned int sel; |
| 3745 | |
| 3746 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3747 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3748 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3749 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3750 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3751 | return 1; |
| 3752 | } |
| 3753 | return 0; |
| 3754 | } |
| 3755 | |
| 3756 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3757 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3758 | .name = xname, \ |
| 3759 | .info = alc_test_pin_ctl_info, \ |
| 3760 | .get = alc_test_pin_ctl_get, \ |
| 3761 | .put = alc_test_pin_ctl_put, \ |
| 3762 | .private_value = nid \ |
| 3763 | } |
| 3764 | |
| 3765 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3766 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3767 | .name = xname, \ |
| 3768 | .info = alc_test_pin_src_info, \ |
| 3769 | .get = alc_test_pin_src_get, \ |
| 3770 | .put = alc_test_pin_src_put, \ |
| 3771 | .private_value = nid \ |
| 3772 | } |
| 3773 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3774 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3775 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3776 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3777 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3778 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3779 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3780 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3781 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3782 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3783 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3784 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3785 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3786 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3787 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3788 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3789 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3790 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3791 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3792 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3793 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3794 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3795 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3796 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3797 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3798 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3799 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3800 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3801 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3802 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3803 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3804 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3805 | { |
| 3806 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3807 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3808 | .info = alc_ch_mode_info, |
| 3809 | .get = alc_ch_mode_get, |
| 3810 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3811 | }, |
| 3812 | { } /* end */ |
| 3813 | }; |
| 3814 | |
| 3815 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3816 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3817 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3818 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3819 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3820 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3821 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3822 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3823 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3824 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3825 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3826 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3827 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3828 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3829 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3830 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3831 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3832 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3833 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3834 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3835 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3836 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3837 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3838 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3839 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3840 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3841 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3842 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3843 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3844 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3845 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3846 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3847 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3848 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3849 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3850 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3851 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3852 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3853 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3854 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3855 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3856 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3857 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3858 | /* Analog input/passthru */ |
| 3859 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3860 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3861 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3862 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3863 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3864 | { } |
| 3865 | }; |
| 3866 | #endif |
| 3867 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3868 | /* |
| 3869 | */ |
| 3870 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3871 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3872 | [ALC880_3ST] = "3stack", |
| 3873 | [ALC880_TCL_S700] = "tcl", |
| 3874 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3875 | [ALC880_CLEVO] = "clevo", |
| 3876 | [ALC880_5ST] = "5stack", |
| 3877 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3878 | [ALC880_W810] = "w810", |
| 3879 | [ALC880_Z71V] = "z71v", |
| 3880 | [ALC880_6ST] = "6stack", |
| 3881 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3882 | [ALC880_ASUS] = "asus", |
| 3883 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3884 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3885 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3886 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3887 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3888 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3889 | [ALC880_F1734] = "F1734", |
| 3890 | [ALC880_LG] = "lg", |
| 3891 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3892 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3893 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3894 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3895 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3896 | [ALC880_AUTO] = "auto", |
| 3897 | }; |
| 3898 | |
| 3899 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3900 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3901 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3902 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3903 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3904 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3905 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3906 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3907 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3908 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3909 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3910 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3911 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3912 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3913 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3914 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3915 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3916 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3917 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3918 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3919 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3920 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3921 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3922 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3923 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3924 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3925 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3926 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3927 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3928 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3929 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3930 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3931 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3932 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3933 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3934 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3935 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3936 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3937 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3938 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3939 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3940 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3941 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3942 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3943 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3944 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3945 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3946 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3947 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3948 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3949 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3950 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3951 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3952 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3953 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3954 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3955 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3956 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3957 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3958 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3959 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3960 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3961 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3962 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3963 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3964 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3965 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3966 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3967 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3968 | /* default Intel */ |
| 3969 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3970 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3971 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3972 | {} |
| 3973 | }; |
| 3974 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3975 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3976 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3977 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3978 | static struct alc_config_preset alc880_presets[] = { |
| 3979 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3980 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3981 | .init_verbs = { alc880_volume_init_verbs, |
| 3982 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3983 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3984 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3985 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3986 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3987 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3988 | .input_mux = &alc880_capture_source, |
| 3989 | }, |
| 3990 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3991 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3992 | .init_verbs = { alc880_volume_init_verbs, |
| 3993 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3994 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3995 | .dac_nids = alc880_dac_nids, |
| 3996 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3997 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3998 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3999 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4000 | .input_mux = &alc880_capture_source, |
| 4001 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4002 | [ALC880_TCL_S700] = { |
| 4003 | .mixers = { alc880_tcl_s700_mixer }, |
| 4004 | .init_verbs = { alc880_volume_init_verbs, |
| 4005 | alc880_pin_tcl_S700_init_verbs, |
| 4006 | alc880_gpio2_init_verbs }, |
| 4007 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4008 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4009 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4010 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4011 | .hp_nid = 0x03, |
| 4012 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4013 | .channel_mode = alc880_2_jack_modes, |
| 4014 | .input_mux = &alc880_capture_source, |
| 4015 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4016 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4017 | .mixers = { alc880_three_stack_mixer, |
| 4018 | alc880_five_stack_mixer}, |
| 4019 | .init_verbs = { alc880_volume_init_verbs, |
| 4020 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4021 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4022 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4023 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4024 | .channel_mode = alc880_fivestack_modes, |
| 4025 | .input_mux = &alc880_capture_source, |
| 4026 | }, |
| 4027 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4028 | .mixers = { alc880_three_stack_mixer, |
| 4029 | alc880_five_stack_mixer }, |
| 4030 | .init_verbs = { alc880_volume_init_verbs, |
| 4031 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4032 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4033 | .dac_nids = alc880_dac_nids, |
| 4034 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4035 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4036 | .channel_mode = alc880_fivestack_modes, |
| 4037 | .input_mux = &alc880_capture_source, |
| 4038 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4039 | [ALC880_6ST] = { |
| 4040 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4041 | .init_verbs = { alc880_volume_init_verbs, |
| 4042 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4043 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4044 | .dac_nids = alc880_6st_dac_nids, |
| 4045 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4046 | .channel_mode = alc880_sixstack_modes, |
| 4047 | .input_mux = &alc880_6stack_capture_source, |
| 4048 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4049 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4050 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4051 | .init_verbs = { alc880_volume_init_verbs, |
| 4052 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4053 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4054 | .dac_nids = alc880_6st_dac_nids, |
| 4055 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4056 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4057 | .channel_mode = alc880_sixstack_modes, |
| 4058 | .input_mux = &alc880_6stack_capture_source, |
| 4059 | }, |
| 4060 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4061 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4062 | .init_verbs = { alc880_volume_init_verbs, |
| 4063 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4064 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4065 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4066 | .dac_nids = alc880_w810_dac_nids, |
| 4067 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4068 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4069 | .channel_mode = alc880_w810_modes, |
| 4070 | .input_mux = &alc880_capture_source, |
| 4071 | }, |
| 4072 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4073 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4074 | .init_verbs = { alc880_volume_init_verbs, |
| 4075 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4076 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4077 | .dac_nids = alc880_z71v_dac_nids, |
| 4078 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4079 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4080 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4081 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4082 | .input_mux = &alc880_capture_source, |
| 4083 | }, |
| 4084 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4085 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4086 | .init_verbs = { alc880_volume_init_verbs, |
| 4087 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4088 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4089 | .dac_nids = alc880_f1734_dac_nids, |
| 4090 | .hp_nid = 0x02, |
| 4091 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4092 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4093 | .input_mux = &alc880_f1734_capture_source, |
| 4094 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4095 | .init_hook = alc880_uniwill_p53_init_hook, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4096 | }, |
| 4097 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4098 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4099 | .init_verbs = { alc880_volume_init_verbs, |
| 4100 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4101 | alc880_gpio1_init_verbs }, |
| 4102 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4103 | .dac_nids = alc880_asus_dac_nids, |
| 4104 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4105 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4106 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4107 | .input_mux = &alc880_capture_source, |
| 4108 | }, |
| 4109 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4110 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4111 | .init_verbs = { alc880_volume_init_verbs, |
| 4112 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4113 | alc880_gpio1_init_verbs }, |
| 4114 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4115 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4116 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4117 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4118 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4119 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4120 | .input_mux = &alc880_capture_source, |
| 4121 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4122 | [ALC880_ASUS_DIG2] = { |
| 4123 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4124 | .init_verbs = { alc880_volume_init_verbs, |
| 4125 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4126 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4127 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4128 | .dac_nids = alc880_asus_dac_nids, |
| 4129 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4130 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4131 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4132 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4133 | .input_mux = &alc880_capture_source, |
| 4134 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4135 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4136 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4137 | .init_verbs = { alc880_volume_init_verbs, |
| 4138 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4139 | alc880_gpio1_init_verbs }, |
| 4140 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4141 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4142 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4143 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4144 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4145 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4146 | .input_mux = &alc880_capture_source, |
| 4147 | }, |
| 4148 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4149 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4150 | .init_verbs = { alc880_volume_init_verbs, |
| 4151 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4152 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4153 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4154 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4155 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4156 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4157 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4158 | .input_mux = &alc880_capture_source, |
| 4159 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4160 | [ALC880_UNIWILL] = { |
| 4161 | .mixers = { alc880_uniwill_mixer }, |
| 4162 | .init_verbs = { alc880_volume_init_verbs, |
| 4163 | alc880_uniwill_init_verbs }, |
| 4164 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4165 | .dac_nids = alc880_asus_dac_nids, |
| 4166 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4167 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4168 | .channel_mode = alc880_threestack_modes, |
| 4169 | .need_dac_fix = 1, |
| 4170 | .input_mux = &alc880_capture_source, |
| 4171 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4172 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4173 | }, |
| 4174 | [ALC880_UNIWILL_P53] = { |
| 4175 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4176 | .init_verbs = { alc880_volume_init_verbs, |
| 4177 | alc880_uniwill_p53_init_verbs }, |
| 4178 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4179 | .dac_nids = alc880_asus_dac_nids, |
| 4180 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4181 | .channel_mode = alc880_threestack_modes, |
| 4182 | .input_mux = &alc880_capture_source, |
| 4183 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4184 | .init_hook = alc880_uniwill_p53_init_hook, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4185 | }, |
| 4186 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4187 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4188 | .init_verbs = { alc880_volume_init_verbs, |
| 4189 | alc880_uniwill_p53_init_verbs, |
| 4190 | alc880_beep_init_verbs }, |
| 4191 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4192 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4193 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4194 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4195 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4196 | .input_mux = &alc880_capture_source, |
| 4197 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4198 | .init_hook = alc880_uniwill_p53_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4199 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4200 | [ALC880_CLEVO] = { |
| 4201 | .mixers = { alc880_three_stack_mixer }, |
| 4202 | .init_verbs = { alc880_volume_init_verbs, |
| 4203 | alc880_pin_clevo_init_verbs }, |
| 4204 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4205 | .dac_nids = alc880_dac_nids, |
| 4206 | .hp_nid = 0x03, |
| 4207 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4208 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4209 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4210 | .input_mux = &alc880_capture_source, |
| 4211 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4212 | [ALC880_LG] = { |
| 4213 | .mixers = { alc880_lg_mixer }, |
| 4214 | .init_verbs = { alc880_volume_init_verbs, |
| 4215 | alc880_lg_init_verbs }, |
| 4216 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4217 | .dac_nids = alc880_lg_dac_nids, |
| 4218 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4219 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4220 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4221 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4222 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4223 | .unsol_event = alc_automute_amp_unsol_event, |
| 4224 | .init_hook = alc880_lg_init_hook, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4225 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4226 | .loopbacks = alc880_lg_loopbacks, |
| 4227 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4228 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4229 | [ALC880_LG_LW] = { |
| 4230 | .mixers = { alc880_lg_lw_mixer }, |
| 4231 | .init_verbs = { alc880_volume_init_verbs, |
| 4232 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4233 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4234 | .dac_nids = alc880_dac_nids, |
| 4235 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4236 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4237 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4238 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4239 | .unsol_event = alc_automute_amp_unsol_event, |
| 4240 | .init_hook = alc880_lg_lw_init_hook, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4241 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4242 | [ALC880_MEDION_RIM] = { |
| 4243 | .mixers = { alc880_medion_rim_mixer }, |
| 4244 | .init_verbs = { alc880_volume_init_verbs, |
| 4245 | alc880_medion_rim_init_verbs, |
| 4246 | alc_gpio2_init_verbs }, |
| 4247 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4248 | .dac_nids = alc880_dac_nids, |
| 4249 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4250 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4251 | .channel_mode = alc880_2_jack_modes, |
| 4252 | .input_mux = &alc880_medion_rim_capture_source, |
| 4253 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4254 | .init_hook = alc880_medion_rim_init_hook, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4255 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4256 | #ifdef CONFIG_SND_DEBUG |
| 4257 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4258 | .mixers = { alc880_test_mixer }, |
| 4259 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4260 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4261 | .dac_nids = alc880_test_dac_nids, |
| 4262 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4263 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4264 | .channel_mode = alc880_test_modes, |
| 4265 | .input_mux = &alc880_test_capture_source, |
| 4266 | }, |
| 4267 | #endif |
| 4268 | }; |
| 4269 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4270 | /* |
| 4271 | * Automatic parse of I/O pins from the BIOS configuration |
| 4272 | */ |
| 4273 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4274 | enum { |
| 4275 | ALC_CTL_WIDGET_VOL, |
| 4276 | ALC_CTL_WIDGET_MUTE, |
| 4277 | ALC_CTL_BIND_MUTE, |
| 4278 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4279 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4280 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4281 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4282 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4283 | }; |
| 4284 | |
| 4285 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4286 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4287 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4288 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4289 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4290 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4291 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4292 | knew = snd_array_new(&spec->kctls); |
| 4293 | if (!knew) |
| 4294 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4295 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4296 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4297 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4298 | return -ENOMEM; |
| 4299 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4300 | return 0; |
| 4301 | } |
| 4302 | |
| 4303 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4304 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4305 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4306 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4307 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4308 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4309 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4310 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4311 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4312 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4313 | #define ALC880_PIN_CD_NID 0x1c |
| 4314 | |
| 4315 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4316 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4317 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4318 | { |
| 4319 | hda_nid_t nid; |
| 4320 | int assigned[4]; |
| 4321 | int i, j; |
| 4322 | |
| 4323 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4324 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4325 | |
| 4326 | /* check the pins hardwired to audio widget */ |
| 4327 | for (i = 0; i < cfg->line_outs; i++) { |
| 4328 | nid = cfg->line_out_pins[i]; |
| 4329 | if (alc880_is_fixed_pin(nid)) { |
| 4330 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4331 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4332 | assigned[idx] = 1; |
| 4333 | } |
| 4334 | } |
| 4335 | /* left pins can be connect to any audio widget */ |
| 4336 | for (i = 0; i < cfg->line_outs; i++) { |
| 4337 | nid = cfg->line_out_pins[i]; |
| 4338 | if (alc880_is_fixed_pin(nid)) |
| 4339 | continue; |
| 4340 | /* search for an empty channel */ |
| 4341 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4342 | if (!assigned[j]) { |
| 4343 | spec->multiout.dac_nids[i] = |
| 4344 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4345 | assigned[j] = 1; |
| 4346 | break; |
| 4347 | } |
| 4348 | } |
| 4349 | } |
| 4350 | spec->multiout.num_dacs = cfg->line_outs; |
| 4351 | return 0; |
| 4352 | } |
| 4353 | |
| 4354 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4355 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4356 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | { |
| 4358 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4359 | static const char *chname[4] = { |
| 4360 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4361 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4362 | hda_nid_t nid; |
| 4363 | int i, err; |
| 4364 | |
| 4365 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4366 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4367 | continue; |
| 4368 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4369 | if (i == 2) { |
| 4370 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4371 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4372 | "Center Playback Volume", |
| 4373 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4374 | HDA_OUTPUT)); |
| 4375 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4376 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4377 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4378 | "LFE Playback Volume", |
| 4379 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4380 | HDA_OUTPUT)); |
| 4381 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4382 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4383 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4384 | "Center Playback Switch", |
| 4385 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4386 | HDA_INPUT)); |
| 4387 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4388 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4389 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4390 | "LFE Playback Switch", |
| 4391 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4392 | HDA_INPUT)); |
| 4393 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4394 | return err; |
| 4395 | } else { |
| 4396 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4397 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4398 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4399 | HDA_OUTPUT)); |
| 4400 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4401 | return err; |
| 4402 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4403 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4404 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4405 | HDA_INPUT)); |
| 4406 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4407 | return err; |
| 4408 | } |
| 4409 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4410 | return 0; |
| 4411 | } |
| 4412 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4413 | /* add playback controls for speaker and HP outputs */ |
| 4414 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4415 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4416 | { |
| 4417 | hda_nid_t nid; |
| 4418 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4419 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4420 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4421 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4422 | return 0; |
| 4423 | |
| 4424 | if (alc880_is_fixed_pin(pin)) { |
| 4425 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4426 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4427 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4428 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4429 | else |
| 4430 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4431 | /* control HP volume/switch on the output mixer amp */ |
| 4432 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4433 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4434 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4435 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4436 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4437 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4438 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4439 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4440 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4441 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4442 | return err; |
| 4443 | } else if (alc880_is_multi_pin(pin)) { |
| 4444 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4445 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4446 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4447 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4448 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4449 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4450 | return err; |
| 4451 | } |
| 4452 | return 0; |
| 4453 | } |
| 4454 | |
| 4455 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4456 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4457 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4458 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4459 | { |
| 4460 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4461 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4462 | |
| 4463 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4464 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4465 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4466 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4467 | return err; |
| 4468 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4469 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4470 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4471 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4472 | return err; |
| 4473 | return 0; |
| 4474 | } |
| 4475 | |
| 4476 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4477 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4478 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4479 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4480 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4481 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4482 | |
| 4483 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4484 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4485 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4486 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4487 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4488 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4489 | if (err < 0) |
| 4490 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4491 | imux->items[imux->num_items].label = |
| 4492 | auto_pin_cfg_labels[i]; |
| 4493 | imux->items[imux->num_items].index = |
| 4494 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4495 | imux->num_items++; |
| 4496 | } |
| 4497 | } |
| 4498 | return 0; |
| 4499 | } |
| 4500 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4501 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4502 | unsigned int pin_type) |
| 4503 | { |
| 4504 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4505 | pin_type); |
| 4506 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4507 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4508 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4509 | } |
| 4510 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4511 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4512 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4513 | int dac_idx) |
| 4514 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4515 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4516 | /* need the manual connection? */ |
| 4517 | if (alc880_is_multi_pin(nid)) { |
| 4518 | struct alc_spec *spec = codec->spec; |
| 4519 | int idx = alc880_multi_pin_idx(nid); |
| 4520 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4521 | AC_VERB_SET_CONNECT_SEL, |
| 4522 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4523 | } |
| 4524 | } |
| 4525 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4526 | static int get_pin_type(int line_out_type) |
| 4527 | { |
| 4528 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4529 | return PIN_HP; |
| 4530 | else |
| 4531 | return PIN_OUT; |
| 4532 | } |
| 4533 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4534 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4535 | { |
| 4536 | struct alc_spec *spec = codec->spec; |
| 4537 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4538 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4539 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4540 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4541 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4542 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4543 | } |
| 4544 | } |
| 4545 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4546 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4547 | { |
| 4548 | struct alc_spec *spec = codec->spec; |
| 4549 | hda_nid_t pin; |
| 4550 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4551 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4552 | if (pin) /* connect to front */ |
| 4553 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4554 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4555 | if (pin) /* connect to front */ |
| 4556 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4557 | } |
| 4558 | |
| 4559 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4560 | { |
| 4561 | struct alc_spec *spec = codec->spec; |
| 4562 | int i; |
| 4563 | |
| 4564 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4565 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4566 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4567 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4568 | if (nid != ALC880_PIN_CD_NID && |
| 4569 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4570 | snd_hda_codec_write(codec, nid, 0, |
| 4571 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4572 | AMP_OUT_MUTE); |
| 4573 | } |
| 4574 | } |
| 4575 | } |
| 4576 | |
| 4577 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4578 | /* return 1 if successful, 0 if the proper config is not found, |
| 4579 | * or a negative error code |
| 4580 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4581 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4582 | { |
| 4583 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4584 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4585 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4586 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4587 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4588 | alc880_ignore); |
| 4589 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4590 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4591 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4592 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4593 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4594 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4595 | if (err < 0) |
| 4596 | return err; |
| 4597 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4598 | if (err < 0) |
| 4599 | return err; |
| 4600 | err = alc880_auto_create_extra_out(spec, |
| 4601 | spec->autocfg.speaker_pins[0], |
| 4602 | "Speaker"); |
| 4603 | if (err < 0) |
| 4604 | return err; |
| 4605 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4606 | "Headphone"); |
| 4607 | if (err < 0) |
| 4608 | return err; |
| 4609 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4610 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4611 | return err; |
| 4612 | |
| 4613 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4614 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4615 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4616 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4617 | hda_nid_t dig_nid; |
| 4618 | err = snd_hda_get_connections(codec, |
| 4619 | spec->autocfg.dig_out_pins[i], |
| 4620 | &dig_nid, 1); |
| 4621 | if (err < 0) |
| 4622 | continue; |
| 4623 | if (!i) |
| 4624 | spec->multiout.dig_out_nid = dig_nid; |
| 4625 | else { |
| 4626 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4627 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4628 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4629 | break; |
| 4630 | } |
| 4631 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4632 | if (spec->autocfg.dig_in_pin) |
| 4633 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4634 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4635 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4636 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4637 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4638 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4639 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4640 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4641 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4642 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4643 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4644 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4645 | return 1; |
| 4646 | } |
| 4647 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4648 | /* additional initialization for auto-configuration model */ |
| 4649 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4650 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4651 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4652 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4653 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4654 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4655 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4656 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4657 | } |
| 4658 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4659 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 4660 | * one of two digital mic pins, e.g. on ALC272 |
| 4661 | */ |
| 4662 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4663 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4664 | struct alc_spec *spec = codec->spec; |
| 4665 | int i; |
| 4666 | |
| 4667 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4668 | hda_nid_t cap = spec->capsrc_nids ? |
| 4669 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4670 | int iidx, eidx; |
| 4671 | |
| 4672 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 4673 | if (iidx < 0) |
| 4674 | continue; |
| 4675 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 4676 | if (eidx < 0) |
| 4677 | continue; |
| 4678 | spec->int_mic.mux_idx = iidx; |
| 4679 | spec->ext_mic.mux_idx = eidx; |
| 4680 | if (spec->capsrc_nids) |
| 4681 | spec->capsrc_nids += i; |
| 4682 | spec->adc_nids += i; |
| 4683 | spec->num_adc_nids = 1; |
| 4684 | return; |
| 4685 | } |
| 4686 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 4687 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 4688 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 4689 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 4690 | } |
| 4691 | |
| 4692 | static void set_capture_mixer(struct hda_codec *codec) |
| 4693 | { |
| 4694 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4695 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4696 | { alc_capture_mixer_nosrc1, |
| 4697 | alc_capture_mixer_nosrc2, |
| 4698 | alc_capture_mixer_nosrc3 }, |
| 4699 | { alc_capture_mixer1, |
| 4700 | alc_capture_mixer2, |
| 4701 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4702 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4703 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4704 | int mux; |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4705 | if (spec->auto_mic) { |
| 4706 | mux = 0; |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4707 | fixup_automic_adc(codec); |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4708 | } else if (spec->input_mux && spec->input_mux->num_items > 1) |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4709 | mux = 1; |
| 4710 | else |
| 4711 | mux = 0; |
| 4712 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4713 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4714 | } |
| 4715 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4716 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4717 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4718 | |
| 4719 | /* |
| 4720 | * OK, here we have finally the patch for ALC880 |
| 4721 | */ |
| 4722 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4723 | static int patch_alc880(struct hda_codec *codec) |
| 4724 | { |
| 4725 | struct alc_spec *spec; |
| 4726 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4727 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4728 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4729 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4730 | if (spec == NULL) |
| 4731 | return -ENOMEM; |
| 4732 | |
| 4733 | codec->spec = spec; |
| 4734 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4735 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4736 | alc880_models, |
| 4737 | alc880_cfg_tbl); |
| 4738 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 4739 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 4740 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4741 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4742 | } |
| 4743 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4744 | if (board_config == ALC880_AUTO) { |
| 4745 | /* automatic parse from the BIOS config */ |
| 4746 | err = alc880_parse_auto_config(codec); |
| 4747 | if (err < 0) { |
| 4748 | alc_free(codec); |
| 4749 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4750 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4751 | printk(KERN_INFO |
| 4752 | "hda_codec: Cannot set up configuration " |
| 4753 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4754 | board_config = ALC880_3ST; |
| 4755 | } |
| 4756 | } |
| 4757 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4758 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4759 | if (err < 0) { |
| 4760 | alc_free(codec); |
| 4761 | return err; |
| 4762 | } |
| 4763 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4764 | if (board_config != ALC880_AUTO) |
| 4765 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4766 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4767 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4768 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4769 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4770 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4771 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4772 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4773 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4774 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4775 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4776 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4777 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 4778 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4779 | if (wcap != AC_WID_AUD_IN) { |
| 4780 | spec->adc_nids = alc880_adc_nids_alt; |
| 4781 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4782 | } else { |
| 4783 | spec->adc_nids = alc880_adc_nids; |
| 4784 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4785 | } |
| 4786 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4787 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4788 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4789 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4790 | spec->vmaster_nid = 0x0c; |
| 4791 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4792 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4793 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4794 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4795 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4796 | if (!spec->loopback.amplist) |
| 4797 | spec->loopback.amplist = alc880_loopbacks; |
| 4798 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4799 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4800 | |
| 4801 | return 0; |
| 4802 | } |
| 4803 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4804 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4805 | /* |
| 4806 | * ALC260 support |
| 4807 | */ |
| 4808 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4809 | static hda_nid_t alc260_dac_nids[1] = { |
| 4810 | /* front */ |
| 4811 | 0x02, |
| 4812 | }; |
| 4813 | |
| 4814 | static hda_nid_t alc260_adc_nids[1] = { |
| 4815 | /* ADC0 */ |
| 4816 | 0x04, |
| 4817 | }; |
| 4818 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4819 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4820 | /* ADC1 */ |
| 4821 | 0x05, |
| 4822 | }; |
| 4823 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4824 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4825 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4826 | */ |
| 4827 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4828 | /* ADC0, ADC1 */ |
| 4829 | 0x04, 0x05 |
| 4830 | }; |
| 4831 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4832 | #define ALC260_DIGOUT_NID 0x03 |
| 4833 | #define ALC260_DIGIN_NID 0x06 |
| 4834 | |
| 4835 | static struct hda_input_mux alc260_capture_source = { |
| 4836 | .num_items = 4, |
| 4837 | .items = { |
| 4838 | { "Mic", 0x0 }, |
| 4839 | { "Front Mic", 0x1 }, |
| 4840 | { "Line", 0x2 }, |
| 4841 | { "CD", 0x4 }, |
| 4842 | }, |
| 4843 | }; |
| 4844 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4845 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4846 | * headphone jack and the internal CD lines since these are the only pins at |
| 4847 | * which audio can appear. For flexibility, also allow the option of |
| 4848 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4849 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4850 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4851 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4852 | { |
| 4853 | .num_items = 3, |
| 4854 | .items = { |
| 4855 | { "Mic/Line", 0x0 }, |
| 4856 | { "CD", 0x4 }, |
| 4857 | { "Headphone", 0x2 }, |
| 4858 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4859 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4860 | { |
| 4861 | .num_items = 4, |
| 4862 | .items = { |
| 4863 | { "Mic/Line", 0x0 }, |
| 4864 | { "CD", 0x4 }, |
| 4865 | { "Headphone", 0x2 }, |
| 4866 | { "Mixer", 0x5 }, |
| 4867 | }, |
| 4868 | }, |
| 4869 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4870 | }; |
| 4871 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4872 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4873 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4874 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4875 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4876 | { |
| 4877 | .num_items = 4, |
| 4878 | .items = { |
| 4879 | { "Mic", 0x0 }, |
| 4880 | { "Line", 0x2 }, |
| 4881 | { "CD", 0x4 }, |
| 4882 | { "Headphone", 0x5 }, |
| 4883 | }, |
| 4884 | }, |
| 4885 | { |
| 4886 | .num_items = 5, |
| 4887 | .items = { |
| 4888 | { "Mic", 0x0 }, |
| 4889 | { "Line", 0x2 }, |
| 4890 | { "CD", 0x4 }, |
| 4891 | { "Headphone", 0x6 }, |
| 4892 | { "Mixer", 0x5 }, |
| 4893 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4894 | }, |
| 4895 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4896 | |
| 4897 | /* Maxdata Favorit 100XS */ |
| 4898 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4899 | { |
| 4900 | .num_items = 2, |
| 4901 | .items = { |
| 4902 | { "Line/Mic", 0x0 }, |
| 4903 | { "CD", 0x4 }, |
| 4904 | }, |
| 4905 | }, |
| 4906 | { |
| 4907 | .num_items = 3, |
| 4908 | .items = { |
| 4909 | { "Line/Mic", 0x0 }, |
| 4910 | { "CD", 0x4 }, |
| 4911 | { "Mixer", 0x5 }, |
| 4912 | }, |
| 4913 | }, |
| 4914 | }; |
| 4915 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4916 | /* |
| 4917 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4918 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4919 | * element which allows changing the channel mode, so the verb list is |
| 4920 | * never used. |
| 4921 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4922 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4923 | { 2, NULL }, |
| 4924 | }; |
| 4925 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4926 | |
| 4927 | /* Mixer combinations |
| 4928 | * |
| 4929 | * basic: base_output + input + pc_beep + capture |
| 4930 | * HP: base_output + input + capture_alt |
| 4931 | * HP_3013: hp_3013 + input + capture |
| 4932 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4933 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4934 | */ |
| 4935 | |
| 4936 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4937 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4938 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4939 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4940 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4941 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4942 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4943 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4944 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4945 | |
| 4946 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4947 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4948 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4949 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4950 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4951 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4952 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4953 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4954 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4955 | { } /* end */ |
| 4956 | }; |
| 4957 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4958 | /* update HP, line and mono out pins according to the master switch */ |
| 4959 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4960 | hda_nid_t hp, hda_nid_t line, |
| 4961 | hda_nid_t mono) |
| 4962 | { |
| 4963 | struct alc_spec *spec = codec->spec; |
| 4964 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4965 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4966 | 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] | 4967 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4968 | 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] | 4969 | val); |
| 4970 | /* mono (speaker) depending on the HP jack sense */ |
| 4971 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4972 | 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] | 4973 | val); |
| 4974 | } |
| 4975 | |
| 4976 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4977 | struct snd_ctl_elem_value *ucontrol) |
| 4978 | { |
| 4979 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4980 | struct alc_spec *spec = codec->spec; |
| 4981 | *ucontrol->value.integer.value = spec->master_sw; |
| 4982 | return 0; |
| 4983 | } |
| 4984 | |
| 4985 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4986 | struct snd_ctl_elem_value *ucontrol) |
| 4987 | { |
| 4988 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4989 | struct alc_spec *spec = codec->spec; |
| 4990 | int val = !!*ucontrol->value.integer.value; |
| 4991 | hda_nid_t hp, line, mono; |
| 4992 | |
| 4993 | if (val == spec->master_sw) |
| 4994 | return 0; |
| 4995 | spec->master_sw = val; |
| 4996 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4997 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4998 | mono = kcontrol->private_value & 0xff; |
| 4999 | alc260_hp_master_update(codec, hp, line, mono); |
| 5000 | return 1; |
| 5001 | } |
| 5002 | |
| 5003 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5004 | { |
| 5005 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5006 | .name = "Master Playback Switch", |
| 5007 | .info = snd_ctl_boolean_mono_info, |
| 5008 | .get = alc260_hp_master_sw_get, |
| 5009 | .put = alc260_hp_master_sw_put, |
| 5010 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5011 | }, |
| 5012 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5013 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5014 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5015 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5016 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5017 | HDA_OUTPUT), |
| 5018 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5019 | { } /* end */ |
| 5020 | }; |
| 5021 | |
| 5022 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5023 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5024 | {}, |
| 5025 | }; |
| 5026 | |
| 5027 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5028 | { |
| 5029 | struct alc_spec *spec = codec->spec; |
| 5030 | unsigned int present; |
| 5031 | |
| 5032 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 5033 | AC_VERB_GET_PIN_SENSE, 0); |
| 5034 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 5035 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5036 | } |
| 5037 | |
| 5038 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5039 | { |
| 5040 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5041 | alc260_hp_automute(codec); |
| 5042 | } |
| 5043 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5044 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5045 | { |
| 5046 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5047 | .name = "Master Playback Switch", |
| 5048 | .info = snd_ctl_boolean_mono_info, |
| 5049 | .get = alc260_hp_master_sw_get, |
| 5050 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5051 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5052 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5053 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5054 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5055 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5056 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5057 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5058 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5059 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5060 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5061 | { } /* end */ |
| 5062 | }; |
| 5063 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5064 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5065 | .ops = &snd_hda_bind_vol, |
| 5066 | .values = { |
| 5067 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5068 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5069 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5070 | 0 |
| 5071 | }, |
| 5072 | }; |
| 5073 | |
| 5074 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5075 | .ops = &snd_hda_bind_sw, |
| 5076 | .values = { |
| 5077 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5078 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5079 | 0 |
| 5080 | }, |
| 5081 | }; |
| 5082 | |
| 5083 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5084 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5085 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5086 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5087 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5088 | { } /* end */ |
| 5089 | }; |
| 5090 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5091 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5092 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5093 | {}, |
| 5094 | }; |
| 5095 | |
| 5096 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5097 | { |
| 5098 | struct alc_spec *spec = codec->spec; |
| 5099 | unsigned int present; |
| 5100 | |
| 5101 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5102 | AC_VERB_GET_PIN_SENSE, 0); |
| 5103 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5104 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5105 | } |
| 5106 | |
| 5107 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5108 | unsigned int res) |
| 5109 | { |
| 5110 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5111 | alc260_hp_3013_automute(codec); |
| 5112 | } |
| 5113 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5114 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5115 | { |
| 5116 | unsigned int present, bits; |
| 5117 | |
| 5118 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 5119 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 5120 | |
| 5121 | bits = present ? 0 : PIN_OUT; |
| 5122 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5123 | bits); |
| 5124 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5125 | bits); |
| 5126 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5127 | bits); |
| 5128 | } |
| 5129 | |
| 5130 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5131 | unsigned int res) |
| 5132 | { |
| 5133 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5134 | alc260_hp_3012_automute(codec); |
| 5135 | } |
| 5136 | |
| 5137 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5138 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5139 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5140 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5141 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5142 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5143 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5144 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5145 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5146 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5147 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5148 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5149 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5150 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5151 | { } /* end */ |
| 5152 | }; |
| 5153 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5154 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5155 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5156 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5157 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5158 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5159 | * revisions available in early 2006. Therefore for now allow the |
| 5160 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5161 | * that the lack of mic bias for this NID is intentional we could change the |
| 5162 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5163 | * |
| 5164 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5165 | * don't appear to make the mic bias available from the "line" jack, even |
| 5166 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5167 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5168 | * and the output jack. If this turns out to be the case for all such |
| 5169 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5170 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5171 | * |
| 5172 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5173 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5174 | * controls for such models. On models without a "mono speaker" the control |
| 5175 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5176 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5177 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5178 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5179 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5180 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5181 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5182 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5183 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5184 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5185 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5186 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5187 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5188 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5189 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5190 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5191 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5192 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5193 | { } /* end */ |
| 5194 | }; |
| 5195 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5196 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5197 | */ |
| 5198 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5199 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5200 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5201 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5202 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5203 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5204 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5205 | { } /* end */ |
| 5206 | }; |
| 5207 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5208 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5209 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5210 | */ |
| 5211 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5212 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5213 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5214 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5215 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5216 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5217 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5218 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5219 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5220 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5221 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5222 | { } /* end */ |
| 5223 | }; |
| 5224 | |
| 5225 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5226 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5227 | */ |
| 5228 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5229 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5230 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5231 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5232 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5233 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5234 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5235 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5236 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5237 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5238 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5239 | { } /* end */ |
| 5240 | }; |
| 5241 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5242 | /* |
| 5243 | * initialization verbs |
| 5244 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5245 | static struct hda_verb alc260_init_verbs[] = { |
| 5246 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5247 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5248 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5249 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5250 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5251 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5252 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5253 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5254 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5255 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5256 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5257 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5258 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5259 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5260 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5261 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5262 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5263 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5264 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5265 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5266 | /* set connection select to line in (default select for this ADC) */ |
| 5267 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5268 | /* mute capture amp left and right */ |
| 5269 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5270 | /* set connection select to line in (default select for this ADC) */ |
| 5271 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5272 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5273 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5274 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5275 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5276 | /* set vol=0 HP mixer amp left and right */ |
| 5277 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5278 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5279 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5280 | /* set vol=0 Mono mixer amp left and right */ |
| 5281 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5282 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5283 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5284 | /* unmute LINE-2 out pin */ |
| 5285 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5286 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5287 | * Line In 2 = 0x03 |
| 5288 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5289 | /* mute analog inputs */ |
| 5290 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5291 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5292 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5293 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5294 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5295 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5296 | /* mute Front out path */ |
| 5297 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5298 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5299 | /* mute Headphone out path */ |
| 5300 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5301 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5302 | /* mute Mono out path */ |
| 5303 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5304 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5305 | { } |
| 5306 | }; |
| 5307 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5308 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5309 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5310 | /* Headphone and output */ |
| 5311 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5312 | /* mono output */ |
| 5313 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5314 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5315 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5316 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5317 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5318 | /* Line In pin widget for input */ |
| 5319 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5320 | /* Line-2 pin widget for output */ |
| 5321 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5322 | /* CD pin widget for input */ |
| 5323 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5324 | /* unmute amp left and right */ |
| 5325 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5326 | /* set connection select to line in (default select for this ADC) */ |
| 5327 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5328 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5329 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5330 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5331 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5332 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5333 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5334 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5335 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5336 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5337 | * Line In 2 = 0x03 |
| 5338 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5339 | /* mute analog inputs */ |
| 5340 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5341 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5342 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5343 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5344 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5345 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5346 | /* Unmute Front out path */ |
| 5347 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5348 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5349 | /* Unmute Headphone out path */ |
| 5350 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5351 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5352 | /* Unmute Mono out path */ |
| 5353 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5354 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5355 | { } |
| 5356 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5357 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5358 | |
| 5359 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5360 | /* Line out and output */ |
| 5361 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5362 | /* mono output */ |
| 5363 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5364 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5365 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5366 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5367 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5368 | /* Line In pin widget for input */ |
| 5369 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5370 | /* Headphone pin widget for output */ |
| 5371 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5372 | /* CD pin widget for input */ |
| 5373 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5374 | /* unmute amp left and right */ |
| 5375 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5376 | /* set connection select to line in (default select for this ADC) */ |
| 5377 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5378 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5379 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5380 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5381 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5382 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5383 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5384 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5385 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5386 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5387 | * Line In 2 = 0x03 |
| 5388 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5389 | /* mute analog inputs */ |
| 5390 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5391 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5392 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5393 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5394 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5395 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5396 | /* Unmute Front out path */ |
| 5397 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5398 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5399 | /* Unmute Headphone out path */ |
| 5400 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5401 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5402 | /* Unmute Mono out path */ |
| 5403 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5404 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5405 | { } |
| 5406 | }; |
| 5407 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5408 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5409 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5410 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5411 | */ |
| 5412 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5413 | /* Disable all GPIOs */ |
| 5414 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5415 | /* Internal speaker is connected to headphone pin */ |
| 5416 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5417 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5418 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5419 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5420 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5421 | /* Ensure all other unused pins are disabled and muted. */ |
| 5422 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5423 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5424 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5425 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5426 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5427 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5428 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5429 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5430 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5431 | /* Disable digital (SPDIF) pins */ |
| 5432 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5433 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5434 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5435 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5436 | * when acting as an output. |
| 5437 | */ |
| 5438 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5439 | |
| 5440 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5441 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5442 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5443 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5444 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5445 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5446 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5447 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5448 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5449 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5450 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5451 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5452 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5453 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5454 | * If the pin mode is changed by the user the pin mode control will |
| 5455 | * take care of enabling the pin's input/output buffers as needed. |
| 5456 | * Therefore there's no need to enable the input buffer at this |
| 5457 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5458 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5459 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5460 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5461 | * mixer ctrl) |
| 5462 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5463 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5464 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5465 | /* Mute capture amp left and right */ |
| 5466 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5467 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5468 | * in (on mic1 pin) |
| 5469 | */ |
| 5470 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5471 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5472 | /* Do the same for the second ADC: mute capture input amp and |
| 5473 | * set ADC connection to line in (on mic1 pin) |
| 5474 | */ |
| 5475 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5476 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5477 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5478 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5479 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5480 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5481 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5482 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5483 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5484 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5485 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5486 | {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] | 5487 | |
| 5488 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5489 | }; |
| 5490 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5491 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5492 | * similar laptops (adapted from Fujitsu init verbs). |
| 5493 | */ |
| 5494 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5495 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5496 | * the headphone jack. Turn this on and rely on the standard mute |
| 5497 | * methods whenever the user wants to turn these outputs off. |
| 5498 | */ |
| 5499 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5500 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5501 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5502 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5503 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5504 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5505 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5506 | /* Line In jack is connected to Line1 pin */ |
| 5507 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5508 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5509 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5510 | /* Ensure all other unused pins are disabled and muted. */ |
| 5511 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5512 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5513 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5514 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5515 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5516 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5517 | /* Disable digital (SPDIF) pins */ |
| 5518 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5519 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5520 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5521 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5522 | * bus when acting as outputs. |
| 5523 | */ |
| 5524 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5525 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5526 | |
| 5527 | /* Start with output sum widgets muted and their output gains at min */ |
| 5528 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5529 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5530 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5531 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5532 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5533 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5534 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5535 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5536 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5537 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5538 | /* Unmute Line-out pin widget amp left and right |
| 5539 | * (no equiv mixer ctrl) |
| 5540 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5541 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5542 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5543 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5544 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5545 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5546 | * will take care of enabling the pin's input/output buffers as needed. |
| 5547 | * Therefore there's no need to enable the input buffer at this |
| 5548 | * stage. |
| 5549 | */ |
| 5550 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5551 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5552 | |
| 5553 | /* Mute capture amp left and right */ |
| 5554 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5555 | /* Set ADC connection select to match default mixer setting - mic |
| 5556 | * (on mic1 pin) |
| 5557 | */ |
| 5558 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5559 | |
| 5560 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5561 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5562 | */ |
| 5563 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5564 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5565 | |
| 5566 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5567 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5568 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5569 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5570 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5571 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5572 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5573 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5574 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5575 | |
| 5576 | { } |
| 5577 | }; |
| 5578 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5579 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5580 | * (adapted from Acer init verbs). |
| 5581 | */ |
| 5582 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5583 | /* GPIO 0 enables the output jack. |
| 5584 | * Turn this on and rely on the standard mute |
| 5585 | * methods whenever the user wants to turn these outputs off. |
| 5586 | */ |
| 5587 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5588 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5589 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5590 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5591 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5592 | /* Ensure all other unused pins are disabled and muted. */ |
| 5593 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5594 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5595 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5596 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5597 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5598 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5599 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5600 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5601 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5602 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5603 | /* Disable digital (SPDIF) pins */ |
| 5604 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5605 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5606 | |
| 5607 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5608 | * bus when acting as outputs. |
| 5609 | */ |
| 5610 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5611 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5612 | |
| 5613 | /* Start with output sum widgets muted and their output gains at min */ |
| 5614 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5615 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5616 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5617 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5618 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5619 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5620 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5621 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5622 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5623 | |
| 5624 | /* Unmute Line-out pin widget amp left and right |
| 5625 | * (no equiv mixer ctrl) |
| 5626 | */ |
| 5627 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5628 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5629 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5630 | * will take care of enabling the pin's input/output buffers as needed. |
| 5631 | * Therefore there's no need to enable the input buffer at this |
| 5632 | * stage. |
| 5633 | */ |
| 5634 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5635 | |
| 5636 | /* Mute capture amp left and right */ |
| 5637 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5638 | /* Set ADC connection select to match default mixer setting - mic |
| 5639 | * (on mic1 pin) |
| 5640 | */ |
| 5641 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5642 | |
| 5643 | /* Do similar with the second ADC: mute capture input amp and |
| 5644 | * set ADC connection to mic to match ALSA's default state. |
| 5645 | */ |
| 5646 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5647 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5648 | |
| 5649 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5650 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5651 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5652 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5653 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5654 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5655 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5656 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5657 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5658 | |
| 5659 | { } |
| 5660 | }; |
| 5661 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5662 | static struct hda_verb alc260_will_verbs[] = { |
| 5663 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5664 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5665 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5666 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5667 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5668 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5669 | {} |
| 5670 | }; |
| 5671 | |
| 5672 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5673 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5674 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5675 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5676 | |
| 5677 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5678 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5679 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5680 | |
| 5681 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5682 | {} |
| 5683 | }; |
| 5684 | |
| 5685 | /* toggle speaker-output according to the hp-jack state */ |
| 5686 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5687 | { |
| 5688 | unsigned int present; |
| 5689 | |
| 5690 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5691 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5692 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5693 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5694 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5695 | AC_VERB_SET_GPIO_DATA, 1); |
| 5696 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5697 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5698 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5699 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5700 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5701 | AC_VERB_SET_GPIO_DATA, 0); |
| 5702 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5703 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5704 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5705 | } |
| 5706 | } |
| 5707 | |
| 5708 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5709 | unsigned int res) |
| 5710 | { |
| 5711 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5712 | alc260_replacer_672v_automute(codec); |
| 5713 | } |
| 5714 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5715 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5716 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5717 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5718 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5719 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5720 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5721 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5722 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5723 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5724 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5725 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5726 | {} |
| 5727 | }; |
| 5728 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5729 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5730 | * configuration. |
| 5731 | */ |
| 5732 | #ifdef CONFIG_SND_DEBUG |
| 5733 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5734 | 0x02, |
| 5735 | }; |
| 5736 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5737 | 0x04, 0x05, |
| 5738 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5739 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5740 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5741 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5742 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5743 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5744 | { |
| 5745 | .num_items = 7, |
| 5746 | .items = { |
| 5747 | { "MIC1 pin", 0x0 }, |
| 5748 | { "MIC2 pin", 0x1 }, |
| 5749 | { "LINE1 pin", 0x2 }, |
| 5750 | { "LINE2 pin", 0x3 }, |
| 5751 | { "CD pin", 0x4 }, |
| 5752 | { "LINE-OUT pin", 0x5 }, |
| 5753 | { "HP-OUT pin", 0x6 }, |
| 5754 | }, |
| 5755 | }, |
| 5756 | { |
| 5757 | .num_items = 8, |
| 5758 | .items = { |
| 5759 | { "MIC1 pin", 0x0 }, |
| 5760 | { "MIC2 pin", 0x1 }, |
| 5761 | { "LINE1 pin", 0x2 }, |
| 5762 | { "LINE2 pin", 0x3 }, |
| 5763 | { "CD pin", 0x4 }, |
| 5764 | { "Mixer", 0x5 }, |
| 5765 | { "LINE-OUT pin", 0x6 }, |
| 5766 | { "HP-OUT pin", 0x7 }, |
| 5767 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5768 | }, |
| 5769 | }; |
| 5770 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5771 | /* Output driver widgets */ |
| 5772 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5773 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5774 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5775 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5776 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5777 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5778 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5779 | /* Modes for retasking pin widgets |
| 5780 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5781 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5782 | * mention this restriction. At this stage it's not clear whether |
| 5783 | * this behaviour is intentional or is a hardware bug in chip |
| 5784 | * revisions available at least up until early 2006. Therefore for |
| 5785 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5786 | * choices, but if it turns out that the lack of mic bias for these |
| 5787 | * NIDs is intentional we could change their modes from |
| 5788 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5789 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5790 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5791 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5792 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5793 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5794 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5795 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5796 | |
| 5797 | /* Loopback mixer controls */ |
| 5798 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5799 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5800 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5801 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5802 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5803 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5804 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5805 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5806 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5807 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5808 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5809 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5810 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5811 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5812 | |
| 5813 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5814 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5815 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5816 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5817 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5818 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5819 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5820 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5821 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5822 | */ |
| 5823 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5824 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5825 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5826 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5827 | * this output to turn on an external amplifier. |
| 5828 | */ |
| 5829 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5830 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5831 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5832 | { } /* end */ |
| 5833 | }; |
| 5834 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5835 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5836 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5837 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5838 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5839 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5840 | /* Enable retasking pins as output, initially without power amp */ |
| 5841 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5842 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5843 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5844 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5845 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5846 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5847 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5848 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5849 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5850 | * payload also sets the generation to 0, output to be in "consumer" |
| 5851 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5852 | * control. |
| 5853 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5854 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5855 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5856 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5857 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5858 | * OUT1 sum bus when acting as an output. |
| 5859 | */ |
| 5860 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5861 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5862 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5863 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5864 | |
| 5865 | /* Start with output sum widgets muted and their output gains at min */ |
| 5866 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5867 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5868 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5869 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5870 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5871 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5872 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5873 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5874 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5875 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5876 | /* Unmute retasking pin widget output buffers since the default |
| 5877 | * state appears to be output. As the pin mode is changed by the |
| 5878 | * user the pin mode control will take care of enabling the pin's |
| 5879 | * input/output buffers as needed. |
| 5880 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5881 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5882 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5883 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5884 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5885 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5886 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5887 | /* Also unmute the mono-out pin widget */ |
| 5888 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5889 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5890 | /* Mute capture amp left and right */ |
| 5891 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5892 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5893 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5894 | */ |
| 5895 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5896 | |
| 5897 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5898 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5899 | */ |
| 5900 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5901 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5902 | |
| 5903 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5904 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5905 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5906 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5907 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5908 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5909 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5910 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5911 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5912 | |
| 5913 | { } |
| 5914 | }; |
| 5915 | #endif |
| 5916 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5917 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5918 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5919 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5920 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5921 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5922 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5923 | /* |
| 5924 | * for BIOS auto-configuration |
| 5925 | */ |
| 5926 | |
| 5927 | 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] | 5928 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5929 | { |
| 5930 | hda_nid_t nid_vol; |
| 5931 | unsigned long vol_val, sw_val; |
| 5932 | char name[32]; |
| 5933 | int err; |
| 5934 | |
| 5935 | if (nid >= 0x0f && nid < 0x11) { |
| 5936 | nid_vol = nid - 0x7; |
| 5937 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5938 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5939 | } else if (nid == 0x11) { |
| 5940 | nid_vol = nid - 0x7; |
| 5941 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5942 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5943 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5944 | nid_vol = 0x08; |
| 5945 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5946 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5947 | } else |
| 5948 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5949 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5950 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5951 | /* first control for the volume widget */ |
| 5952 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5953 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5954 | if (err < 0) |
| 5955 | return err; |
| 5956 | *vol_bits |= (1 << nid_vol); |
| 5957 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5958 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5959 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5960 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5961 | return err; |
| 5962 | return 1; |
| 5963 | } |
| 5964 | |
| 5965 | /* add playback controls from the parsed DAC table */ |
| 5966 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5967 | const struct auto_pin_cfg *cfg) |
| 5968 | { |
| 5969 | hda_nid_t nid; |
| 5970 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5971 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5972 | |
| 5973 | spec->multiout.num_dacs = 1; |
| 5974 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5975 | spec->multiout.dac_nids[0] = 0x02; |
| 5976 | |
| 5977 | nid = cfg->line_out_pins[0]; |
| 5978 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5979 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5980 | if (err < 0) |
| 5981 | return err; |
| 5982 | } |
| 5983 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5984 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5985 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5986 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5987 | if (err < 0) |
| 5988 | return err; |
| 5989 | } |
| 5990 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5991 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5992 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5993 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5994 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5995 | if (err < 0) |
| 5996 | return err; |
| 5997 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5998 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5999 | } |
| 6000 | |
| 6001 | /* create playback/capture controls for input pins */ |
| 6002 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 6003 | const struct auto_pin_cfg *cfg) |
| 6004 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6005 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6006 | int i, err, idx; |
| 6007 | |
| 6008 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6009 | if (cfg->input_pins[i] >= 0x12) { |
| 6010 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6011 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6012 | auto_pin_cfg_labels[i], idx, |
| 6013 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6014 | if (err < 0) |
| 6015 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6016 | imux->items[imux->num_items].label = |
| 6017 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6018 | imux->items[imux->num_items].index = idx; |
| 6019 | imux->num_items++; |
| 6020 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6021 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6022 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6023 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6024 | auto_pin_cfg_labels[i], idx, |
| 6025 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6026 | if (err < 0) |
| 6027 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6028 | imux->items[imux->num_items].label = |
| 6029 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6030 | imux->items[imux->num_items].index = idx; |
| 6031 | imux->num_items++; |
| 6032 | } |
| 6033 | } |
| 6034 | return 0; |
| 6035 | } |
| 6036 | |
| 6037 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6038 | hda_nid_t nid, int pin_type, |
| 6039 | int sel_idx) |
| 6040 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6041 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6042 | /* need the manual connection? */ |
| 6043 | if (nid >= 0x12) { |
| 6044 | int idx = nid - 0x12; |
| 6045 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6046 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6047 | } |
| 6048 | } |
| 6049 | |
| 6050 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6051 | { |
| 6052 | struct alc_spec *spec = codec->spec; |
| 6053 | hda_nid_t nid; |
| 6054 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6055 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6056 | if (nid) { |
| 6057 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6058 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6059 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6060 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6061 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6062 | if (nid) |
| 6063 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6064 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6065 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6066 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6067 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6068 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6069 | |
| 6070 | #define ALC260_PIN_CD_NID 0x16 |
| 6071 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6072 | { |
| 6073 | struct alc_spec *spec = codec->spec; |
| 6074 | int i; |
| 6075 | |
| 6076 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6077 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6078 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6079 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6080 | if (nid != ALC260_PIN_CD_NID && |
| 6081 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6082 | snd_hda_codec_write(codec, nid, 0, |
| 6083 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6084 | AMP_OUT_MUTE); |
| 6085 | } |
| 6086 | } |
| 6087 | } |
| 6088 | |
| 6089 | /* |
| 6090 | * generic initialization of ADC, input mixers and output mixers |
| 6091 | */ |
| 6092 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6093 | /* |
| 6094 | * Unmute ADC0-1 and set the default input to mic-in |
| 6095 | */ |
| 6096 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6097 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6098 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6099 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6100 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6101 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6102 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6103 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6104 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6105 | */ |
| 6106 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6107 | /* mute analog inputs */ |
| 6108 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6109 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6110 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6111 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6112 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6113 | |
| 6114 | /* |
| 6115 | * Set up output mixers (0x08 - 0x0a) |
| 6116 | */ |
| 6117 | /* set vol=0 to output mixers */ |
| 6118 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6119 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6120 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6121 | /* set up input amps for analog loopback */ |
| 6122 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6123 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6124 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6125 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6126 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6127 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6128 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6129 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6130 | { } |
| 6131 | }; |
| 6132 | |
| 6133 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6134 | { |
| 6135 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6136 | int err; |
| 6137 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6138 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6139 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6140 | alc260_ignore); |
| 6141 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6142 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6143 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6144 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6145 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6146 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6147 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6148 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 6149 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6150 | return err; |
| 6151 | |
| 6152 | spec->multiout.max_channels = 2; |
| 6153 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6154 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6155 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6156 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6157 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6158 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6159 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6160 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6161 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6162 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6163 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6164 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6165 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6166 | return 1; |
| 6167 | } |
| 6168 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6169 | /* additional initialization for auto-configuration model */ |
| 6170 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6171 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6172 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6173 | alc260_auto_init_multi_out(codec); |
| 6174 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6175 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6176 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6177 | } |
| 6178 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6179 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6180 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6181 | { 0x07, HDA_INPUT, 0 }, |
| 6182 | { 0x07, HDA_INPUT, 1 }, |
| 6183 | { 0x07, HDA_INPUT, 2 }, |
| 6184 | { 0x07, HDA_INPUT, 3 }, |
| 6185 | { 0x07, HDA_INPUT, 4 }, |
| 6186 | { } /* end */ |
| 6187 | }; |
| 6188 | #endif |
| 6189 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6190 | /* |
| 6191 | * ALC260 configurations |
| 6192 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6193 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6194 | [ALC260_BASIC] = "basic", |
| 6195 | [ALC260_HP] = "hp", |
| 6196 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6197 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6198 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6199 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6200 | [ALC260_WILL] = "will", |
| 6201 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6202 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6203 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6204 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6205 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6206 | [ALC260_AUTO] = "auto", |
| 6207 | }; |
| 6208 | |
| 6209 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6210 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6211 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6212 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6213 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 6214 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6215 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6216 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6217 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6218 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6219 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6220 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6221 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6222 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6223 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6224 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6225 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6226 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6227 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6228 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6229 | {} |
| 6230 | }; |
| 6231 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6232 | static struct alc_config_preset alc260_presets[] = { |
| 6233 | [ALC260_BASIC] = { |
| 6234 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6235 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6236 | .init_verbs = { alc260_init_verbs }, |
| 6237 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6238 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6239 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6240 | .adc_nids = alc260_adc_nids, |
| 6241 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6242 | .channel_mode = alc260_modes, |
| 6243 | .input_mux = &alc260_capture_source, |
| 6244 | }, |
| 6245 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6246 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6247 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6248 | .init_verbs = { alc260_init_verbs, |
| 6249 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6250 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6251 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6252 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6253 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6254 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6255 | .channel_mode = alc260_modes, |
| 6256 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6257 | .unsol_event = alc260_hp_unsol_event, |
| 6258 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6259 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6260 | [ALC260_HP_DC7600] = { |
| 6261 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6262 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6263 | .init_verbs = { alc260_init_verbs, |
| 6264 | alc260_hp_dc7600_verbs }, |
| 6265 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6266 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6267 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6268 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6269 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6270 | .channel_mode = alc260_modes, |
| 6271 | .input_mux = &alc260_capture_source, |
| 6272 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6273 | .init_hook = alc260_hp_3012_automute, |
| 6274 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6275 | [ALC260_HP_3013] = { |
| 6276 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6277 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6278 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6279 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6280 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6281 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6282 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6283 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6284 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6285 | .channel_mode = alc260_modes, |
| 6286 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6287 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6288 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6289 | }, |
| 6290 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6291 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6292 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6293 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6294 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6295 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6296 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6297 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6298 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6299 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6300 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6301 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6302 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6303 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6304 | .init_verbs = { alc260_acer_init_verbs }, |
| 6305 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6306 | .dac_nids = alc260_dac_nids, |
| 6307 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6308 | .adc_nids = alc260_dual_adc_nids, |
| 6309 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6310 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6311 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6312 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6313 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6314 | [ALC260_FAVORIT100] = { |
| 6315 | .mixers = { alc260_favorit100_mixer }, |
| 6316 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6317 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6318 | .dac_nids = alc260_dac_nids, |
| 6319 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6320 | .adc_nids = alc260_dual_adc_nids, |
| 6321 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6322 | .channel_mode = alc260_modes, |
| 6323 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6324 | .input_mux = alc260_favorit100_capture_sources, |
| 6325 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6326 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6327 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6328 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6329 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6330 | .dac_nids = alc260_dac_nids, |
| 6331 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6332 | .adc_nids = alc260_adc_nids, |
| 6333 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6334 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6335 | .channel_mode = alc260_modes, |
| 6336 | .input_mux = &alc260_capture_source, |
| 6337 | }, |
| 6338 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6339 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6340 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6341 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6342 | .dac_nids = alc260_dac_nids, |
| 6343 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6344 | .adc_nids = alc260_adc_nids, |
| 6345 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6346 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6347 | .channel_mode = alc260_modes, |
| 6348 | .input_mux = &alc260_capture_source, |
| 6349 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6350 | .init_hook = alc260_replacer_672v_automute, |
| 6351 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6352 | #ifdef CONFIG_SND_DEBUG |
| 6353 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6354 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6355 | .init_verbs = { alc260_test_init_verbs }, |
| 6356 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6357 | .dac_nids = alc260_test_dac_nids, |
| 6358 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6359 | .adc_nids = alc260_test_adc_nids, |
| 6360 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6361 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6362 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6363 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6364 | }, |
| 6365 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6366 | }; |
| 6367 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6368 | static int patch_alc260(struct hda_codec *codec) |
| 6369 | { |
| 6370 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6371 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6372 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6373 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6374 | if (spec == NULL) |
| 6375 | return -ENOMEM; |
| 6376 | |
| 6377 | codec->spec = spec; |
| 6378 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6379 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6380 | alc260_models, |
| 6381 | alc260_cfg_tbl); |
| 6382 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6383 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6384 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6385 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6386 | } |
| 6387 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6388 | if (board_config == ALC260_AUTO) { |
| 6389 | /* automatic parse from the BIOS config */ |
| 6390 | err = alc260_parse_auto_config(codec); |
| 6391 | if (err < 0) { |
| 6392 | alc_free(codec); |
| 6393 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6394 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6395 | printk(KERN_INFO |
| 6396 | "hda_codec: Cannot set up configuration " |
| 6397 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6398 | board_config = ALC260_BASIC; |
| 6399 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6400 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6401 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6402 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6403 | if (err < 0) { |
| 6404 | alc_free(codec); |
| 6405 | return err; |
| 6406 | } |
| 6407 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6408 | if (board_config != ALC260_AUTO) |
| 6409 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6410 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6411 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6412 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6413 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6414 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6415 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6416 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6417 | if (!spec->adc_nids && spec->input_mux) { |
| 6418 | /* check whether NID 0x04 is valid */ |
| 6419 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6420 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6421 | /* get type */ |
| 6422 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6423 | spec->adc_nids = alc260_adc_nids_alt; |
| 6424 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6425 | } else { |
| 6426 | spec->adc_nids = alc260_adc_nids; |
| 6427 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6428 | } |
| 6429 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6430 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6431 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6432 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6433 | spec->vmaster_nid = 0x08; |
| 6434 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6435 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6436 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6437 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6438 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6439 | if (!spec->loopback.amplist) |
| 6440 | spec->loopback.amplist = alc260_loopbacks; |
| 6441 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6442 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6443 | |
| 6444 | return 0; |
| 6445 | } |
| 6446 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6447 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6448 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6449 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6450 | * |
| 6451 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6452 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6453 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6454 | * 6-channel independent captures. |
| 6455 | * |
| 6456 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6457 | * driver yet). |
| 6458 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6459 | #define ALC882_DIGOUT_NID 0x06 |
| 6460 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6461 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6462 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6463 | #define ALC1200_DIGOUT_NID 0x10 |
| 6464 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6465 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6466 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6467 | { 8, NULL } |
| 6468 | }; |
| 6469 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6470 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6471 | static hda_nid_t alc882_dac_nids[4] = { |
| 6472 | /* front, rear, clfe, rear_surr */ |
| 6473 | 0x02, 0x03, 0x04, 0x05 |
| 6474 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6475 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6476 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6477 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6478 | #define alc882_adc_nids alc880_adc_nids |
| 6479 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6480 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6481 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6482 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6483 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6484 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6485 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6486 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6487 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6488 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6489 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6490 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6491 | /* input MUX */ |
| 6492 | /* FIXME: should be a matrix-type input source selection */ |
| 6493 | |
| 6494 | static struct hda_input_mux alc882_capture_source = { |
| 6495 | .num_items = 4, |
| 6496 | .items = { |
| 6497 | { "Mic", 0x0 }, |
| 6498 | { "Front Mic", 0x1 }, |
| 6499 | { "Line", 0x2 }, |
| 6500 | { "CD", 0x4 }, |
| 6501 | }, |
| 6502 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6503 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6504 | #define alc883_capture_source alc882_capture_source |
| 6505 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6506 | static struct hda_input_mux alc889_capture_source = { |
| 6507 | .num_items = 3, |
| 6508 | .items = { |
| 6509 | { "Front Mic", 0x0 }, |
| 6510 | { "Mic", 0x3 }, |
| 6511 | { "Line", 0x2 }, |
| 6512 | }, |
| 6513 | }; |
| 6514 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6515 | static struct hda_input_mux mb5_capture_source = { |
| 6516 | .num_items = 3, |
| 6517 | .items = { |
| 6518 | { "Mic", 0x1 }, |
| 6519 | { "Line", 0x2 }, |
| 6520 | { "CD", 0x4 }, |
| 6521 | }, |
| 6522 | }; |
| 6523 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6524 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6525 | .num_items = 4, |
| 6526 | .items = { |
| 6527 | { "Mic", 0x1 }, |
| 6528 | { "Front Mic", 0x0 }, |
| 6529 | { "Line", 0x2 }, |
| 6530 | { "CD", 0x4 }, |
| 6531 | }, |
| 6532 | }; |
| 6533 | |
| 6534 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6535 | .num_items = 2, |
| 6536 | .items = { |
| 6537 | { "Mic", 0x1 }, |
| 6538 | { "Line", 0x2 }, |
| 6539 | }, |
| 6540 | }; |
| 6541 | |
| 6542 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6543 | .num_items = 4, |
| 6544 | .items = { |
| 6545 | { "Mic", 0x0 }, |
| 6546 | { "iMic", 0x1 }, |
| 6547 | { "Line", 0x2 }, |
| 6548 | { "CD", 0x4 }, |
| 6549 | }, |
| 6550 | }; |
| 6551 | |
| 6552 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6553 | .num_items = 2, |
| 6554 | .items = { |
| 6555 | { "Mic", 0x0 }, |
| 6556 | { "Int Mic", 0x1 }, |
| 6557 | }, |
| 6558 | }; |
| 6559 | |
| 6560 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6561 | .num_items = 3, |
| 6562 | .items = { |
| 6563 | { "Mic", 0x0 }, |
| 6564 | { "Front Mic", 0x1 }, |
| 6565 | { "Line", 0x4 }, |
| 6566 | }, |
| 6567 | }; |
| 6568 | |
| 6569 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6570 | .num_items = 2, |
| 6571 | .items = { |
| 6572 | { "Mic", 0x0 }, |
| 6573 | { "Line", 0x2 }, |
| 6574 | }, |
| 6575 | }; |
| 6576 | |
| 6577 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6578 | .num_items = 2, |
| 6579 | .items = { |
| 6580 | { "Mic", 0x0 }, |
| 6581 | /* Front Mic (0x01) unused */ |
| 6582 | { "Line", 0x2 }, |
| 6583 | /* Line 2 (0x03) unused */ |
| 6584 | /* CD (0x04) unsused? */ |
| 6585 | }, |
| 6586 | }; |
| 6587 | |
| 6588 | /* |
| 6589 | * 2ch mode |
| 6590 | */ |
| 6591 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6592 | { 2, NULL } |
| 6593 | }; |
| 6594 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6595 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6596 | * 2ch mode |
| 6597 | */ |
| 6598 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6599 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6600 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6601 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6602 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6603 | { } /* end */ |
| 6604 | }; |
| 6605 | |
| 6606 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6607 | * 4ch mode |
| 6608 | */ |
| 6609 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6610 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6611 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 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 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6619 | * 6ch mode |
| 6620 | */ |
| 6621 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6622 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6623 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6624 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6625 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6626 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6627 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6628 | { } /* end */ |
| 6629 | }; |
| 6630 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6631 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6632 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6633 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6634 | { 6, alc882_3ST_ch6_init }, |
| 6635 | }; |
| 6636 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6637 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6638 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6639 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6640 | * 6ch mode |
| 6641 | */ |
| 6642 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6643 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6644 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6645 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6646 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6647 | { } /* end */ |
| 6648 | }; |
| 6649 | |
| 6650 | /* |
| 6651 | * 8ch mode |
| 6652 | */ |
| 6653 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6654 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6655 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6656 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6657 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6658 | { } /* end */ |
| 6659 | }; |
| 6660 | |
| 6661 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6662 | { 6, alc882_sixstack_ch6_init }, |
| 6663 | { 8, alc882_sixstack_ch8_init }, |
| 6664 | }; |
| 6665 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6666 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6667 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6668 | */ |
| 6669 | |
| 6670 | /* |
| 6671 | * 2ch mode |
| 6672 | */ |
| 6673 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6674 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6675 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6676 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6677 | { } /* end */ |
| 6678 | }; |
| 6679 | |
| 6680 | /* |
| 6681 | * 6ch mode |
| 6682 | */ |
| 6683 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6684 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6685 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6686 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6687 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6688 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6689 | { } /* end */ |
| 6690 | }; |
| 6691 | |
| 6692 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6693 | { 2, alc885_mbp_ch2_init }, |
| 6694 | { 6, alc885_mbp_ch6_init }, |
| 6695 | }; |
| 6696 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6697 | /* |
| 6698 | * 2ch |
| 6699 | * Speakers/Woofer/HP = Front |
| 6700 | * LineIn = Input |
| 6701 | */ |
| 6702 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6703 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6704 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6705 | { } /* end */ |
| 6706 | }; |
| 6707 | |
| 6708 | /* |
| 6709 | * 6ch mode |
| 6710 | * Speakers/HP = Front |
| 6711 | * Woofer = LFE |
| 6712 | * LineIn = Surround |
| 6713 | */ |
| 6714 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6715 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6716 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6717 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6718 | { } /* end */ |
| 6719 | }; |
| 6720 | |
| 6721 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6722 | { 2, alc885_mb5_ch2_init }, |
| 6723 | { 6, alc885_mb5_ch6_init }, |
| 6724 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6725 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6726 | |
| 6727 | /* |
| 6728 | * 2ch mode |
| 6729 | */ |
| 6730 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 6731 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6732 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6733 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6734 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6735 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6736 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6737 | { } /* end */ |
| 6738 | }; |
| 6739 | |
| 6740 | /* |
| 6741 | * 4ch mode |
| 6742 | */ |
| 6743 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 6744 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6745 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6746 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6747 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6748 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6749 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6750 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6751 | { } /* end */ |
| 6752 | }; |
| 6753 | |
| 6754 | /* |
| 6755 | * 6ch mode |
| 6756 | */ |
| 6757 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 6758 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6759 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6760 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6761 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6762 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6763 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6764 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6765 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6766 | { } /* end */ |
| 6767 | }; |
| 6768 | |
| 6769 | /* |
| 6770 | * 8ch mode |
| 6771 | */ |
| 6772 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 6773 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6774 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6775 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6776 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6777 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6778 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6779 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6780 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6781 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6782 | { } /* end */ |
| 6783 | }; |
| 6784 | |
| 6785 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 6786 | { 2, alc883_4ST_ch2_init }, |
| 6787 | { 4, alc883_4ST_ch4_init }, |
| 6788 | { 6, alc883_4ST_ch6_init }, |
| 6789 | { 8, alc883_4ST_ch8_init }, |
| 6790 | }; |
| 6791 | |
| 6792 | |
| 6793 | /* |
| 6794 | * 2ch mode |
| 6795 | */ |
| 6796 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6797 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6798 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6799 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6800 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6801 | { } /* end */ |
| 6802 | }; |
| 6803 | |
| 6804 | /* |
| 6805 | * 4ch mode |
| 6806 | */ |
| 6807 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6808 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6809 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6810 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6811 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6812 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6813 | { } /* end */ |
| 6814 | }; |
| 6815 | |
| 6816 | /* |
| 6817 | * 6ch mode |
| 6818 | */ |
| 6819 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6820 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6821 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6822 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6823 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6824 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6825 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6826 | { } /* end */ |
| 6827 | }; |
| 6828 | |
| 6829 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6830 | { 2, alc883_3ST_ch2_intel_init }, |
| 6831 | { 4, alc883_3ST_ch4_intel_init }, |
| 6832 | { 6, alc883_3ST_ch6_intel_init }, |
| 6833 | }; |
| 6834 | |
| 6835 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6836 | * 2ch mode |
| 6837 | */ |
| 6838 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 6839 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6840 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6841 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6842 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6843 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6844 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6845 | { } /* end */ |
| 6846 | }; |
| 6847 | |
| 6848 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6849 | * 6ch mode |
| 6850 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6851 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6852 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6853 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6854 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6855 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6856 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6857 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6858 | { } /* end */ |
| 6859 | }; |
| 6860 | |
| 6861 | /* |
| 6862 | * 8ch mode |
| 6863 | */ |
| 6864 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6865 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6866 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6867 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6868 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6869 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6870 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6871 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6872 | { } /* end */ |
| 6873 | }; |
| 6874 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6875 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 6876 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6877 | { 6, alc889_ch6_intel_init }, |
| 6878 | { 8, alc889_ch8_intel_init }, |
| 6879 | }; |
| 6880 | |
| 6881 | /* |
| 6882 | * 6ch mode |
| 6883 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6884 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6885 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6886 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6887 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6888 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6889 | { } /* end */ |
| 6890 | }; |
| 6891 | |
| 6892 | /* |
| 6893 | * 8ch mode |
| 6894 | */ |
| 6895 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6896 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6897 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6898 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6899 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6900 | { } /* end */ |
| 6901 | }; |
| 6902 | |
| 6903 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6904 | { 6, alc883_sixstack_ch6_init }, |
| 6905 | { 8, alc883_sixstack_ch8_init }, |
| 6906 | }; |
| 6907 | |
| 6908 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6909 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6910 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6911 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6912 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6913 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6914 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6915 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6916 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6917 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6918 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6919 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6920 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6921 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6922 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6923 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6924 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6925 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6926 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6927 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6928 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6929 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6930 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6931 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6932 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6933 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6934 | { } /* end */ |
| 6935 | }; |
| 6936 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6937 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6938 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6939 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6940 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6941 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6942 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6943 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6944 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6945 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6946 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6947 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6948 | { } /* end */ |
| 6949 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6950 | |
| 6951 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6952 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6953 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6954 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6955 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 6956 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 6957 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 6958 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 6959 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6960 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6961 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6962 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6963 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6964 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 6965 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 6966 | { } /* end */ |
| 6967 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6968 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6969 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6970 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6971 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6972 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6973 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6974 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6975 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6976 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6977 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6978 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6979 | { } /* end */ |
| 6980 | }; |
| 6981 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6982 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6984 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6985 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6986 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6987 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6988 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6989 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6990 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6991 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6992 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6993 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6994 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6995 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6996 | { } /* end */ |
| 6997 | }; |
| 6998 | |
| 6999 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7000 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7001 | */ |
| 7002 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7003 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7004 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7005 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7006 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7007 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7008 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7009 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7010 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7011 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7012 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7013 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7014 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7015 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7016 | { } /* end */ |
| 7017 | }; |
| 7018 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7019 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7020 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7021 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7022 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7023 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7024 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7025 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7026 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7027 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7028 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7029 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7030 | { } /* end */ |
| 7031 | }; |
| 7032 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7033 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7034 | { |
| 7035 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7036 | .name = "Channel Mode", |
| 7037 | .info = alc_ch_mode_info, |
| 7038 | .get = alc_ch_mode_get, |
| 7039 | .put = alc_ch_mode_put, |
| 7040 | }, |
| 7041 | { } /* end */ |
| 7042 | }; |
| 7043 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7044 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7045 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7047 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7048 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7049 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7050 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7051 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7052 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7053 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7054 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7055 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7056 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7057 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7058 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7059 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7060 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7061 | |
Takashi Iwai | cb63812 | 2009-07-03 10:56:10 +0200 | [diff] [blame] | 7062 | /* mute analog input loopbacks */ |
| 7063 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7064 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7065 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7066 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7067 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7068 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7069 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7070 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7071 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7072 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7073 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7074 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7075 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7076 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7077 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7078 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7079 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7080 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7081 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7082 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7083 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7084 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7085 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7086 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7087 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7088 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7089 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7090 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7091 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7092 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7093 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7094 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7095 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7096 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7097 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7098 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7099 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7100 | |
| 7101 | /* FIXME: use matrix-type input source selection */ |
| 7102 | /* 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] | 7103 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7104 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7105 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7106 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7107 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7108 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7109 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7110 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7112 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7113 | /* ADC2: mute amp left and right */ |
| 7114 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7115 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7116 | /* ADC3: mute amp left and right */ |
| 7117 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7118 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7119 | |
| 7120 | { } |
| 7121 | }; |
| 7122 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7123 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7124 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7125 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7126 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7127 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7128 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7129 | /* ADC1: mute amp left and right */ |
| 7130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7131 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7132 | { } |
| 7133 | }; |
| 7134 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7135 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7136 | /* change to EAPD mode */ |
| 7137 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7138 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7139 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7140 | }; |
| 7141 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7142 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7143 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7144 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7145 | { } |
| 7146 | }; |
| 7147 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7148 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7149 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7150 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7151 | {} |
| 7152 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7153 | |
| 7154 | static struct hda_verb alc885_init_verbs[] = { |
| 7155 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7156 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7157 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7158 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7159 | /* Rear mixer */ |
| 7160 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7161 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7162 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7163 | /* CLFE mixer */ |
| 7164 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7165 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7166 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7167 | /* Side mixer */ |
| 7168 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7169 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7170 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7171 | |
| 7172 | /* mute analog input loopbacks */ |
| 7173 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7174 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7175 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7176 | |
| 7177 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7178 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7179 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7180 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7181 | /* Front Pin: output 0 (0x0c) */ |
| 7182 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7183 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7184 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7185 | /* Rear Pin: output 1 (0x0d) */ |
| 7186 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7187 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7188 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7189 | /* CLFE Pin: output 2 (0x0e) */ |
| 7190 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7191 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7192 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7193 | /* Side Pin: output 3 (0x0f) */ |
| 7194 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7195 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7196 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7197 | /* Mic (rear) pin: input vref at 80% */ |
| 7198 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7199 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7200 | /* Front Mic pin: input vref at 80% */ |
| 7201 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7202 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7203 | /* Line In pin: input */ |
| 7204 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7205 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7206 | |
| 7207 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7208 | /* Input mixer1 */ |
| 7209 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7210 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7211 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7212 | /* Input mixer2 */ |
| 7213 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7214 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7215 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7216 | /* Input mixer3 */ |
| 7217 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7218 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7219 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7220 | /* ADC2: mute amp left and right */ |
| 7221 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7222 | /* ADC3: mute amp left and right */ |
| 7223 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7224 | |
| 7225 | { } |
| 7226 | }; |
| 7227 | |
| 7228 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7229 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7230 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7231 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7232 | { } |
| 7233 | }; |
| 7234 | |
| 7235 | |
| 7236 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7237 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7238 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7239 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7240 | { } |
| 7241 | }; |
| 7242 | |
| 7243 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7244 | #define alc883_init_verbs alc882_base_init_verbs |
| 7245 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7246 | /* Mac Pro test */ |
| 7247 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7248 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7249 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7250 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7251 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7252 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7253 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7254 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7255 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7256 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7257 | { } /* end */ |
| 7258 | }; |
| 7259 | |
| 7260 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7261 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7262 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7263 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7264 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7265 | /* Front Pin: output 0 (0x0c) */ |
| 7266 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7267 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7268 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7269 | /* Front Mic pin: input vref at 80% */ |
| 7270 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7271 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7272 | /* Speaker: output */ |
| 7273 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7274 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7275 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7276 | /* Headphone output (output 0 - 0x0c) */ |
| 7277 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7278 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7279 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7280 | |
| 7281 | /* FIXME: use matrix-type input source selection */ |
| 7282 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7283 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7284 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7285 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7286 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7287 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7288 | /* Input mixer2 */ |
| 7289 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7290 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7291 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7292 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7293 | /* Input mixer3 */ |
| 7294 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7295 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7296 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7297 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7298 | /* ADC1: mute amp left and right */ |
| 7299 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7300 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7301 | /* ADC2: mute amp left and right */ |
| 7302 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7303 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7304 | /* ADC3: mute amp left and right */ |
| 7305 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7306 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7307 | |
| 7308 | { } |
| 7309 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7310 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7311 | /* Macbook 5,1 */ |
| 7312 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7313 | /* DACs */ |
| 7314 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7315 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7316 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7317 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7318 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7319 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7320 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7321 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7322 | /* Surround mixer */ |
| 7323 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7324 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7325 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7326 | /* LFE mixer */ |
| 7327 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7328 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7329 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7330 | /* HP mixer */ |
| 7331 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7332 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7333 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7334 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7335 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7336 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7337 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7338 | /* LFE Pin (0x0e) */ |
| 7339 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7340 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7341 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7342 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7343 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7344 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7345 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7346 | /* Front Mic pin: input vref at 80% */ |
| 7347 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7348 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7349 | /* Line In pin */ |
| 7350 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7351 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7352 | |
| 7353 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7354 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7355 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7356 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7357 | { } |
| 7358 | }; |
| 7359 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7360 | /* Macbook Pro rev3 */ |
| 7361 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7362 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7364 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7365 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7366 | /* Rear mixer */ |
| 7367 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7368 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7369 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7370 | /* Front Pin: output 0 (0x0c) */ |
| 7371 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7372 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7373 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7374 | /* HP Pin: output 0 (0x0d) */ |
| 7375 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 7376 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7377 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7378 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7379 | /* Mic (rear) pin: input vref at 80% */ |
| 7380 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7381 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7382 | /* Front Mic pin: input vref at 80% */ |
| 7383 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7384 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7385 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7386 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7387 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7388 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7389 | |
| 7390 | /* FIXME: use matrix-type input source selection */ |
| 7391 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7392 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7393 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7394 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7395 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7396 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7397 | /* Input mixer2 */ |
| 7398 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7399 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7400 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7401 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7402 | /* Input mixer3 */ |
| 7403 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7404 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7405 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7406 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7407 | /* ADC1: mute amp left and right */ |
| 7408 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7409 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7410 | /* ADC2: mute amp left and right */ |
| 7411 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7412 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7413 | /* ADC3: mute amp left and right */ |
| 7414 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7415 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7416 | |
| 7417 | { } |
| 7418 | }; |
| 7419 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7420 | /* iMac 24 mixer. */ |
| 7421 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7422 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7423 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7424 | { } /* end */ |
| 7425 | }; |
| 7426 | |
| 7427 | /* iMac 24 init verbs. */ |
| 7428 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7429 | /* Internal speakers: output 0 (0x0c) */ |
| 7430 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7431 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7432 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7433 | /* Internal speakers: output 0 (0x0c) */ |
| 7434 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7435 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7436 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7437 | /* Headphone: output 0 (0x0c) */ |
| 7438 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7439 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7440 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7441 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7442 | /* Front Mic: input vref at 80% */ |
| 7443 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7444 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7445 | { } |
| 7446 | }; |
| 7447 | |
| 7448 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7449 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7450 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7451 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7452 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7453 | spec->autocfg.hp_pins[0] = 0x14; |
| 7454 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7455 | spec->autocfg.speaker_pins[1] = 0x1a; |
| 7456 | alc_automute_amp(codec); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7457 | } |
| 7458 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7459 | static void alc885_mbp3_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7460 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7461 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7462 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7463 | spec->autocfg.hp_pins[0] = 0x15; |
| 7464 | spec->autocfg.speaker_pins[0] = 0x14; |
| 7465 | alc_automute_amp(codec); |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7466 | } |
| 7467 | |
| 7468 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7469 | static struct hda_verb alc882_targa_verbs[] = { |
| 7470 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7471 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7472 | |
| 7473 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7474 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7475 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7476 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7477 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7478 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7479 | |
| 7480 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7481 | { } /* end */ |
| 7482 | }; |
| 7483 | |
| 7484 | /* toggle speaker-output according to the hp-jack state */ |
| 7485 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7486 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7487 | struct alc_spec *spec = codec->spec; |
| 7488 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7489 | 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] | 7490 | spec->jack_present ? 1 : 3); |
| 7491 | } |
| 7492 | |
| 7493 | static void alc882_targa_init_hook(struct hda_codec *codec) |
| 7494 | { |
| 7495 | struct alc_spec *spec = codec->spec; |
| 7496 | |
| 7497 | spec->autocfg.hp_pins[0] = 0x14; |
| 7498 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 7499 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7500 | } |
| 7501 | |
| 7502 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7503 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7504 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7505 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7506 | } |
| 7507 | |
| 7508 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7509 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7510 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7511 | |
| 7512 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7513 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7514 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7515 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7516 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7517 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7518 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7519 | |
| 7520 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7521 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7522 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7523 | { } /* end */ |
| 7524 | }; |
| 7525 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7526 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7527 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7528 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7529 | |
| 7530 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7531 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7532 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7533 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7534 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7535 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7536 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7537 | |
| 7538 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7539 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7540 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7541 | { } /* end */ |
| 7542 | }; |
| 7543 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7544 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7545 | { |
| 7546 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7547 | |
| 7548 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7549 | AC_VERB_GET_GPIO_DATA, 0); |
| 7550 | |
| 7551 | if (!muted) |
| 7552 | gpiostate |= (1 << pin); |
| 7553 | else |
| 7554 | gpiostate &= ~(1 << pin); |
| 7555 | |
| 7556 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7557 | AC_VERB_GET_GPIO_MASK, 0); |
| 7558 | gpiomask |= (1 << pin); |
| 7559 | |
| 7560 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7561 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7562 | gpiodir |= (1 << pin); |
| 7563 | |
| 7564 | |
| 7565 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7566 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7567 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7568 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7569 | |
| 7570 | msleep(1); |
| 7571 | |
| 7572 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7573 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7574 | } |
| 7575 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7576 | /* set up GPIO at initialization */ |
| 7577 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7578 | { |
| 7579 | alc882_gpio_mute(codec, 0, 0); |
| 7580 | alc882_gpio_mute(codec, 1, 0); |
| 7581 | } |
| 7582 | |
| 7583 | /* set up GPIO and update auto-muting at initialization */ |
| 7584 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7585 | { |
| 7586 | alc885_macpro_init_hook(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7587 | alc885_imac24_automute_init_hook(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7588 | } |
| 7589 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7590 | /* |
| 7591 | * generic initialization of ADC, input mixers and output mixers |
| 7592 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7593 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7594 | /* |
| 7595 | * Unmute ADC0-2 and set the default input to mic-in |
| 7596 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7597 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7598 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7599 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7600 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7601 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7602 | /* 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] | 7603 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7604 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7605 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7606 | */ |
| 7607 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7608 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7609 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7610 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7611 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7612 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7613 | |
| 7614 | /* |
| 7615 | * Set up output mixers (0x0c - 0x0f) |
| 7616 | */ |
| 7617 | /* set vol=0 to output mixers */ |
| 7618 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7620 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7621 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7622 | /* set up input amps for analog loopback */ |
| 7623 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7624 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7625 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7626 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7627 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7628 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7629 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7630 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7631 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7632 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7633 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7634 | |
| 7635 | /* FIXME: use matrix-type input source selection */ |
| 7636 | /* 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] | 7637 | /* Input mixer2 */ |
| 7638 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7639 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7640 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7641 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7642 | /* Input mixer3 */ |
| 7643 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7644 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7645 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7646 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7647 | |
| 7648 | { } |
| 7649 | }; |
| 7650 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7651 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7652 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7653 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7654 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7655 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7656 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7657 | { } /* end */ |
| 7658 | }; |
| 7659 | |
| 7660 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7661 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7662 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7663 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7664 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7665 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7666 | { } /* end */ |
| 7667 | }; |
| 7668 | |
| 7669 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7670 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7671 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7672 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7673 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7674 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7675 | { } /* end */ |
| 7676 | }; |
| 7677 | |
| 7678 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7679 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7680 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7681 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7682 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7683 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7684 | { } /* end */ |
| 7685 | }; |
| 7686 | |
| 7687 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7688 | { 2, alc889A_mb31_ch2_init }, |
| 7689 | { 4, alc889A_mb31_ch4_init }, |
| 7690 | { 5, alc889A_mb31_ch5_init }, |
| 7691 | { 6, alc889A_mb31_ch6_init }, |
| 7692 | }; |
| 7693 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7694 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7695 | /* eanable EAPD on medion laptop */ |
| 7696 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7697 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7698 | { } |
| 7699 | }; |
| 7700 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7701 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7702 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7703 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7704 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7705 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7706 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7707 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7708 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7709 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7710 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7711 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7712 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7713 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7714 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7715 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7716 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7717 | { } /* end */ |
| 7718 | }; |
| 7719 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7720 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7721 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7722 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7723 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7724 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7725 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7726 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7727 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7728 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7729 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7730 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7731 | { } /* end */ |
| 7732 | }; |
| 7733 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7734 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7735 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7736 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7737 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7738 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7739 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7740 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7741 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7742 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7743 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7744 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7745 | { } /* end */ |
| 7746 | }; |
| 7747 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7748 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7749 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7750 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7751 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7752 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7753 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7754 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7755 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7756 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7757 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7758 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7759 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7760 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7761 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7762 | { } /* end */ |
| 7763 | }; |
| 7764 | |
| 7765 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7766 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7767 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7768 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7769 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7770 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7771 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7772 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7773 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7774 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7775 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7776 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7777 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7778 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7779 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7780 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7781 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7782 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7783 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7784 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7785 | { } /* end */ |
| 7786 | }; |
| 7787 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7788 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7789 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7790 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7791 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7792 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7793 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7794 | HDA_OUTPUT), |
| 7795 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7796 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7797 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7798 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7799 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7800 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7801 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7802 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7803 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7804 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7805 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7806 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7807 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7808 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7809 | { } /* end */ |
| 7810 | }; |
| 7811 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7812 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 7813 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7814 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7815 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7816 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7817 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7818 | HDA_OUTPUT), |
| 7819 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7820 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7821 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7822 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7823 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7824 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7825 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7826 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 7828 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 7829 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 7830 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7831 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7832 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7833 | { } /* end */ |
| 7834 | }; |
| 7835 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7836 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7837 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7838 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7839 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7840 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7841 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7842 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7843 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7844 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7845 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7846 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7847 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7848 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7849 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7851 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7852 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7853 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7854 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7855 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7856 | { } /* end */ |
| 7857 | }; |
| 7858 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7859 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7861 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7862 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7863 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7864 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7865 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7866 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7867 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7868 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7869 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7870 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7871 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7872 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7873 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7874 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7875 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7876 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7877 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7878 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7879 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7880 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7881 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7882 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7883 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7884 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7885 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7886 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7887 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7888 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7889 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7890 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7891 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7892 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7893 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7894 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7895 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7896 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7897 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7898 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7899 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7900 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7901 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7902 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7903 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7904 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7905 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7906 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7907 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7908 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7909 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7910 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7911 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7914 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7915 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7916 | { } /* end */ |
| 7917 | }; |
| 7918 | |
| 7919 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7920 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7921 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7922 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7923 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7924 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7925 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7926 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7927 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7928 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7929 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7930 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7931 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7932 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7933 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7934 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7935 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7936 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7937 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7938 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7939 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7940 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7941 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7942 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7943 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7944 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 7945 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7946 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7947 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7948 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 7949 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7950 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7951 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7952 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7953 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7954 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7955 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7956 | { } /* end */ |
| 7957 | }; |
| 7958 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7959 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7960 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7961 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7962 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7963 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7964 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7965 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7966 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7967 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7968 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7969 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7970 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7971 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7972 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7973 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7974 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7975 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7976 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7977 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7978 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7979 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7980 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7981 | { } /* end */ |
| 7982 | }; |
| 7983 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7984 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 7985 | /* Output mixers */ |
| 7986 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7987 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7988 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7989 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7990 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 7991 | HDA_OUTPUT), |
| 7992 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 7993 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 7994 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 7995 | /* Output switches */ |
| 7996 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 7997 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 7998 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 7999 | /* Boost mixers */ |
| 8000 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8001 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8002 | /* Input mixers */ |
| 8003 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8004 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8005 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8006 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8007 | { } /* end */ |
| 8008 | }; |
| 8009 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8010 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8011 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8012 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8013 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8014 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8015 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8016 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8017 | { } /* end */ |
| 8018 | }; |
| 8019 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8020 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8021 | .ops = &snd_hda_bind_vol, |
| 8022 | .values = { |
| 8023 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8024 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8025 | 0 |
| 8026 | }, |
| 8027 | }; |
| 8028 | |
| 8029 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8030 | .ops = &snd_hda_bind_sw, |
| 8031 | .values = { |
| 8032 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8033 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8034 | 0 |
| 8035 | }, |
| 8036 | }; |
| 8037 | |
| 8038 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8039 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8040 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8041 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8042 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8043 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8044 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8045 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8047 | { } /* end */ |
| 8048 | }; |
| 8049 | |
| 8050 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8051 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8052 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8053 | { |
| 8054 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8055 | /* .name = "Capture Source", */ |
| 8056 | .name = "Input Source", |
| 8057 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8058 | .info = alc_mux_enum_info, |
| 8059 | .get = alc_mux_enum_get, |
| 8060 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8061 | }, |
| 8062 | { } /* end */ |
| 8063 | }; |
| 8064 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8065 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8066 | { |
| 8067 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8068 | .name = "Channel Mode", |
| 8069 | .info = alc_ch_mode_info, |
| 8070 | .get = alc_ch_mode_get, |
| 8071 | .put = alc_ch_mode_put, |
| 8072 | }, |
| 8073 | { } /* end */ |
| 8074 | }; |
| 8075 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8076 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8077 | static void alc883_mitac_init_hook(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8078 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8079 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8080 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8081 | spec->autocfg.hp_pins[0] = 0x15; |
| 8082 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8083 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8084 | alc_automute_amp(codec); |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8085 | } |
| 8086 | |
| 8087 | /* auto-toggle front mic */ |
| 8088 | /* |
| 8089 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8090 | { |
| 8091 | unsigned int present; |
| 8092 | unsigned char bits; |
| 8093 | |
| 8094 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8095 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8096 | bits = present ? HDA_AMP_MUTE : 0; |
| 8097 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8098 | } |
| 8099 | */ |
| 8100 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8101 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8102 | /* HP */ |
| 8103 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8104 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8105 | /* Subwoofer */ |
| 8106 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8107 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8108 | |
| 8109 | /* enable unsolicited event */ |
| 8110 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8111 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8112 | |
| 8113 | { } /* end */ |
| 8114 | }; |
| 8115 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8116 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8117 | /* HP */ |
| 8118 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8119 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8120 | /* Int speaker */ |
| 8121 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8122 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8123 | |
| 8124 | /* enable unsolicited event */ |
| 8125 | {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] | 8126 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8127 | |
| 8128 | { } /* end */ |
| 8129 | }; |
| 8130 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8131 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8132 | /* HP */ |
| 8133 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8134 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8135 | /* Subwoofer */ |
| 8136 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8137 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8138 | |
| 8139 | /* enable unsolicited event */ |
| 8140 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8141 | |
| 8142 | { } /* end */ |
| 8143 | }; |
| 8144 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8145 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8146 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8147 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8148 | |
| 8149 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8150 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8151 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8152 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8153 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8154 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8155 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8156 | /* Connect Mic jack to CLFE */ |
| 8157 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8158 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8159 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8160 | /* Connect Line-in jack to Surround */ |
| 8161 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8162 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8163 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8164 | /* Connect HP out jack to Front */ |
| 8165 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8166 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8167 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8168 | |
| 8169 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8170 | |
| 8171 | { } /* end */ |
| 8172 | }; |
| 8173 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8174 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8175 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8176 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8177 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8178 | { } /* end */ |
| 8179 | }; |
| 8180 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8181 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8182 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8183 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8184 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8185 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8186 | { } /* end */ |
| 8187 | }; |
| 8188 | |
| 8189 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8190 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8191 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8192 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8193 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8194 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8195 | { } /* end */ |
| 8196 | }; |
| 8197 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8198 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8199 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8200 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8201 | |
| 8202 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8203 | |
| 8204 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8205 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8206 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8207 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8208 | { } /* end */ |
| 8209 | }; |
| 8210 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8211 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8212 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8213 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8214 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8215 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8216 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8217 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8218 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8219 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8220 | { } /* end */ |
| 8221 | }; |
| 8222 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8223 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8224 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8225 | { } |
| 8226 | }; |
| 8227 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8228 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8229 | /* HP */ |
| 8230 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8231 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8232 | |
| 8233 | /* enable unsolicited event */ |
| 8234 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8235 | |
| 8236 | { } /* end */ |
| 8237 | }; |
| 8238 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8239 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8240 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8241 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8242 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8243 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8244 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8245 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8246 | spec->autocfg.speaker_pins[2] = 0x18; |
| 8247 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8248 | } |
| 8249 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8250 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8251 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8252 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8253 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8254 | {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] | 8255 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8256 | }; |
| 8257 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8258 | /* |
| 8259 | * 2ch mode |
| 8260 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8261 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8262 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8263 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8264 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8265 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8266 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8267 | }; |
| 8268 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8269 | /* |
| 8270 | * 4ch mode |
| 8271 | */ |
| 8272 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8273 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8274 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8275 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8276 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8277 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8278 | { } /* end */ |
| 8279 | }; |
| 8280 | |
| 8281 | /* |
| 8282 | * 6ch mode |
| 8283 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8284 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8285 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8286 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8287 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8288 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8289 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8290 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8291 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8292 | }; |
| 8293 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8294 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8295 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8296 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8297 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8298 | }; |
| 8299 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8300 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8301 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8302 | { |
| 8303 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8304 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8305 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8306 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8307 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8308 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8309 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8310 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8311 | } |
| 8312 | |
| 8313 | /* toggle RCA according to the front-jack state */ |
| 8314 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8315 | { |
| 8316 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8317 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8318 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8319 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8320 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8321 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8322 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8323 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8324 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8325 | unsigned int res) |
| 8326 | { |
| 8327 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8328 | alc888_lenovo_ms7195_front_automute(codec); |
| 8329 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8330 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8331 | } |
| 8332 | |
| 8333 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8335 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8336 | |
| 8337 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8338 | |
| 8339 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8340 | { } /* end */ |
| 8341 | }; |
| 8342 | |
| 8343 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8344 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8345 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8346 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8347 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8348 | spec->autocfg.hp_pins[0] = 0x14; |
| 8349 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8350 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8351 | } |
| 8352 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8353 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8354 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8355 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8356 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8357 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8358 | { |
| 8359 | unsigned int present; |
| 8360 | |
| 8361 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8362 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8363 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8364 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8365 | } |
| 8366 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8367 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8368 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8369 | struct alc_spec *spec = codec->spec; |
| 8370 | |
| 8371 | spec->autocfg.hp_pins[0] = 0x15; |
| 8372 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8373 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8374 | alc883_clevo_m720_mic_automute(codec); |
| 8375 | } |
| 8376 | |
| 8377 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8378 | unsigned int res) |
| 8379 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8380 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8381 | case ALC880_MIC_EVENT: |
| 8382 | alc883_clevo_m720_mic_automute(codec); |
| 8383 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8384 | default: |
| 8385 | alc_automute_amp_unsol_event(codec, res); |
| 8386 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8387 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8388 | } |
| 8389 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8390 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8391 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8392 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8393 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8394 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8395 | spec->autocfg.hp_pins[0] = 0x14; |
| 8396 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8397 | alc_automute_amp(codec); |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8398 | } |
| 8399 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8400 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8401 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8402 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8403 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8404 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8405 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8406 | alc_automute_amp(codec); |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8407 | } |
| 8408 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8409 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8410 | { |
| 8411 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8412 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8413 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8414 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8415 | & AC_PINSENSE_PRESENCE; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8416 | bits = present ? HDA_AMP_MUTE : 0; |
| 8417 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8418 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8419 | } |
| 8420 | |
| 8421 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8422 | { |
| 8423 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8424 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8425 | |
| 8426 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8427 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8428 | bits = present ? HDA_AMP_MUTE : 0; |
| 8429 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8430 | HDA_AMP_MUTE, bits); |
| 8431 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8432 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8433 | } |
| 8434 | |
| 8435 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8436 | unsigned int res) |
| 8437 | { |
| 8438 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8439 | alc883_lenovo_101e_all_automute(codec); |
| 8440 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8441 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8442 | } |
| 8443 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8444 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8445 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8446 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8447 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8448 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8449 | spec->autocfg.hp_pins[0] = 0x14; |
| 8450 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8451 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8452 | alc_automute_amp(codec); |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8453 | } |
| 8454 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8455 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8456 | /* HP Pin: output 0 (0x0c) */ |
| 8457 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8458 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8459 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8460 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8461 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8462 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8463 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8464 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8465 | /* eanable EAPD on medion laptop */ |
| 8466 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8467 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8468 | /* enable unsolicited event */ |
| 8469 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8470 | { } |
| 8471 | }; |
| 8472 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8473 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8474 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8475 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8476 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8477 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8478 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8479 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8480 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8481 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8482 | alc_automute_amp(codec); |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8483 | } |
| 8484 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8485 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8486 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8487 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8488 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8489 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8490 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8491 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8492 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8493 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8494 | spec->autocfg.speaker_pins[4] = 0x1a; |
| 8495 | alc_automute_amp(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8496 | } |
| 8497 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8498 | static void alc883_vaiott_init_hook(struct hda_codec *codec) |
| 8499 | { |
| 8500 | struct alc_spec *spec = codec->spec; |
| 8501 | |
| 8502 | spec->autocfg.hp_pins[0] = 0x15; |
| 8503 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8504 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8505 | alc_automute_amp(codec); |
| 8506 | } |
| 8507 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8508 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8509 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8510 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8511 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8512 | /* enable unsolicited event */ |
| 8513 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8514 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8515 | { } /* end */ |
| 8516 | }; |
| 8517 | |
| 8518 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8519 | { |
| 8520 | unsigned int present; |
| 8521 | |
| 8522 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8523 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8524 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8525 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8526 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8527 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8528 | } |
| 8529 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8530 | static void alc883_M90V_init_hook(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8531 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8532 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8533 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8534 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8535 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8536 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8537 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8538 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8539 | } |
| 8540 | |
| 8541 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8542 | unsigned int res) |
| 8543 | { |
| 8544 | switch (res >> 26) { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8545 | case ALC880_MIC_EVENT: |
| 8546 | alc883_nb_mic_automute(codec); |
| 8547 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8548 | default: |
| 8549 | alc_sku_unsol_event(codec, res); |
| 8550 | break; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8551 | } |
| 8552 | } |
| 8553 | |
| 8554 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8555 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8556 | alc883_M90V_init_hook(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8557 | alc883_nb_mic_automute(codec); |
| 8558 | } |
| 8559 | |
| 8560 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8561 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8562 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8563 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8564 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8565 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8566 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8567 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8568 | /* enable unsolicited event */ |
| 8569 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8570 | { } /* end */ |
| 8571 | }; |
| 8572 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8573 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8574 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8575 | struct alc_spec *spec = codec->spec; |
| 8576 | |
| 8577 | spec->autocfg.hp_pins[0] = 0x14; |
| 8578 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8579 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8580 | } |
| 8581 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8582 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8583 | /* Init rear pin (used as headphone output) */ |
| 8584 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8585 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8586 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8587 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8588 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8589 | /* Init line 2 pin (used as headphone out by default) */ |
| 8590 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8591 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8592 | { } /* end */ |
| 8593 | }; |
| 8594 | |
| 8595 | /* Mute speakers according to the headphone jack state */ |
| 8596 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8597 | { |
| 8598 | unsigned int present; |
| 8599 | |
| 8600 | /* Mute only in 2ch or 4ch mode */ |
| 8601 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8602 | == 0x00) { |
| 8603 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8604 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 8605 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8606 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8607 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8608 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8609 | } |
| 8610 | } |
| 8611 | |
| 8612 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8613 | { |
| 8614 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8615 | alc889A_mb31_automute(codec); |
| 8616 | } |
| 8617 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8618 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8619 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8620 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8621 | #endif |
| 8622 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8623 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8624 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8625 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8626 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8627 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8628 | |
| 8629 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8630 | ALC1200_DIGOUT_NID, 0, |
| 8631 | }; |
| 8632 | |
| 8633 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8634 | ALC883_DIGOUT_NID, 0, |
| 8635 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8636 | |
| 8637 | /* |
| 8638 | * configuration and preset |
| 8639 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8640 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 8641 | [ALC882_3ST_DIG] = "3stack-dig", |
| 8642 | [ALC882_6ST_DIG] = "6stack-dig", |
| 8643 | [ALC882_ARIMA] = "arima", |
| 8644 | [ALC882_W2JC] = "w2jc", |
| 8645 | [ALC882_TARGA] = "targa", |
| 8646 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 8647 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 8648 | [ALC885_MACPRO] = "macpro", |
| 8649 | [ALC885_MB5] = "mb5", |
| 8650 | [ALC885_MBP3] = "mbp3", |
| 8651 | [ALC885_IMAC24] = "imac24", |
| 8652 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8653 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8654 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8655 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8656 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8657 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8658 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8659 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8660 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8661 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 8662 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8663 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8664 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8665 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8666 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8667 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8668 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8669 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8670 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8671 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8672 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8673 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8674 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8675 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8676 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8677 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8678 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8679 | [ALC889A_INTEL] = "intel-alc889a", |
| 8680 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8681 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8682 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8683 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8684 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8685 | }; |
| 8686 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8687 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 8688 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 8689 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8690 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8691 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8692 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8693 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8694 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8695 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8696 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8697 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8698 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8699 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8700 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 8701 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 8702 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 8703 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8704 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 8705 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8706 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 8707 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8708 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8709 | ALC888_ACER_ASPIRE_6530G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8710 | /* default Acer -- disabled as it causes more problems. |
| 8711 | * model=auto should work fine now |
| 8712 | */ |
| 8713 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8714 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8715 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8716 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8717 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8718 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8719 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8720 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8721 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8722 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8723 | |
| 8724 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 8725 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 8726 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8727 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8728 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 8729 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 8730 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8731 | 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] | 8732 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8733 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8734 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8735 | |
| 8736 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8737 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8738 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8739 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8740 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8741 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8742 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8743 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8744 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 8745 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8746 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8747 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8748 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8749 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8750 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8751 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8752 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8753 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8754 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8755 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8756 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8757 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8758 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8759 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8760 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8761 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8762 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8763 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8764 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8765 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8766 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8767 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8768 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8769 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8770 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8771 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 8772 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8773 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8774 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8775 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8776 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8777 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8778 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8779 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8780 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8781 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8782 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8783 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8784 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8785 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8786 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8787 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8788 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8789 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8790 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8791 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8792 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8793 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8794 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8795 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8796 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8797 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8798 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8799 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8800 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 8801 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 8802 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8803 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8804 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8805 | {} |
| 8806 | }; |
| 8807 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8808 | /* codec SSID table for Intel Mac */ |
| 8809 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 8810 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 8811 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 8812 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 8813 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 8814 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 8815 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 8816 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 8817 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 8818 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 8819 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
| 8820 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
| 8821 | /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently |
| 8822 | * no perfect solution yet |
| 8823 | */ |
| 8824 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
| 8825 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8826 | }; |
| 8827 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8828 | static struct alc_config_preset alc882_presets[] = { |
| 8829 | [ALC882_3ST_DIG] = { |
| 8830 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8831 | .init_verbs = { alc882_base_init_verbs, |
| 8832 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8833 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8834 | .dac_nids = alc882_dac_nids, |
| 8835 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8836 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8837 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8838 | .channel_mode = alc882_ch_modes, |
| 8839 | .need_dac_fix = 1, |
| 8840 | .input_mux = &alc882_capture_source, |
| 8841 | }, |
| 8842 | [ALC882_6ST_DIG] = { |
| 8843 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8844 | .init_verbs = { alc882_base_init_verbs, |
| 8845 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8846 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8847 | .dac_nids = alc882_dac_nids, |
| 8848 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8849 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8850 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8851 | .channel_mode = alc882_sixstack_modes, |
| 8852 | .input_mux = &alc882_capture_source, |
| 8853 | }, |
| 8854 | [ALC882_ARIMA] = { |
| 8855 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8856 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8857 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8858 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8859 | .dac_nids = alc882_dac_nids, |
| 8860 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8861 | .channel_mode = alc882_sixstack_modes, |
| 8862 | .input_mux = &alc882_capture_source, |
| 8863 | }, |
| 8864 | [ALC882_W2JC] = { |
| 8865 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8866 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8867 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8868 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8869 | .dac_nids = alc882_dac_nids, |
| 8870 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8871 | .channel_mode = alc880_threestack_modes, |
| 8872 | .need_dac_fix = 1, |
| 8873 | .input_mux = &alc882_capture_source, |
| 8874 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8875 | }, |
| 8876 | [ALC885_MBP3] = { |
| 8877 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 8878 | .init_verbs = { alc885_mbp3_init_verbs, |
| 8879 | alc880_gpio1_init_verbs }, |
| 8880 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8881 | .dac_nids = alc882_dac_nids, |
| 8882 | .channel_mode = alc885_mbp_6ch_modes, |
| 8883 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 8884 | .input_mux = &alc882_capture_source, |
| 8885 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8886 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8887 | .unsol_event = alc_automute_amp_unsol_event, |
| 8888 | .init_hook = alc885_mbp3_init_hook, |
| 8889 | }, |
| 8890 | [ALC885_MB5] = { |
| 8891 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 8892 | .init_verbs = { alc885_mb5_init_verbs, |
| 8893 | alc880_gpio1_init_verbs }, |
| 8894 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8895 | .dac_nids = alc882_dac_nids, |
| 8896 | .channel_mode = alc885_mb5_6ch_modes, |
| 8897 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 8898 | .input_mux = &mb5_capture_source, |
| 8899 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8900 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8901 | }, |
| 8902 | [ALC885_MACPRO] = { |
| 8903 | .mixers = { alc882_macpro_mixer }, |
| 8904 | .init_verbs = { alc882_macpro_init_verbs }, |
| 8905 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8906 | .dac_nids = alc882_dac_nids, |
| 8907 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8908 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8909 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8910 | .channel_mode = alc882_ch_modes, |
| 8911 | .input_mux = &alc882_capture_source, |
| 8912 | .init_hook = alc885_macpro_init_hook, |
| 8913 | }, |
| 8914 | [ALC885_IMAC24] = { |
| 8915 | .mixers = { alc885_imac24_mixer }, |
| 8916 | .init_verbs = { alc885_imac24_init_verbs }, |
| 8917 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8918 | .dac_nids = alc882_dac_nids, |
| 8919 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8920 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8921 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8922 | .channel_mode = alc882_ch_modes, |
| 8923 | .input_mux = &alc882_capture_source, |
| 8924 | .unsol_event = alc_automute_amp_unsol_event, |
| 8925 | .init_hook = alc885_imac24_init_hook, |
| 8926 | }, |
| 8927 | [ALC882_TARGA] = { |
| 8928 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8929 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 8930 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8931 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8932 | .dac_nids = alc882_dac_nids, |
| 8933 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8934 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8935 | .adc_nids = alc882_adc_nids, |
| 8936 | .capsrc_nids = alc882_capsrc_nids, |
| 8937 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8938 | .channel_mode = alc882_3ST_6ch_modes, |
| 8939 | .need_dac_fix = 1, |
| 8940 | .input_mux = &alc882_capture_source, |
| 8941 | .unsol_event = alc882_targa_unsol_event, |
| 8942 | .init_hook = alc882_targa_init_hook, |
| 8943 | }, |
| 8944 | [ALC882_ASUS_A7J] = { |
| 8945 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8946 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8947 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8948 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8949 | .dac_nids = alc882_dac_nids, |
| 8950 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8951 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8952 | .adc_nids = alc882_adc_nids, |
| 8953 | .capsrc_nids = alc882_capsrc_nids, |
| 8954 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8955 | .channel_mode = alc882_3ST_6ch_modes, |
| 8956 | .need_dac_fix = 1, |
| 8957 | .input_mux = &alc882_capture_source, |
| 8958 | }, |
| 8959 | [ALC882_ASUS_A7M] = { |
| 8960 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8961 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8962 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8963 | alc882_asus_a7m_verbs }, |
| 8964 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8965 | .dac_nids = alc882_dac_nids, |
| 8966 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8967 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8968 | .channel_mode = alc880_threestack_modes, |
| 8969 | .need_dac_fix = 1, |
| 8970 | .input_mux = &alc882_capture_source, |
| 8971 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8972 | [ALC883_3ST_2ch_DIG] = { |
| 8973 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8974 | .init_verbs = { alc883_init_verbs }, |
| 8975 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8976 | .dac_nids = alc883_dac_nids, |
| 8977 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8978 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8979 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8980 | .channel_mode = alc883_3ST_2ch_modes, |
| 8981 | .input_mux = &alc883_capture_source, |
| 8982 | }, |
| 8983 | [ALC883_3ST_6ch_DIG] = { |
| 8984 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8985 | .init_verbs = { alc883_init_verbs }, |
| 8986 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8987 | .dac_nids = alc883_dac_nids, |
| 8988 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8989 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8990 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8991 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8992 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8993 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8994 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8995 | [ALC883_3ST_6ch] = { |
| 8996 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8997 | .init_verbs = { alc883_init_verbs }, |
| 8998 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8999 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9000 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9001 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9002 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9003 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9004 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9005 | [ALC883_3ST_6ch_INTEL] = { |
| 9006 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9007 | .init_verbs = { alc883_init_verbs }, |
| 9008 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9009 | .dac_nids = alc883_dac_nids, |
| 9010 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9011 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9012 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9013 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9014 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9015 | .need_dac_fix = 1, |
| 9016 | .input_mux = &alc883_3stack_6ch_intel, |
| 9017 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9018 | [ALC889A_INTEL] = { |
| 9019 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9020 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9021 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9022 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9023 | .dac_nids = alc883_dac_nids, |
| 9024 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9025 | .adc_nids = alc889_adc_nids, |
| 9026 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9027 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9028 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9029 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9030 | .channel_mode = alc889_8ch_intel_modes, |
| 9031 | .capsrc_nids = alc889_capsrc_nids, |
| 9032 | .input_mux = &alc889_capture_source, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9033 | .init_hook = alc889_automute_init, |
| 9034 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9035 | .need_dac_fix = 1, |
| 9036 | }, |
| 9037 | [ALC889_INTEL] = { |
| 9038 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9039 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9040 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9041 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9042 | .dac_nids = alc883_dac_nids, |
| 9043 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9044 | .adc_nids = alc889_adc_nids, |
| 9045 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9046 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9047 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9048 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9049 | .channel_mode = alc889_8ch_intel_modes, |
| 9050 | .capsrc_nids = alc889_capsrc_nids, |
| 9051 | .input_mux = &alc889_capture_source, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9052 | .init_hook = alc889_intel_init_hook, |
| 9053 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9054 | .need_dac_fix = 1, |
| 9055 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9056 | [ALC883_6ST_DIG] = { |
| 9057 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9058 | .init_verbs = { alc883_init_verbs }, |
| 9059 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9060 | .dac_nids = alc883_dac_nids, |
| 9061 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9062 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9063 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9064 | .channel_mode = alc883_sixstack_modes, |
| 9065 | .input_mux = &alc883_capture_source, |
| 9066 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9067 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9068 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9069 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9070 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9071 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9072 | .dac_nids = alc883_dac_nids, |
| 9073 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9074 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9075 | .channel_mode = alc883_3ST_6ch_modes, |
| 9076 | .need_dac_fix = 1, |
| 9077 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9078 | .unsol_event = alc883_targa_unsol_event, |
| 9079 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9080 | }, |
| 9081 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9082 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9083 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9084 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9085 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9086 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9087 | .adc_nids = alc883_adc_nids_alt, |
| 9088 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9089 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9090 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9091 | .channel_mode = alc883_3ST_2ch_modes, |
| 9092 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9093 | .unsol_event = alc883_targa_unsol_event, |
| 9094 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9095 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9096 | [ALC883_TARGA_8ch_DIG] = { |
| 9097 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9098 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9099 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9100 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9101 | .dac_nids = alc883_dac_nids, |
| 9102 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9103 | .adc_nids = alc883_adc_nids_rev, |
| 9104 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9105 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9106 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9107 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9108 | .channel_mode = alc883_4ST_8ch_modes, |
| 9109 | .need_dac_fix = 1, |
| 9110 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9111 | .unsol_event = alc883_targa_unsol_event, |
| 9112 | .init_hook = alc883_targa_init_hook, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9113 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9114 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9115 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9116 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9117 | * and the headphone jack. Turn this on and rely on the |
| 9118 | * standard mute methods whenever the user wants to turn |
| 9119 | * these outputs off. |
| 9120 | */ |
| 9121 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9122 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9123 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9124 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9125 | .channel_mode = alc883_3ST_2ch_modes, |
| 9126 | .input_mux = &alc883_capture_source, |
| 9127 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9128 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9129 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9130 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9131 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9132 | .dac_nids = alc883_dac_nids, |
| 9133 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9134 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9135 | .channel_mode = alc883_3ST_2ch_modes, |
| 9136 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9137 | .unsol_event = alc_automute_amp_unsol_event, |
| 9138 | .init_hook = alc883_acer_aspire_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9139 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9140 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9141 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9142 | alc883_chmode_mixer }, |
| 9143 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9144 | alc888_acer_aspire_4930g_verbs }, |
| 9145 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9146 | .dac_nids = alc883_dac_nids, |
| 9147 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9148 | .adc_nids = alc883_adc_nids_rev, |
| 9149 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9150 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9151 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9152 | .channel_mode = alc883_3ST_6ch_modes, |
| 9153 | .need_dac_fix = 1, |
| 9154 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9155 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9156 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9157 | .unsol_event = alc_automute_amp_unsol_event, |
| 9158 | .init_hook = alc888_acer_aspire_4930g_init_hook, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9159 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9160 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9161 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9162 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9163 | alc888_acer_aspire_6530g_verbs }, |
| 9164 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9165 | .dac_nids = alc883_dac_nids, |
| 9166 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9167 | .adc_nids = alc883_adc_nids_rev, |
| 9168 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9169 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9170 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9171 | .channel_mode = alc883_3ST_2ch_modes, |
| 9172 | .num_mux_defs = |
| 9173 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9174 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9175 | .unsol_event = alc_automute_amp_unsol_event, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 9176 | .init_hook = alc888_acer_aspire_6530g_init_hook, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9177 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9178 | [ALC888_ACER_ASPIRE_8930G] = { |
| 9179 | .mixers = { alc888_base_mixer, |
| 9180 | alc883_chmode_mixer }, |
| 9181 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9182 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9183 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9184 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9185 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9186 | .adc_nids = alc889_adc_nids, |
| 9187 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9188 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9189 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9190 | .channel_mode = alc883_3ST_6ch_modes, |
| 9191 | .need_dac_fix = 1, |
| 9192 | .const_channel_count = 6, |
| 9193 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9194 | ARRAY_SIZE(alc889_capture_sources), |
| 9195 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9196 | .unsol_event = alc_automute_amp_unsol_event, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9197 | .init_hook = alc889_acer_aspire_8930g_init_hook, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9198 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9199 | [ALC883_MEDION] = { |
| 9200 | .mixers = { alc883_fivestack_mixer, |
| 9201 | alc883_chmode_mixer }, |
| 9202 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9203 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9204 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9205 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9206 | .adc_nids = alc883_adc_nids_alt, |
| 9207 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9208 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9209 | .channel_mode = alc883_sixstack_modes, |
| 9210 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9211 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9212 | [ALC883_MEDION_MD2] = { |
| 9213 | .mixers = { alc883_medion_md2_mixer}, |
| 9214 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9215 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9216 | .dac_nids = alc883_dac_nids, |
| 9217 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9218 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9219 | .channel_mode = alc883_3ST_2ch_modes, |
| 9220 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9221 | .unsol_event = alc_automute_amp_unsol_event, |
| 9222 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9223 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9224 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9225 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9226 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9227 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9228 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9229 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9230 | .channel_mode = alc883_3ST_2ch_modes, |
| 9231 | .input_mux = &alc883_capture_source, |
| 9232 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9233 | [ALC883_CLEVO_M720] = { |
| 9234 | .mixers = { alc883_clevo_m720_mixer }, |
| 9235 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9236 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9237 | .dac_nids = alc883_dac_nids, |
| 9238 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9239 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9240 | .channel_mode = alc883_3ST_2ch_modes, |
| 9241 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9242 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9243 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9244 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9245 | [ALC883_LENOVO_101E_2ch] = { |
| 9246 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9247 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9248 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9249 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9250 | .adc_nids = alc883_adc_nids_alt, |
| 9251 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9252 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9253 | .channel_mode = alc883_3ST_2ch_modes, |
| 9254 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9255 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9256 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9257 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9258 | [ALC883_LENOVO_NB0763] = { |
| 9259 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9260 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9261 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9262 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9263 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9264 | .channel_mode = alc883_3ST_2ch_modes, |
| 9265 | .need_dac_fix = 1, |
| 9266 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9267 | .unsol_event = alc_automute_amp_unsol_event, |
| 9268 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9269 | }, |
| 9270 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9271 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9272 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9273 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9274 | .dac_nids = alc883_dac_nids, |
| 9275 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9276 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9277 | .channel_mode = alc883_3ST_6ch_modes, |
| 9278 | .need_dac_fix = 1, |
| 9279 | .input_mux = &alc883_capture_source, |
| 9280 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9281 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9282 | }, |
| 9283 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9284 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9285 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9286 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9287 | .dac_nids = alc883_dac_nids, |
| 9288 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9289 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9290 | .channel_mode = alc883_3ST_2ch_modes, |
| 9291 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9292 | .unsol_event = alc_automute_amp_unsol_event, |
| 9293 | .init_hook = alc883_haier_w66_init_hook, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9294 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9295 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9296 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9297 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9298 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9299 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9300 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9301 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9302 | .need_dac_fix = 1, |
| 9303 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9304 | .unsol_event = alc_automute_amp_unsol_event, |
| 9305 | .init_hook = alc888_3st_hp_init_hook, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9306 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9307 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9308 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9309 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9310 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9311 | .dac_nids = alc883_dac_nids, |
| 9312 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9313 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9314 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9315 | .channel_mode = alc883_sixstack_modes, |
| 9316 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9317 | .unsol_event = alc_automute_amp_unsol_event, |
| 9318 | .init_hook = alc888_6st_dell_init_hook, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9319 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9320 | [ALC883_MITAC] = { |
| 9321 | .mixers = { alc883_mitac_mixer }, |
| 9322 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9323 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9324 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9325 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9326 | .channel_mode = alc883_3ST_2ch_modes, |
| 9327 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9328 | .unsol_event = alc_automute_amp_unsol_event, |
| 9329 | .init_hook = alc883_mitac_init_hook, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9330 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9331 | [ALC883_FUJITSU_PI2515] = { |
| 9332 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9333 | .init_verbs = { alc883_init_verbs, |
| 9334 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9335 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9336 | .dac_nids = alc883_dac_nids, |
| 9337 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9338 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9339 | .channel_mode = alc883_3ST_2ch_modes, |
| 9340 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9341 | .unsol_event = alc_automute_amp_unsol_event, |
| 9342 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9343 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9344 | [ALC888_FUJITSU_XA3530] = { |
| 9345 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9346 | .init_verbs = { alc883_init_verbs, |
| 9347 | alc888_fujitsu_xa3530_verbs }, |
| 9348 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9349 | .dac_nids = alc883_dac_nids, |
| 9350 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9351 | .adc_nids = alc883_adc_nids_rev, |
| 9352 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9353 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9354 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9355 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9356 | .num_mux_defs = |
| 9357 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9358 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9359 | .unsol_event = alc_automute_amp_unsol_event, |
| 9360 | .init_hook = alc888_fujitsu_xa3530_init_hook, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9361 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9362 | [ALC888_LENOVO_SKY] = { |
| 9363 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9364 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9365 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9366 | .dac_nids = alc883_dac_nids, |
| 9367 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9368 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9369 | .channel_mode = alc883_sixstack_modes, |
| 9370 | .need_dac_fix = 1, |
| 9371 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9372 | .unsol_event = alc_automute_amp_unsol_event, |
| 9373 | .init_hook = alc888_lenovo_sky_init_hook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9374 | }, |
| 9375 | [ALC888_ASUS_M90V] = { |
| 9376 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9377 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9378 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9379 | .dac_nids = alc883_dac_nids, |
| 9380 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9381 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9382 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9383 | .channel_mode = alc883_3ST_6ch_modes, |
| 9384 | .need_dac_fix = 1, |
| 9385 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9386 | .unsol_event = alc883_mode2_unsol_event, |
| 9387 | .init_hook = alc883_mode2_inithook, |
| 9388 | }, |
| 9389 | [ALC888_ASUS_EEE1601] = { |
| 9390 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9391 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9392 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9393 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9394 | .dac_nids = alc883_dac_nids, |
| 9395 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9396 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9397 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9398 | .channel_mode = alc883_3ST_2ch_modes, |
| 9399 | .need_dac_fix = 1, |
| 9400 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9401 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9402 | .init_hook = alc883_eee1601_inithook, |
| 9403 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9404 | [ALC1200_ASUS_P5Q] = { |
| 9405 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9406 | .init_verbs = { alc883_init_verbs }, |
| 9407 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9408 | .dac_nids = alc883_dac_nids, |
| 9409 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9410 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9411 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9412 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9413 | .channel_mode = alc883_sixstack_modes, |
| 9414 | .input_mux = &alc883_capture_source, |
| 9415 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9416 | [ALC889A_MB31] = { |
| 9417 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9418 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9419 | alc880_gpio1_init_verbs }, |
| 9420 | .adc_nids = alc883_adc_nids, |
| 9421 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9422 | .dac_nids = alc883_dac_nids, |
| 9423 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9424 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9425 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9426 | .input_mux = &alc889A_mb31_capture_source, |
| 9427 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9428 | .unsol_event = alc889A_mb31_unsol_event, |
| 9429 | .init_hook = alc889A_mb31_automute, |
| 9430 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9431 | [ALC883_SONY_VAIO_TT] = { |
| 9432 | .mixers = { alc883_vaiott_mixer }, |
| 9433 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9434 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9435 | .dac_nids = alc883_dac_nids, |
| 9436 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9437 | .channel_mode = alc883_3ST_2ch_modes, |
| 9438 | .input_mux = &alc883_capture_source, |
| 9439 | .unsol_event = alc_automute_amp_unsol_event, |
| 9440 | .init_hook = alc883_vaiott_init_hook, |
| 9441 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9442 | }; |
| 9443 | |
| 9444 | |
| 9445 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9446 | * Pin config fixes |
| 9447 | */ |
| 9448 | enum { |
| 9449 | PINFIX_ABIT_AW9D_MAX |
| 9450 | }; |
| 9451 | |
| 9452 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9453 | { 0x15, 0x01080104 }, /* side */ |
| 9454 | { 0x16, 0x01011012 }, /* rear */ |
| 9455 | { 0x17, 0x01016011 }, /* clfe */ |
| 9456 | { } |
| 9457 | }; |
| 9458 | |
| 9459 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 9460 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 9461 | }; |
| 9462 | |
| 9463 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 9464 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9465 | {} |
| 9466 | }; |
| 9467 | |
| 9468 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9469 | * BIOS auto configuration |
| 9470 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9471 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9472 | hda_nid_t nid, int pin_type, |
| 9473 | int dac_idx) |
| 9474 | { |
| 9475 | /* set as output */ |
| 9476 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9477 | int idx; |
| 9478 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9479 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9480 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9481 | idx = 4; |
| 9482 | else |
| 9483 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9484 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9485 | |
| 9486 | } |
| 9487 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9488 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9489 | { |
| 9490 | struct alc_spec *spec = codec->spec; |
| 9491 | int i; |
| 9492 | |
| 9493 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9494 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9495 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9496 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9497 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9498 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9499 | } |
| 9500 | } |
| 9501 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9502 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9503 | { |
| 9504 | struct alc_spec *spec = codec->spec; |
| 9505 | hda_nid_t pin; |
| 9506 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9507 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9508 | if (pin) /* connect to front */ |
| 9509 | /* use dac 0 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9510 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9511 | pin = spec->autocfg.speaker_pins[0]; |
| 9512 | if (pin) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9513 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9514 | } |
| 9515 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9516 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9517 | { |
| 9518 | struct alc_spec *spec = codec->spec; |
| 9519 | int i; |
| 9520 | |
| 9521 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9522 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9523 | if (!nid) |
| 9524 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 9525 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9526 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 9527 | snd_hda_codec_write(codec, nid, 0, |
| 9528 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9529 | AMP_OUT_MUTE); |
| 9530 | } |
| 9531 | } |
| 9532 | |
| 9533 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 9534 | { |
| 9535 | struct alc_spec *spec = codec->spec; |
| 9536 | int c; |
| 9537 | |
| 9538 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 9539 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 9540 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 9541 | unsigned int mux_idx; |
| 9542 | const struct hda_input_mux *imux; |
| 9543 | int conns, mute, idx, item; |
| 9544 | |
| 9545 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 9546 | ARRAY_SIZE(conn_list)); |
| 9547 | if (conns < 0) |
| 9548 | continue; |
| 9549 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 9550 | imux = &spec->input_mux[mux_idx]; |
| 9551 | for (idx = 0; idx < conns; idx++) { |
| 9552 | /* if the current connection is the selected one, |
| 9553 | * unmute it as default - otherwise mute it |
| 9554 | */ |
| 9555 | mute = AMP_IN_MUTE(idx); |
| 9556 | for (item = 0; item < imux->num_items; item++) { |
| 9557 | if (imux->items[item].index == idx) { |
| 9558 | if (spec->cur_mux[c] == item) |
| 9559 | mute = AMP_IN_UNMUTE(idx); |
| 9560 | break; |
| 9561 | } |
| 9562 | } |
| 9563 | /* check if we have a selector or mixer |
| 9564 | * we could check for the widget type instead, but |
| 9565 | * just check for Amp-In presence (in case of mixer |
| 9566 | * without amp-in there is something wrong, this |
| 9567 | * function shouldn't be used or capsrc nid is wrong) |
| 9568 | */ |
| 9569 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9570 | snd_hda_codec_write(codec, nid, 0, |
| 9571 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9572 | mute); |
| 9573 | else if (mute != AMP_IN_MUTE(idx)) |
| 9574 | snd_hda_codec_write(codec, nid, 0, |
| 9575 | AC_VERB_SET_CONNECT_SEL, |
| 9576 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9577 | } |
| 9578 | } |
| 9579 | } |
| 9580 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9581 | /* add mic boosts if needed */ |
| 9582 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9583 | { |
| 9584 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9585 | int err; |
| 9586 | hda_nid_t nid; |
| 9587 | |
| 9588 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 9589 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9590 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9591 | "Mic Boost", |
| 9592 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9593 | if (err < 0) |
| 9594 | return err; |
| 9595 | } |
| 9596 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 9597 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9598 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9599 | "Front Mic Boost", |
| 9600 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9601 | if (err < 0) |
| 9602 | return err; |
| 9603 | } |
| 9604 | return 0; |
| 9605 | } |
| 9606 | |
| 9607 | /* almost identical with ALC880 parser... */ |
| 9608 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 9609 | { |
| 9610 | struct alc_spec *spec = codec->spec; |
| 9611 | struct auto_pin_cfg *autocfg = &spec->autocfg; |
| 9612 | unsigned int wcap; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9613 | int i; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9614 | int err = alc880_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9615 | |
| 9616 | if (err < 0) |
| 9617 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9618 | else if (!err) |
| 9619 | return 0; /* no config found */ |
| 9620 | |
| 9621 | err = alc_auto_add_mic_boost(codec); |
| 9622 | if (err < 0) |
| 9623 | return err; |
| 9624 | |
| 9625 | /* hack - override the init verbs */ |
| 9626 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9627 | /* if ADC 0x07 is available, initialize it, too */ |
| 9628 | wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 9629 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9630 | if (wcap == AC_WID_AUD_IN) |
| 9631 | add_verb(spec, alc882_adc1_init_verbs); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9632 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9633 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9634 | * because it's under 0x18 |
| 9635 | */ |
| 9636 | if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9637 | autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9638 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9639 | for (i = 1; i < 3; i++) |
| 9640 | memcpy(&spec->private_imux[i], |
| 9641 | &spec->private_imux[0], |
| 9642 | sizeof(spec->private_imux[0])); |
| 9643 | imux->items[imux->num_items].label = "Int DMic"; |
| 9644 | imux->items[imux->num_items].index = 0x0b; |
| 9645 | imux->num_items++; |
| 9646 | spec->num_mux_defs = 3; |
| 9647 | spec->input_mux = spec->private_imux; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9648 | } |
| 9649 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9650 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9651 | } |
| 9652 | |
| 9653 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9654 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9655 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9656 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9657 | alc882_auto_init_multi_out(codec); |
| 9658 | alc882_auto_init_hp_out(codec); |
| 9659 | alc882_auto_init_analog_input(codec); |
| 9660 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9661 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9662 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9663 | } |
| 9664 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9665 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9666 | { |
| 9667 | struct alc_spec *spec; |
| 9668 | int err, board_config; |
| 9669 | |
| 9670 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9671 | if (spec == NULL) |
| 9672 | return -ENOMEM; |
| 9673 | |
| 9674 | codec->spec = spec; |
| 9675 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9676 | switch (codec->vendor_id) { |
| 9677 | case 0x10ec0882: |
| 9678 | case 0x10ec0885: |
| 9679 | break; |
| 9680 | default: |
| 9681 | /* ALC883 and variants */ |
| 9682 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9683 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9684 | } |
| 9685 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9686 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 9687 | alc882_models, |
| 9688 | alc882_cfg_tbl); |
| 9689 | |
| 9690 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 9691 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 9692 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 9693 | |
| 9694 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 9695 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9696 | codec->chip_name); |
| 9697 | board_config = ALC882_AUTO; |
| 9698 | } |
| 9699 | |
| 9700 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 9701 | |
| 9702 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9703 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9704 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9705 | if (err < 0) { |
| 9706 | alc_free(codec); |
| 9707 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9708 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9709 | printk(KERN_INFO |
| 9710 | "hda_codec: Cannot set up configuration " |
| 9711 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9712 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9713 | } |
| 9714 | } |
| 9715 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9716 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9717 | if (err < 0) { |
| 9718 | alc_free(codec); |
| 9719 | return err; |
| 9720 | } |
| 9721 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9722 | if (board_config != ALC882_AUTO) |
| 9723 | setup_preset(spec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9724 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9725 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 9726 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 9727 | /* FIXME: setup DAC5 */ |
| 9728 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 9729 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 9730 | |
| 9731 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 9732 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 9733 | |
| 9734 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9735 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9736 | |
| 9737 | if (!spec->adc_nids && spec->input_mux) { |
| 9738 | int i; |
| 9739 | spec->num_adc_nids = 0; |
| 9740 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
| 9741 | hda_nid_t cap; |
| 9742 | hda_nid_t nid = alc882_adc_nids[i]; |
| 9743 | unsigned int wcap = get_wcaps(codec, nid); |
| 9744 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 9745 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9746 | if (wcap != AC_WID_AUD_IN) |
| 9747 | continue; |
| 9748 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 9749 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 9750 | if (err < 0) |
| 9751 | continue; |
| 9752 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 9753 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9754 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9755 | spec->adc_nids = spec->private_adc_nids; |
| 9756 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9757 | } |
| 9758 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 9759 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9760 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9761 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9762 | spec->vmaster_nid = 0x0c; |
| 9763 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9764 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9765 | if (board_config == ALC882_AUTO) |
| 9766 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9767 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9768 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9769 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9770 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9771 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9772 | |
| 9773 | return 0; |
| 9774 | } |
| 9775 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9776 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9777 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9778 | * ALC262 support |
| 9779 | */ |
| 9780 | |
| 9781 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9782 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9783 | |
| 9784 | #define alc262_dac_nids alc260_dac_nids |
| 9785 | #define alc262_adc_nids alc882_adc_nids |
| 9786 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9787 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9788 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9789 | |
| 9790 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9791 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9792 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9793 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9794 | /* ADC0 */ |
| 9795 | 0x09 |
| 9796 | }; |
| 9797 | |
| 9798 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9799 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9800 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9801 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9802 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9803 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9804 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9805 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9806 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9807 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9808 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9809 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9810 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9811 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9812 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9813 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9814 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9815 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9816 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9817 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9818 | }; |
| 9819 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9820 | /* update HP, line and mono-out pins according to the master switch */ |
| 9821 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9822 | { |
| 9823 | struct alc_spec *spec = codec->spec; |
| 9824 | int val = spec->master_sw; |
| 9825 | |
| 9826 | /* HP & line-out */ |
| 9827 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9828 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9829 | val ? PIN_HP : 0); |
| 9830 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9831 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9832 | val ? PIN_HP : 0); |
| 9833 | /* mono (speaker) depending on the HP jack sense */ |
| 9834 | val = val && !spec->jack_present; |
| 9835 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9836 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9837 | val ? PIN_OUT : 0); |
| 9838 | } |
| 9839 | |
| 9840 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9841 | { |
| 9842 | struct alc_spec *spec = codec->spec; |
| 9843 | unsigned int presence; |
| 9844 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9845 | AC_VERB_GET_PIN_SENSE, 0); |
| 9846 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9847 | alc262_hp_master_update(codec); |
| 9848 | } |
| 9849 | |
| 9850 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9851 | { |
| 9852 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9853 | return; |
| 9854 | alc262_hp_bpc_automute(codec); |
| 9855 | } |
| 9856 | |
| 9857 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9858 | { |
| 9859 | struct alc_spec *spec = codec->spec; |
| 9860 | unsigned int presence; |
| 9861 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9862 | AC_VERB_GET_PIN_SENSE, 0); |
| 9863 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9864 | alc262_hp_master_update(codec); |
| 9865 | } |
| 9866 | |
| 9867 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9868 | unsigned int res) |
| 9869 | { |
| 9870 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9871 | return; |
| 9872 | alc262_hp_wildwest_automute(codec); |
| 9873 | } |
| 9874 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9875 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9876 | |
| 9877 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9878 | struct snd_ctl_elem_value *ucontrol) |
| 9879 | { |
| 9880 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9881 | struct alc_spec *spec = codec->spec; |
| 9882 | int val = !!*ucontrol->value.integer.value; |
| 9883 | |
| 9884 | if (val == spec->master_sw) |
| 9885 | return 0; |
| 9886 | spec->master_sw = val; |
| 9887 | alc262_hp_master_update(codec); |
| 9888 | return 1; |
| 9889 | } |
| 9890 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9891 | #define ALC262_HP_MASTER_SWITCH \ |
| 9892 | { \ |
| 9893 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9894 | .name = "Master Playback Switch", \ |
| 9895 | .info = snd_ctl_boolean_mono_info, \ |
| 9896 | .get = alc262_hp_master_sw_get, \ |
| 9897 | .put = alc262_hp_master_sw_put, \ |
| 9898 | } |
| 9899 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9900 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9901 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9902 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9903 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9904 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9905 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9906 | HDA_OUTPUT), |
| 9907 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9908 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9909 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9910 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9911 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9912 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9913 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9914 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9915 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9916 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9917 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9918 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9919 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9920 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9921 | { } /* end */ |
| 9922 | }; |
| 9923 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9924 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9925 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9926 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9927 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9928 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9929 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9930 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9931 | HDA_OUTPUT), |
| 9932 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9933 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9934 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9935 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9936 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9937 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9938 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9939 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9940 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9941 | { } /* end */ |
| 9942 | }; |
| 9943 | |
| 9944 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9945 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9946 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9947 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9948 | { } /* end */ |
| 9949 | }; |
| 9950 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9951 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9952 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9953 | { |
| 9954 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9955 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9956 | spec->autocfg.hp_pins[0] = 0x15; |
| 9957 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
| 9958 | alc_automute_amp(codec); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9959 | } |
| 9960 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9961 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9962 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9963 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9964 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9965 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9966 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9967 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9968 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9969 | { } /* end */ |
| 9970 | }; |
| 9971 | |
| 9972 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9973 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9974 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9975 | |
| 9976 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9977 | { } |
| 9978 | }; |
| 9979 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9980 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9981 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9982 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9983 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9984 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9985 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9986 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9987 | { } /* end */ |
| 9988 | }; |
| 9989 | |
| 9990 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9991 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9992 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9993 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9994 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9995 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9996 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9997 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9998 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9999 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10000 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10001 | {} |
| 10002 | }; |
| 10003 | |
| 10004 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10005 | .num_items = 1, |
| 10006 | .items = { |
| 10007 | { "Line", 0x1 }, |
| 10008 | }, |
| 10009 | }; |
| 10010 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10011 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10012 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10013 | { |
| 10014 | struct alc_spec *spec = codec->spec; |
| 10015 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10016 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10017 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10018 | unsigned int mute; |
| 10019 | |
| 10020 | /* HP */ |
| 10021 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10022 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10023 | HDA_AMP_MUTE, mute); |
| 10024 | /* mute internal speaker per jack sense */ |
| 10025 | if (spec->jack_present) |
| 10026 | mute = HDA_AMP_MUTE; |
| 10027 | if (line_nid) |
| 10028 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10029 | HDA_AMP_MUTE, mute); |
| 10030 | if (speaker_nid && speaker_nid != line_nid) |
| 10031 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10032 | HDA_AMP_MUTE, mute); |
| 10033 | } |
| 10034 | |
| 10035 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10036 | |
| 10037 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10038 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10039 | { |
| 10040 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10041 | struct alc_spec *spec = codec->spec; |
| 10042 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10043 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10044 | if (val == spec->master_sw) |
| 10045 | return 0; |
| 10046 | spec->master_sw = val; |
| 10047 | alc262_hippo_master_update(codec); |
| 10048 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10049 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10050 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10051 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10052 | { \ |
| 10053 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10054 | .name = "Master Playback Switch", \ |
| 10055 | .info = snd_ctl_boolean_mono_info, \ |
| 10056 | .get = alc262_hippo_master_sw_get, \ |
| 10057 | .put = alc262_hippo_master_sw_put, \ |
| 10058 | } |
| 10059 | |
| 10060 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10061 | ALC262_HIPPO_MASTER_SWITCH, |
| 10062 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10063 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10064 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10065 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10066 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10067 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10068 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10069 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10070 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10071 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10072 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10073 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10074 | { } /* end */ |
| 10075 | }; |
| 10076 | |
| 10077 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10078 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10079 | ALC262_HIPPO_MASTER_SWITCH, |
| 10080 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10081 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10082 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10083 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10084 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10085 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10086 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10087 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10088 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10089 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10090 | { } /* end */ |
| 10091 | }; |
| 10092 | |
| 10093 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10094 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10095 | { |
| 10096 | struct alc_spec *spec = codec->spec; |
| 10097 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10098 | unsigned int present; |
| 10099 | |
| 10100 | /* need to execute and sync at first */ |
| 10101 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10102 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 10103 | AC_VERB_GET_PIN_SENSE, 0); |
| 10104 | spec->jack_present = (present & 0x80000000) != 0; |
| 10105 | alc262_hippo_master_update(codec); |
| 10106 | } |
| 10107 | |
| 10108 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10109 | { |
| 10110 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10111 | return; |
| 10112 | alc262_hippo_automute(codec); |
| 10113 | } |
| 10114 | |
| 10115 | static void alc262_hippo_init_hook(struct hda_codec *codec) |
| 10116 | { |
| 10117 | struct alc_spec *spec = codec->spec; |
| 10118 | |
| 10119 | spec->autocfg.hp_pins[0] = 0x15; |
| 10120 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10121 | alc262_hippo_automute(codec); |
| 10122 | } |
| 10123 | |
| 10124 | static void alc262_hippo1_init_hook(struct hda_codec *codec) |
| 10125 | { |
| 10126 | struct alc_spec *spec = codec->spec; |
| 10127 | |
| 10128 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10129 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10130 | alc262_hippo_automute(codec); |
| 10131 | } |
| 10132 | |
| 10133 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10134 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10135 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10136 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10137 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10138 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10139 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10140 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10141 | { } /* end */ |
| 10142 | }; |
| 10143 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10144 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10145 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10146 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10147 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10148 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10149 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10150 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10151 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10152 | { } /* end */ |
| 10153 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10154 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10155 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10156 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10157 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10158 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10159 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10160 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10161 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10162 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10164 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10165 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10166 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10167 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10168 | { } /* end */ |
| 10169 | }; |
| 10170 | |
| 10171 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10172 | /* Headphone automute */ |
| 10173 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10174 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10175 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10176 | |
| 10177 | /* P11 AUX_IN, white 4-pin connector */ |
| 10178 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10179 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10180 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10181 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10182 | |
| 10183 | {} |
| 10184 | }; |
| 10185 | |
| 10186 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10187 | static void alc262_tyan_init_hook(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10188 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10189 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10190 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10191 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10192 | spec->autocfg.speaker_pins[0] = 0x15; |
| 10193 | alc_automute_amp(codec); |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10194 | } |
| 10195 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10196 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10197 | #define alc262_capture_mixer alc882_capture_mixer |
| 10198 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10199 | |
| 10200 | /* |
| 10201 | * generic initialization of ADC, input mixers and output mixers |
| 10202 | */ |
| 10203 | static struct hda_verb alc262_init_verbs[] = { |
| 10204 | /* |
| 10205 | * Unmute ADC0-2 and set the default input to mic-in |
| 10206 | */ |
| 10207 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10208 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10209 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10210 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10211 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10212 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10213 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10214 | /* 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] | 10215 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10216 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10217 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10218 | */ |
| 10219 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10220 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10221 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10222 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10223 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10224 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10225 | |
| 10226 | /* |
| 10227 | * Set up output mixers (0x0c - 0x0e) |
| 10228 | */ |
| 10229 | /* set vol=0 to output mixers */ |
| 10230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10231 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10232 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10233 | /* set up input amps for analog loopback */ |
| 10234 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10235 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10236 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10237 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10238 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10239 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10240 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10241 | |
| 10242 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10243 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10244 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10245 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10246 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10247 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10248 | |
| 10249 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10250 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10251 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10252 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10253 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10254 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10255 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10256 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10257 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10258 | /* FIXME: use matrix-type input source selection */ |
| 10259 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10260 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10261 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10262 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10263 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10264 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10265 | /* Input mixer2 */ |
| 10266 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10267 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10268 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10269 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10270 | /* Input mixer3 */ |
| 10271 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10272 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10273 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10274 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10275 | |
| 10276 | { } |
| 10277 | }; |
| 10278 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10279 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10280 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10281 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10282 | { } |
| 10283 | }; |
| 10284 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10285 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10286 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10287 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10288 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10289 | |
| 10290 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10291 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10292 | {} |
| 10293 | }; |
| 10294 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10295 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10296 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10297 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10298 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10299 | |
| 10300 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10301 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10302 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10303 | }; |
| 10304 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10305 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 10306 | .num_items = 2, |
| 10307 | .items = { |
| 10308 | { "Int DMic", 0x9 }, |
| 10309 | { "Mic", 0x0 }, |
| 10310 | }, |
| 10311 | }; |
| 10312 | |
| 10313 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10314 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10315 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10316 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10317 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10318 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10319 | { } /* end */ |
| 10320 | }; |
| 10321 | |
| 10322 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10323 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10324 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10325 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10326 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10327 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10328 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10329 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10330 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10331 | {} |
| 10332 | }; |
| 10333 | |
| 10334 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 10335 | { |
| 10336 | unsigned int present; |
| 10337 | |
| 10338 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10339 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10340 | snd_hda_codec_write(codec, 0x22, 0, |
| 10341 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 10342 | } |
| 10343 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10344 | |
| 10345 | /* unsolicited event for HP jack sensing */ |
| 10346 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 10347 | unsigned int res) |
| 10348 | { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10349 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10350 | alc262_dmic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10351 | else |
| 10352 | alc_sku_unsol_event(codec, res); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10353 | } |
| 10354 | |
| 10355 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 10356 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10357 | struct alc_spec *spec = codec->spec; |
| 10358 | |
| 10359 | spec->autocfg.hp_pins[0] = 0x15; |
| 10360 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10361 | alc_automute_pin(codec); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10362 | alc262_dmic_automute(codec); |
| 10363 | } |
| 10364 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10365 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10366 | * nec model |
| 10367 | * 0x15 = headphone |
| 10368 | * 0x16 = internal speaker |
| 10369 | * 0x18 = external mic |
| 10370 | */ |
| 10371 | |
| 10372 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10373 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10374 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10375 | |
| 10376 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10377 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10378 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10379 | |
| 10380 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10381 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10382 | { } /* end */ |
| 10383 | }; |
| 10384 | |
| 10385 | static struct hda_verb alc262_nec_verbs[] = { |
| 10386 | /* Unmute Speaker */ |
| 10387 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10388 | |
| 10389 | /* Headphone */ |
| 10390 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10392 | |
| 10393 | /* External mic to headphone */ |
| 10394 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10395 | /* External mic to speaker */ |
| 10396 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10397 | {} |
| 10398 | }; |
| 10399 | |
| 10400 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10401 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10402 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10403 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10404 | */ |
| 10405 | |
| 10406 | #define ALC_HP_EVENT 0x37 |
| 10407 | |
| 10408 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10409 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10410 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10411 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10412 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10413 | {} |
| 10414 | }; |
| 10415 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10416 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10417 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10418 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10419 | {} |
| 10420 | }; |
| 10421 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10422 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10423 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10424 | .items = { |
| 10425 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10426 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10427 | { "CD", 0x4 }, |
| 10428 | }, |
| 10429 | }; |
| 10430 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10431 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10432 | .num_items = 5, |
| 10433 | .items = { |
| 10434 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10435 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10436 | { "Line", 0x2 }, |
| 10437 | { "CD", 0x4 }, |
| 10438 | { "AUX IN", 0x6 }, |
| 10439 | }, |
| 10440 | }; |
| 10441 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10442 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10443 | .num_items = 4, |
| 10444 | .items = { |
| 10445 | { "Mic", 0x0 }, |
| 10446 | { "Front Mic", 0x2 }, |
| 10447 | { "Line", 0x1 }, |
| 10448 | { "CD", 0x4 }, |
| 10449 | }, |
| 10450 | }; |
| 10451 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10452 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10453 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10454 | { |
| 10455 | struct alc_spec *spec = codec->spec; |
| 10456 | unsigned int mute; |
| 10457 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10458 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10459 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10460 | /* need to execute and sync at first */ |
| 10461 | 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] | 10462 | /* check laptop HP jack */ |
| 10463 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10464 | AC_VERB_GET_PIN_SENSE, 0); |
| 10465 | /* need to execute and sync at first */ |
| 10466 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10467 | /* check docking HP jack */ |
| 10468 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10469 | AC_VERB_GET_PIN_SENSE, 0); |
| 10470 | if (present & AC_PINSENSE_PRESENCE) |
| 10471 | spec->jack_present = 1; |
| 10472 | else |
| 10473 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10474 | spec->sense_updated = 1; |
| 10475 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10476 | /* unmute internal speaker only if both HPs are unplugged and |
| 10477 | * master switch is on |
| 10478 | */ |
| 10479 | if (spec->jack_present) |
| 10480 | mute = HDA_AMP_MUTE; |
| 10481 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10482 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10483 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10484 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10485 | } |
| 10486 | |
| 10487 | /* unsolicited event for HP jack sensing */ |
| 10488 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10489 | unsigned int res) |
| 10490 | { |
| 10491 | if ((res >> 26) != ALC_HP_EVENT) |
| 10492 | return; |
| 10493 | alc262_fujitsu_automute(codec, 1); |
| 10494 | } |
| 10495 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10496 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10497 | { |
| 10498 | alc262_fujitsu_automute(codec, 1); |
| 10499 | } |
| 10500 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10501 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10502 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10503 | .ops = &snd_hda_bind_vol, |
| 10504 | .values = { |
| 10505 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10506 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10507 | 0 |
| 10508 | }, |
| 10509 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10510 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10511 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10512 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10513 | { |
| 10514 | struct alc_spec *spec = codec->spec; |
| 10515 | unsigned int mute; |
| 10516 | |
| 10517 | if (force || !spec->sense_updated) { |
| 10518 | unsigned int present_int_hp; |
| 10519 | /* need to execute and sync at first */ |
| 10520 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10521 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10522 | AC_VERB_GET_PIN_SENSE, 0); |
| 10523 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10524 | spec->sense_updated = 1; |
| 10525 | } |
| 10526 | if (spec->jack_present) { |
| 10527 | /* mute internal speaker */ |
| 10528 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10529 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10530 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10531 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10532 | } else { |
| 10533 | /* unmute internal speaker if necessary */ |
| 10534 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10535 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10536 | HDA_AMP_MUTE, mute); |
| 10537 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10538 | HDA_AMP_MUTE, mute); |
| 10539 | } |
| 10540 | } |
| 10541 | |
| 10542 | /* unsolicited event for HP jack sensing */ |
| 10543 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10544 | unsigned int res) |
| 10545 | { |
| 10546 | if ((res >> 26) != ALC_HP_EVENT) |
| 10547 | return; |
| 10548 | alc262_lenovo_3000_automute(codec, 1); |
| 10549 | } |
| 10550 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10551 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 10552 | int dir, int idx, long *valp) |
| 10553 | { |
| 10554 | int i, change = 0; |
| 10555 | |
| 10556 | for (i = 0; i < 2; i++, valp++) |
| 10557 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 10558 | HDA_AMP_MUTE, |
| 10559 | *valp ? 0 : HDA_AMP_MUTE); |
| 10560 | return change; |
| 10561 | } |
| 10562 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10563 | /* bind hp and internal speaker mute (with plug check) */ |
| 10564 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10565 | struct snd_ctl_elem_value *ucontrol) |
| 10566 | { |
| 10567 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10568 | long *valp = ucontrol->value.integer.value; |
| 10569 | int change; |
| 10570 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10571 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 10572 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10573 | if (change) |
| 10574 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10575 | return change; |
| 10576 | } |
| 10577 | |
| 10578 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10579 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10580 | { |
| 10581 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10582 | .name = "Master Playback Switch", |
| 10583 | .info = snd_hda_mixer_amp_switch_info, |
| 10584 | .get = snd_hda_mixer_amp_switch_get, |
| 10585 | .put = alc262_fujitsu_master_sw_put, |
| 10586 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10587 | }, |
| 10588 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10589 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10590 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10591 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10592 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10593 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10594 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10595 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10596 | { } /* end */ |
| 10597 | }; |
| 10598 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10599 | /* bind hp and internal speaker mute (with plug check) */ |
| 10600 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10601 | struct snd_ctl_elem_value *ucontrol) |
| 10602 | { |
| 10603 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10604 | long *valp = ucontrol->value.integer.value; |
| 10605 | int change; |
| 10606 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10607 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10608 | if (change) |
| 10609 | alc262_lenovo_3000_automute(codec, 0); |
| 10610 | return change; |
| 10611 | } |
| 10612 | |
| 10613 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10614 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10615 | { |
| 10616 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10617 | .name = "Master Playback Switch", |
| 10618 | .info = snd_hda_mixer_amp_switch_info, |
| 10619 | .get = snd_hda_mixer_amp_switch_get, |
| 10620 | .put = alc262_lenovo_3000_master_sw_put, |
| 10621 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10622 | }, |
| 10623 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10624 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10625 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10626 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10627 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10628 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10629 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10630 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10631 | { } /* end */ |
| 10632 | }; |
| 10633 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10634 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10635 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10636 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10637 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10638 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10639 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10640 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10641 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10642 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10643 | { } /* end */ |
| 10644 | }; |
| 10645 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10646 | /* additional init verbs for Benq laptops */ |
| 10647 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10648 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10649 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10650 | {} |
| 10651 | }; |
| 10652 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10653 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10654 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10655 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10656 | |
| 10657 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10658 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10659 | {} |
| 10660 | }; |
| 10661 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10662 | /* Samsung Q1 Ultra Vista model setup */ |
| 10663 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10664 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10665 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10666 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10667 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10668 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10669 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10670 | { } /* end */ |
| 10671 | }; |
| 10672 | |
| 10673 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10674 | /* output mixer */ |
| 10675 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10676 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10677 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10678 | /* speaker */ |
| 10679 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10680 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10681 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10682 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10683 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10684 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10685 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10686 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10687 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10688 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10689 | /* internal mic */ |
| 10690 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10691 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10692 | /* ADC, choose mic */ |
| 10693 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10694 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10695 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10696 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10697 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10698 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10699 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10700 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10701 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10702 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10703 | {} |
| 10704 | }; |
| 10705 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10706 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10707 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10708 | { |
| 10709 | struct alc_spec *spec = codec->spec; |
| 10710 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10711 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10712 | mute = 0; |
| 10713 | /* auto-mute only when HP is used as HP */ |
| 10714 | if (!spec->cur_mux[0]) { |
| 10715 | unsigned int present; |
| 10716 | /* need to execute and sync at first */ |
| 10717 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10718 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10719 | AC_VERB_GET_PIN_SENSE, 0); |
| 10720 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10721 | if (spec->jack_present) |
| 10722 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10723 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10724 | /* mute/unmute internal speaker */ |
| 10725 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10726 | HDA_AMP_MUTE, mute); |
| 10727 | /* mute/unmute HP */ |
| 10728 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10729 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10730 | } |
| 10731 | |
| 10732 | /* unsolicited event for HP jack sensing */ |
| 10733 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10734 | unsigned int res) |
| 10735 | { |
| 10736 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10737 | return; |
| 10738 | alc262_ultra_automute(codec); |
| 10739 | } |
| 10740 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10741 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10742 | .num_items = 2, |
| 10743 | .items = { |
| 10744 | { "Mic", 0x1 }, |
| 10745 | { "Headphone", 0x7 }, |
| 10746 | }, |
| 10747 | }; |
| 10748 | |
| 10749 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10750 | struct snd_ctl_elem_value *ucontrol) |
| 10751 | { |
| 10752 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10753 | struct alc_spec *spec = codec->spec; |
| 10754 | int ret; |
| 10755 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10756 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10757 | if (!ret) |
| 10758 | return 0; |
| 10759 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10760 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10761 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10762 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10763 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10764 | return ret; |
| 10765 | } |
| 10766 | |
| 10767 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10768 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10769 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10770 | { |
| 10771 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10772 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10773 | .info = alc_mux_enum_info, |
| 10774 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10775 | .put = alc262_ultra_mux_enum_put, |
| 10776 | }, |
| 10777 | { } /* end */ |
| 10778 | }; |
| 10779 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10780 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10781 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10782 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10783 | { |
| 10784 | hda_nid_t nid; |
| 10785 | int err; |
| 10786 | |
| 10787 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10788 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10789 | spec->multiout.dac_nids[0] = 2; |
| 10790 | |
| 10791 | nid = cfg->line_out_pins[0]; |
| 10792 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10793 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10794 | "Front Playback Volume", |
| 10795 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10796 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10797 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10798 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10799 | "Front Playback Switch", |
| 10800 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10801 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10802 | return err; |
| 10803 | } |
| 10804 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10805 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10806 | if (nid) { |
| 10807 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10808 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10809 | "Speaker Playback Volume", |
| 10810 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10811 | HDA_OUTPUT)); |
| 10812 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10813 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10814 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10815 | "Speaker Playback Switch", |
| 10816 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10817 | HDA_OUTPUT)); |
| 10818 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10819 | return err; |
| 10820 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10821 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10822 | "Speaker Playback Switch", |
| 10823 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10824 | HDA_OUTPUT)); |
| 10825 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10826 | return err; |
| 10827 | } |
| 10828 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10829 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10830 | if (nid) { |
| 10831 | /* spec->multiout.hp_nid = 2; */ |
| 10832 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10833 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10834 | "Headphone Playback Volume", |
| 10835 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10836 | HDA_OUTPUT)); |
| 10837 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10838 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10839 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10840 | "Headphone Playback Switch", |
| 10841 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10842 | HDA_OUTPUT)); |
| 10843 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10844 | return err; |
| 10845 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10846 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10847 | "Headphone Playback Switch", |
| 10848 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10849 | HDA_OUTPUT)); |
| 10850 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10851 | return err; |
| 10852 | } |
| 10853 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10854 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10855 | } |
| 10856 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 10857 | static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10858 | const struct auto_pin_cfg *cfg) |
| 10859 | { |
| 10860 | int err; |
| 10861 | |
| 10862 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 10863 | if (err < 0) |
| 10864 | return err; |
| 10865 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 10866 | * because it's under 0x18 |
| 10867 | */ |
| 10868 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 10869 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 10870 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 10871 | imux->items[imux->num_items].label = "Int Mic"; |
| 10872 | imux->items[imux->num_items].index = 0x09; |
| 10873 | imux->num_items++; |
| 10874 | } |
| 10875 | return 0; |
| 10876 | } |
| 10877 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10878 | |
| 10879 | /* |
| 10880 | * generic initialization of ADC, input mixers and output mixers |
| 10881 | */ |
| 10882 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10883 | /* |
| 10884 | * Unmute ADC0-2 and set the default input to mic-in |
| 10885 | */ |
| 10886 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10887 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10888 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10889 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10890 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10891 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10892 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10893 | /* 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] | 10894 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10895 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10896 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10897 | */ |
| 10898 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10899 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10900 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10901 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10902 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10903 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10904 | |
| 10905 | /* |
| 10906 | * Set up output mixers (0x0c - 0x0f) |
| 10907 | */ |
| 10908 | /* set vol=0 to output mixers */ |
| 10909 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10910 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10911 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10912 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10913 | /* set up input amps for analog loopback */ |
| 10914 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10915 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10916 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10917 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10918 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10919 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10920 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10921 | |
| 10922 | /* FIXME: use matrix-type input source selection */ |
| 10923 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10924 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10925 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10926 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10927 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10928 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10929 | /* Input mixer2 */ |
| 10930 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10931 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10932 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10933 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10934 | /* Input mixer3 */ |
| 10935 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10936 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10937 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10938 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10939 | |
| 10940 | { } |
| 10941 | }; |
| 10942 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10943 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10944 | /* |
| 10945 | * Unmute ADC0-2 and set the default input to mic-in |
| 10946 | */ |
| 10947 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10948 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10949 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10950 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10951 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10952 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10953 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10954 | /* 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] | 10955 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10956 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10957 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10958 | */ |
| 10959 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10960 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10961 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10962 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10963 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10964 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10965 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10966 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10967 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10968 | /* |
| 10969 | * Set up output mixers (0x0c - 0x0e) |
| 10970 | */ |
| 10971 | /* set vol=0 to output mixers */ |
| 10972 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10973 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10974 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10975 | |
| 10976 | /* set up input amps for analog loopback */ |
| 10977 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10978 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10979 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10980 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10981 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10982 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10983 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10984 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10985 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10986 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10987 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10988 | |
| 10989 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10990 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10991 | |
| 10992 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10993 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10994 | |
| 10995 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10996 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10997 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10998 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10999 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11000 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11001 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11002 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11003 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11004 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11005 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11006 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11007 | |
| 11008 | |
| 11009 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11010 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11011 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11012 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11013 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11014 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11015 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11016 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11017 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11018 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11019 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11020 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11021 | /* Input mixer2 */ |
| 11022 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11023 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11024 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11025 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11026 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11027 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11028 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11029 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11030 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11031 | /* Input mixer3 */ |
| 11032 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11033 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11034 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11035 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11036 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11037 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11038 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11039 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11040 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11041 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11042 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11043 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11044 | { } |
| 11045 | }; |
| 11046 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11047 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11048 | /* |
| 11049 | * Unmute ADC0-2 and set the default input to mic-in |
| 11050 | */ |
| 11051 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11052 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11053 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11054 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11055 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11056 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11057 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11058 | /* 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] | 11059 | * mixer widget |
| 11060 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11061 | * panel mic (mic 2) |
| 11062 | */ |
| 11063 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11064 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11065 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11066 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11067 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11068 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11069 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11070 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11071 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11072 | /* |
| 11073 | * Set up output mixers (0x0c - 0x0e) |
| 11074 | */ |
| 11075 | /* set vol=0 to output mixers */ |
| 11076 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11077 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11078 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11079 | |
| 11080 | /* set up input amps for analog loopback */ |
| 11081 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11082 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11083 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11084 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11085 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11086 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11087 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11088 | |
| 11089 | |
| 11090 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11091 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11092 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11093 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11094 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11095 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11096 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11097 | |
| 11098 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11099 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11100 | |
| 11101 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11102 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11103 | |
| 11104 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11105 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11106 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11107 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11108 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11109 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11110 | |
| 11111 | /* FIXME: use matrix-type input source selection */ |
| 11112 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11113 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11114 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11115 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11116 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11117 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11118 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11119 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11120 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11121 | /* Input mixer2 */ |
| 11122 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11123 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11124 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11125 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11126 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11127 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11128 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11129 | /* Input mixer3 */ |
| 11130 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11131 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11132 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11133 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11134 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11135 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11136 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11137 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11138 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11139 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11140 | { } |
| 11141 | }; |
| 11142 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11143 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11144 | |
| 11145 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11146 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11147 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11148 | |
| 11149 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11150 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11151 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11152 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11153 | |
| 11154 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11155 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11156 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11157 | {} |
| 11158 | }; |
| 11159 | |
| 11160 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11161 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11162 | #define alc262_loopbacks alc880_loopbacks |
| 11163 | #endif |
| 11164 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11165 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11166 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11167 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11168 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11169 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11170 | |
| 11171 | /* |
| 11172 | * BIOS auto configuration |
| 11173 | */ |
| 11174 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11175 | { |
| 11176 | struct alc_spec *spec = codec->spec; |
| 11177 | int err; |
| 11178 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11179 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11180 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11181 | alc262_ignore); |
| 11182 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11183 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11184 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11185 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11186 | spec->multiout.max_channels = 2; |
| 11187 | spec->no_analog = 1; |
| 11188 | goto dig_only; |
| 11189 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11190 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11191 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11192 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11193 | if (err < 0) |
| 11194 | return err; |
| 11195 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11196 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11197 | return err; |
| 11198 | |
| 11199 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11200 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11201 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11202 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11203 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11204 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11205 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11206 | if (spec->autocfg.dig_in_pin) |
| 11207 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11208 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11209 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11210 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11211 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11212 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11213 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11214 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11215 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11216 | err = alc_auto_add_mic_boost(codec); |
| 11217 | if (err < 0) |
| 11218 | return err; |
| 11219 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11220 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11221 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11222 | return 1; |
| 11223 | } |
| 11224 | |
| 11225 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11226 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11227 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11228 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11229 | |
| 11230 | |
| 11231 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11232 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11233 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11234 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11235 | alc262_auto_init_multi_out(codec); |
| 11236 | alc262_auto_init_hp_out(codec); |
| 11237 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11238 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11239 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11240 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11241 | } |
| 11242 | |
| 11243 | /* |
| 11244 | * configuration and preset |
| 11245 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11246 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11247 | [ALC262_BASIC] = "basic", |
| 11248 | [ALC262_HIPPO] = "hippo", |
| 11249 | [ALC262_HIPPO_1] = "hippo_1", |
| 11250 | [ALC262_FUJITSU] = "fujitsu", |
| 11251 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11252 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11253 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11254 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11255 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11256 | [ALC262_BENQ_T31] = "benq-t31", |
| 11257 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11258 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11259 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11260 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11261 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11262 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11263 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11264 | [ALC262_AUTO] = "auto", |
| 11265 | }; |
| 11266 | |
| 11267 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11268 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11269 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11270 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11271 | ALC262_HP_BPC), |
| 11272 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11273 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11274 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11275 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11276 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11277 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11278 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11279 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11280 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11281 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11282 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11283 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11284 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11285 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11286 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11287 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11288 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11289 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11290 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11291 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11292 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11293 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11294 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11295 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11296 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11297 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11298 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11299 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11300 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11301 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11302 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11303 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11304 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11305 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11306 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11307 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11308 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11309 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11310 | {} |
| 11311 | }; |
| 11312 | |
| 11313 | static struct alc_config_preset alc262_presets[] = { |
| 11314 | [ALC262_BASIC] = { |
| 11315 | .mixers = { alc262_base_mixer }, |
| 11316 | .init_verbs = { alc262_init_verbs }, |
| 11317 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11318 | .dac_nids = alc262_dac_nids, |
| 11319 | .hp_nid = 0x03, |
| 11320 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11321 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11322 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11323 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11324 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11325 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11326 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11327 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11328 | .dac_nids = alc262_dac_nids, |
| 11329 | .hp_nid = 0x03, |
| 11330 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11331 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11332 | .channel_mode = alc262_modes, |
| 11333 | .input_mux = &alc262_capture_source, |
| 11334 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11335 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11336 | }, |
| 11337 | [ALC262_HIPPO_1] = { |
| 11338 | .mixers = { alc262_hippo1_mixer }, |
| 11339 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11340 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11341 | .dac_nids = alc262_dac_nids, |
| 11342 | .hp_nid = 0x02, |
| 11343 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11344 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11345 | .channel_mode = alc262_modes, |
| 11346 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11347 | .unsol_event = alc262_hippo_unsol_event, |
| 11348 | .init_hook = alc262_hippo1_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11349 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11350 | [ALC262_FUJITSU] = { |
| 11351 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11352 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11353 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11354 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11355 | .dac_nids = alc262_dac_nids, |
| 11356 | .hp_nid = 0x03, |
| 11357 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11358 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11359 | .channel_mode = alc262_modes, |
| 11360 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11361 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11362 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11363 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11364 | [ALC262_HP_BPC] = { |
| 11365 | .mixers = { alc262_HP_BPC_mixer }, |
| 11366 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11367 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11368 | .dac_nids = alc262_dac_nids, |
| 11369 | .hp_nid = 0x03, |
| 11370 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11371 | .channel_mode = alc262_modes, |
| 11372 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11373 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11374 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11375 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11376 | [ALC262_HP_BPC_D7000_WF] = { |
| 11377 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11378 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11379 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11380 | .dac_nids = alc262_dac_nids, |
| 11381 | .hp_nid = 0x03, |
| 11382 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11383 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11384 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11385 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11386 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11387 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11388 | [ALC262_HP_BPC_D7000_WL] = { |
| 11389 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11390 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11391 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11392 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11393 | .dac_nids = alc262_dac_nids, |
| 11394 | .hp_nid = 0x03, |
| 11395 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11396 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11397 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11398 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11399 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11400 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11401 | [ALC262_HP_TC_T5735] = { |
| 11402 | .mixers = { alc262_hp_t5735_mixer }, |
| 11403 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11404 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11405 | .dac_nids = alc262_dac_nids, |
| 11406 | .hp_nid = 0x03, |
| 11407 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11408 | .channel_mode = alc262_modes, |
| 11409 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11410 | .unsol_event = alc_automute_amp_unsol_event, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11411 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11412 | }, |
| 11413 | [ALC262_HP_RP5700] = { |
| 11414 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11415 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11416 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11417 | .dac_nids = alc262_dac_nids, |
| 11418 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11419 | .channel_mode = alc262_modes, |
| 11420 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11421 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11422 | [ALC262_BENQ_ED8] = { |
| 11423 | .mixers = { alc262_base_mixer }, |
| 11424 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11425 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11426 | .dac_nids = alc262_dac_nids, |
| 11427 | .hp_nid = 0x03, |
| 11428 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11429 | .channel_mode = alc262_modes, |
| 11430 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11431 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11432 | [ALC262_SONY_ASSAMD] = { |
| 11433 | .mixers = { alc262_sony_mixer }, |
| 11434 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11435 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11436 | .dac_nids = alc262_dac_nids, |
| 11437 | .hp_nid = 0x02, |
| 11438 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11439 | .channel_mode = alc262_modes, |
| 11440 | .input_mux = &alc262_capture_source, |
| 11441 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11442 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11443 | }, |
| 11444 | [ALC262_BENQ_T31] = { |
| 11445 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11446 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 11447 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11448 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11449 | .dac_nids = alc262_dac_nids, |
| 11450 | .hp_nid = 0x03, |
| 11451 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11452 | .channel_mode = alc262_modes, |
| 11453 | .input_mux = &alc262_capture_source, |
| 11454 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11455 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11456 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11457 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11458 | .mixers = { alc262_ultra_mixer }, |
| 11459 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11460 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11461 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11462 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11463 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11464 | .channel_mode = alc262_modes, |
| 11465 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11466 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11467 | .capsrc_nids = alc262_capsrc_nids, |
| 11468 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11469 | .unsol_event = alc262_ultra_unsol_event, |
| 11470 | .init_hook = alc262_ultra_automute, |
| 11471 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11472 | [ALC262_LENOVO_3000] = { |
| 11473 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11474 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11475 | alc262_lenovo_3000_unsol_verbs }, |
| 11476 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11477 | .dac_nids = alc262_dac_nids, |
| 11478 | .hp_nid = 0x03, |
| 11479 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11480 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11481 | .channel_mode = alc262_modes, |
| 11482 | .input_mux = &alc262_fujitsu_capture_source, |
| 11483 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11484 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11485 | [ALC262_NEC] = { |
| 11486 | .mixers = { alc262_nec_mixer }, |
| 11487 | .init_verbs = { alc262_nec_verbs }, |
| 11488 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11489 | .dac_nids = alc262_dac_nids, |
| 11490 | .hp_nid = 0x03, |
| 11491 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11492 | .channel_mode = alc262_modes, |
| 11493 | .input_mux = &alc262_capture_source, |
| 11494 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11495 | [ALC262_TOSHIBA_S06] = { |
| 11496 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11497 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11498 | alc262_eapd_verbs }, |
| 11499 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11500 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11501 | .dac_nids = alc262_dac_nids, |
| 11502 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11503 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11504 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11505 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11506 | .channel_mode = alc262_modes, |
| 11507 | .input_mux = &alc262_dmic_capture_source, |
| 11508 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11509 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11510 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11511 | [ALC262_TOSHIBA_RX1] = { |
| 11512 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11513 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11514 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11515 | .dac_nids = alc262_dac_nids, |
| 11516 | .hp_nid = 0x03, |
| 11517 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11518 | .channel_mode = alc262_modes, |
| 11519 | .input_mux = &alc262_capture_source, |
| 11520 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11521 | .init_hook = alc262_hippo_init_hook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11522 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11523 | [ALC262_TYAN] = { |
| 11524 | .mixers = { alc262_tyan_mixer }, |
| 11525 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11526 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11527 | .dac_nids = alc262_dac_nids, |
| 11528 | .hp_nid = 0x02, |
| 11529 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11530 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11531 | .channel_mode = alc262_modes, |
| 11532 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11533 | .unsol_event = alc_automute_amp_unsol_event, |
| 11534 | .init_hook = alc262_tyan_init_hook, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11535 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11536 | }; |
| 11537 | |
| 11538 | static int patch_alc262(struct hda_codec *codec) |
| 11539 | { |
| 11540 | struct alc_spec *spec; |
| 11541 | int board_config; |
| 11542 | int err; |
| 11543 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11544 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11545 | if (spec == NULL) |
| 11546 | return -ENOMEM; |
| 11547 | |
| 11548 | codec->spec = spec; |
| 11549 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11550 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11551 | * under-run |
| 11552 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11553 | { |
| 11554 | int tmp; |
| 11555 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11556 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11557 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11558 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11559 | } |
| 11560 | #endif |
| 11561 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11562 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11563 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11564 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11565 | alc262_models, |
| 11566 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11567 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11568 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11569 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 11570 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11571 | board_config = ALC262_AUTO; |
| 11572 | } |
| 11573 | |
| 11574 | if (board_config == ALC262_AUTO) { |
| 11575 | /* automatic parse from the BIOS config */ |
| 11576 | err = alc262_parse_auto_config(codec); |
| 11577 | if (err < 0) { |
| 11578 | alc_free(codec); |
| 11579 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11580 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11581 | printk(KERN_INFO |
| 11582 | "hda_codec: Cannot set up configuration " |
| 11583 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11584 | board_config = ALC262_BASIC; |
| 11585 | } |
| 11586 | } |
| 11587 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11588 | if (!spec->no_analog) { |
| 11589 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11590 | if (err < 0) { |
| 11591 | alc_free(codec); |
| 11592 | return err; |
| 11593 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11594 | } |
| 11595 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11596 | if (board_config != ALC262_AUTO) |
| 11597 | setup_preset(spec, &alc262_presets[board_config]); |
| 11598 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11599 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11600 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11601 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11602 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11603 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11604 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11605 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11606 | int i; |
| 11607 | /* check whether the digital-mic has to be supported */ |
| 11608 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11609 | if (spec->input_mux->items[i].index >= 9) |
| 11610 | break; |
| 11611 | } |
| 11612 | if (i < spec->input_mux->num_items) { |
| 11613 | /* use only ADC0 */ |
| 11614 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11615 | spec->num_adc_nids = 1; |
| 11616 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11617 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11618 | /* all analog inputs */ |
| 11619 | /* check whether NID 0x07 is valid */ |
| 11620 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11621 | |
| 11622 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11623 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11624 | if (wcap != AC_WID_AUD_IN) { |
| 11625 | spec->adc_nids = alc262_adc_nids_alt; |
| 11626 | spec->num_adc_nids = |
| 11627 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11628 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11629 | } else { |
| 11630 | spec->adc_nids = alc262_adc_nids; |
| 11631 | spec->num_adc_nids = |
| 11632 | ARRAY_SIZE(alc262_adc_nids); |
| 11633 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11634 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11635 | } |
| 11636 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11637 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11638 | set_capture_mixer(codec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11639 | if (!spec->no_analog) |
| 11640 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11641 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11642 | spec->vmaster_nid = 0x0c; |
| 11643 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11644 | codec->patch_ops = alc_patch_ops; |
| 11645 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11646 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11647 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11648 | if (!spec->loopback.amplist) |
| 11649 | spec->loopback.amplist = alc262_loopbacks; |
| 11650 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11651 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11652 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11653 | return 0; |
| 11654 | } |
| 11655 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11656 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11657 | * ALC268 channel source setting (2 channel) |
| 11658 | */ |
| 11659 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11660 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11661 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11662 | static hda_nid_t alc268_dac_nids[2] = { |
| 11663 | /* front, hp */ |
| 11664 | 0x02, 0x03 |
| 11665 | }; |
| 11666 | |
| 11667 | static hda_nid_t alc268_adc_nids[2] = { |
| 11668 | /* ADC0-1 */ |
| 11669 | 0x08, 0x07 |
| 11670 | }; |
| 11671 | |
| 11672 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11673 | /* ADC0 */ |
| 11674 | 0x08 |
| 11675 | }; |
| 11676 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11677 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11678 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11679 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11680 | /* output mixer control */ |
| 11681 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11682 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11683 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11684 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11685 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11686 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11687 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11688 | { } |
| 11689 | }; |
| 11690 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11691 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11692 | /* output mixer control */ |
| 11693 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11694 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11695 | ALC262_HIPPO_MASTER_SWITCH, |
| 11696 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11697 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11698 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11699 | { } |
| 11700 | }; |
| 11701 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11702 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11703 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11704 | .ops = &snd_hda_bind_sw, |
| 11705 | .values = { |
| 11706 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11707 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11708 | 0 |
| 11709 | }, |
| 11710 | }; |
| 11711 | |
| 11712 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11713 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11714 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11715 | { } |
| 11716 | }; |
| 11717 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11718 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11719 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11720 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11721 | { } |
| 11722 | }; |
| 11723 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11724 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11725 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11726 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11727 | { } /* end */ |
| 11728 | }; |
| 11729 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11730 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11731 | .num_items = 2, |
| 11732 | .items = { |
| 11733 | { "i-Mic", 0x6 }, |
| 11734 | { "E-Mic", 0x0 }, |
| 11735 | }, |
| 11736 | }; |
| 11737 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11738 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11739 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11740 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11741 | .ops = &snd_hda_bind_vol, |
| 11742 | .values = { |
| 11743 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11744 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11745 | 0 |
| 11746 | }, |
| 11747 | }; |
| 11748 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11749 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11750 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11751 | { |
| 11752 | struct alc_spec *spec = codec->spec; |
| 11753 | unsigned int mute; |
| 11754 | |
| 11755 | if (force || !spec->sense_updated) { |
| 11756 | unsigned int present; |
| 11757 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11758 | AC_VERB_GET_PIN_SENSE, 0); |
| 11759 | spec->jack_present = (present & 0x80000000) != 0; |
| 11760 | spec->sense_updated = 1; |
| 11761 | } |
| 11762 | if (spec->jack_present) |
| 11763 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11764 | else /* unmute internal speaker if necessary */ |
| 11765 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11766 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11767 | HDA_AMP_MUTE, mute); |
| 11768 | } |
| 11769 | |
| 11770 | |
| 11771 | /* bind hp and internal speaker mute (with plug check) */ |
| 11772 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11773 | struct snd_ctl_elem_value *ucontrol) |
| 11774 | { |
| 11775 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11776 | long *valp = ucontrol->value.integer.value; |
| 11777 | int change; |
| 11778 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11779 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11780 | if (change) |
| 11781 | alc268_acer_automute(codec, 0); |
| 11782 | return change; |
| 11783 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11784 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11785 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11786 | /* output mixer control */ |
| 11787 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11788 | { |
| 11789 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11790 | .name = "Master Playback Switch", |
| 11791 | .info = snd_hda_mixer_amp_switch_info, |
| 11792 | .get = snd_hda_mixer_amp_switch_get, |
| 11793 | .put = alc268_acer_master_sw_put, |
| 11794 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11795 | }, |
| 11796 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11797 | { } |
| 11798 | }; |
| 11799 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11800 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11801 | /* output mixer control */ |
| 11802 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11803 | { |
| 11804 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11805 | .name = "Master Playback Switch", |
| 11806 | .info = snd_hda_mixer_amp_switch_info, |
| 11807 | .get = snd_hda_mixer_amp_switch_get, |
| 11808 | .put = alc268_acer_master_sw_put, |
| 11809 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11810 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11811 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11812 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11813 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11814 | { } |
| 11815 | }; |
| 11816 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11817 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11818 | /* output mixer control */ |
| 11819 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11820 | { |
| 11821 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11822 | .name = "Master Playback Switch", |
| 11823 | .info = snd_hda_mixer_amp_switch_info, |
| 11824 | .get = snd_hda_mixer_amp_switch_get, |
| 11825 | .put = alc268_acer_master_sw_put, |
| 11826 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11827 | }, |
| 11828 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11829 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11830 | { } |
| 11831 | }; |
| 11832 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11833 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11834 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11835 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11836 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11837 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11838 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11839 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11840 | { } |
| 11841 | }; |
| 11842 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11843 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11844 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11845 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11846 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11847 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11848 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11849 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11850 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11851 | { } |
| 11852 | }; |
| 11853 | |
| 11854 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11855 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
| 11856 | #define alc268_toshiba_init_hook alc262_hippo_init_hook |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11857 | |
| 11858 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11859 | unsigned int res) |
| 11860 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11861 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11862 | return; |
| 11863 | alc268_acer_automute(codec, 1); |
| 11864 | } |
| 11865 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11866 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11867 | { |
| 11868 | alc268_acer_automute(codec, 1); |
| 11869 | } |
| 11870 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11871 | /* toggle speaker-output according to the hp-jack state */ |
| 11872 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11873 | { |
| 11874 | unsigned int present; |
| 11875 | unsigned char bits; |
| 11876 | |
| 11877 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11878 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11879 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11880 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11881 | AMP_IN_MUTE(0), bits); |
| 11882 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11883 | AMP_IN_MUTE(0), bits); |
| 11884 | } |
| 11885 | |
| 11886 | |
| 11887 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11888 | { |
| 11889 | unsigned int present; |
| 11890 | |
| 11891 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11892 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11893 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11894 | present ? 0x0 : 0x6); |
| 11895 | } |
| 11896 | |
| 11897 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11898 | unsigned int res) |
| 11899 | { |
| 11900 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11901 | alc268_aspire_one_speaker_automute(codec); |
| 11902 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11903 | alc268_acer_mic_automute(codec); |
| 11904 | } |
| 11905 | |
| 11906 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11907 | { |
| 11908 | alc268_aspire_one_speaker_automute(codec); |
| 11909 | alc268_acer_mic_automute(codec); |
| 11910 | } |
| 11911 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11912 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11913 | /* output mixer control */ |
| 11914 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11915 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11916 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11917 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11918 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11919 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11920 | { } |
| 11921 | }; |
| 11922 | |
| 11923 | static struct hda_verb alc268_dell_verbs[] = { |
| 11924 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11925 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11926 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11927 | { } |
| 11928 | }; |
| 11929 | |
| 11930 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11931 | static void alc268_dell_init_hook(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11932 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11933 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11934 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11935 | spec->autocfg.hp_pins[0] = 0x15; |
| 11936 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11937 | alc_automute_pin(codec); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11938 | } |
| 11939 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11940 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11941 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11942 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11943 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11944 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11945 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11946 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11947 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11948 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11949 | { } |
| 11950 | }; |
| 11951 | |
| 11952 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11953 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11954 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11955 | { } |
| 11956 | }; |
| 11957 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11958 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11959 | { |
| 11960 | unsigned int present; |
| 11961 | |
| 11962 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11963 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11964 | snd_hda_codec_write(codec, 0x23, 0, |
| 11965 | AC_VERB_SET_CONNECT_SEL, |
| 11966 | present ? 0x00 : 0x01); |
| 11967 | } |
| 11968 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11969 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11970 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11971 | struct alc_spec *spec = codec->spec; |
| 11972 | |
| 11973 | spec->autocfg.hp_pins[0] = 0x15; |
| 11974 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11975 | alc_automute_pin(codec); |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11976 | alc267_quanta_il1_mic_automute(codec); |
| 11977 | } |
| 11978 | |
| 11979 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11980 | unsigned int res) |
| 11981 | { |
| 11982 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11983 | case ALC880_MIC_EVENT: |
| 11984 | alc267_quanta_il1_mic_automute(codec); |
| 11985 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11986 | default: |
| 11987 | alc_sku_unsol_event(codec, res); |
| 11988 | break; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11989 | } |
| 11990 | } |
| 11991 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11992 | /* |
| 11993 | * generic initialization of ADC, input mixers and output mixers |
| 11994 | */ |
| 11995 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11996 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11997 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11998 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11999 | |
| 12000 | /* |
| 12001 | * Set up output mixers (0x0c - 0x0e) |
| 12002 | */ |
| 12003 | /* set vol=0 to output mixers */ |
| 12004 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12005 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12006 | |
| 12007 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12008 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12009 | |
| 12010 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12011 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12012 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12013 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12014 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12015 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12016 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12017 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12018 | |
| 12019 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12020 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12021 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12022 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12023 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12024 | |
| 12025 | /* set PCBEEP vol = 0, mute connections */ |
| 12026 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12027 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12028 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12029 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12030 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12031 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12032 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12033 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12034 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12035 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12036 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12037 | { } |
| 12038 | }; |
| 12039 | |
| 12040 | /* |
| 12041 | * generic initialization of ADC, input mixers and output mixers |
| 12042 | */ |
| 12043 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12044 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12045 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12046 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12047 | |
| 12048 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12049 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12050 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12051 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12052 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12053 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12054 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12055 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12056 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12057 | |
| 12058 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12059 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12060 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12061 | /* set PCBEEP vol = 0, mute connections */ |
| 12062 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12063 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12064 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12065 | |
| 12066 | { } |
| 12067 | }; |
| 12068 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12069 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12070 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12071 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12072 | { |
| 12073 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12074 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12075 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12076 | */ |
| 12077 | /* .name = "Capture Source", */ |
| 12078 | .name = "Input Source", |
| 12079 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12080 | .info = alc_mux_enum_info, |
| 12081 | .get = alc_mux_enum_get, |
| 12082 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12083 | }, |
| 12084 | { } /* end */ |
| 12085 | }; |
| 12086 | |
| 12087 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12088 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12089 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12090 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12091 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12092 | { |
| 12093 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12094 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12095 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12096 | */ |
| 12097 | /* .name = "Capture Source", */ |
| 12098 | .name = "Input Source", |
| 12099 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12100 | .info = alc_mux_enum_info, |
| 12101 | .get = alc_mux_enum_get, |
| 12102 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12103 | }, |
| 12104 | { } /* end */ |
| 12105 | }; |
| 12106 | |
| 12107 | static struct hda_input_mux alc268_capture_source = { |
| 12108 | .num_items = 4, |
| 12109 | .items = { |
| 12110 | { "Mic", 0x0 }, |
| 12111 | { "Front Mic", 0x1 }, |
| 12112 | { "Line", 0x2 }, |
| 12113 | { "CD", 0x3 }, |
| 12114 | }, |
| 12115 | }; |
| 12116 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12117 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12118 | .num_items = 3, |
| 12119 | .items = { |
| 12120 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12121 | { "Internal Mic", 0x1 }, |
| 12122 | { "Line", 0x2 }, |
| 12123 | }, |
| 12124 | }; |
| 12125 | |
| 12126 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12127 | .num_items = 3, |
| 12128 | .items = { |
| 12129 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12130 | { "Internal Mic", 0x6 }, |
| 12131 | { "Line", 0x2 }, |
| 12132 | }, |
| 12133 | }; |
| 12134 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12135 | #ifdef CONFIG_SND_DEBUG |
| 12136 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12137 | /* Volume widgets */ |
| 12138 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12139 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12140 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12141 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12142 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12143 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12144 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12145 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12146 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12147 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12148 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12149 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12150 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12151 | /* The below appears problematic on some hardwares */ |
| 12152 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12153 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12154 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12155 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12156 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12157 | |
| 12158 | /* Modes for retasking pin widgets */ |
| 12159 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12160 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12161 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12162 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12163 | |
| 12164 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12165 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12166 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12167 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12168 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12169 | |
| 12170 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12171 | * The ALC268 does not have an SPDIF input. |
| 12172 | */ |
| 12173 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12174 | |
| 12175 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12176 | * this output to turn on an external amplifier. |
| 12177 | */ |
| 12178 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12179 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12180 | |
| 12181 | { } /* end */ |
| 12182 | }; |
| 12183 | #endif |
| 12184 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12185 | /* create input playback/capture controls for the given pin */ |
| 12186 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12187 | const char *ctlname, int idx) |
| 12188 | { |
| 12189 | char name[32]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12190 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12191 | int err; |
| 12192 | |
| 12193 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12194 | switch (nid) { |
| 12195 | case 0x14: |
| 12196 | case 0x16: |
| 12197 | dac = 0x02; |
| 12198 | break; |
| 12199 | case 0x15: |
| 12200 | dac = 0x03; |
| 12201 | break; |
| 12202 | default: |
| 12203 | return 0; |
| 12204 | } |
| 12205 | if (spec->multiout.dac_nids[0] != dac && |
| 12206 | spec->multiout.dac_nids[1] != dac) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12207 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12208 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12209 | HDA_OUTPUT)); |
| 12210 | if (err < 0) |
| 12211 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12212 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12213 | } |
| 12214 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12215 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12216 | if (nid != 0x16) |
| 12217 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12218 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12219 | else /* mono */ |
| 12220 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12221 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12222 | if (err < 0) |
| 12223 | return err; |
| 12224 | return 0; |
| 12225 | } |
| 12226 | |
| 12227 | /* add playback controls from the parsed DAC table */ |
| 12228 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12229 | const struct auto_pin_cfg *cfg) |
| 12230 | { |
| 12231 | hda_nid_t nid; |
| 12232 | int err; |
| 12233 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12234 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12235 | |
| 12236 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12237 | if (nid) { |
| 12238 | const char *name; |
| 12239 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12240 | name = "Speaker"; |
| 12241 | else |
| 12242 | name = "Front"; |
| 12243 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12244 | if (err < 0) |
| 12245 | return err; |
| 12246 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12247 | |
| 12248 | nid = cfg->speaker_pins[0]; |
| 12249 | if (nid == 0x1d) { |
| 12250 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12251 | "Speaker Playback Volume", |
| 12252 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12253 | if (err < 0) |
| 12254 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12255 | } else { |
| 12256 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12257 | if (err < 0) |
| 12258 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12259 | } |
| 12260 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12261 | if (nid) { |
| 12262 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12263 | if (err < 0) |
| 12264 | return err; |
| 12265 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12266 | |
| 12267 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12268 | if (nid == 0x16) { |
| 12269 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12270 | "Mono Playback Switch", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12271 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12272 | if (err < 0) |
| 12273 | return err; |
| 12274 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12275 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12276 | } |
| 12277 | |
| 12278 | /* create playback/capture controls for input pins */ |
| 12279 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12280 | const struct auto_pin_cfg *cfg) |
| 12281 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12282 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12283 | int i, idx1; |
| 12284 | |
| 12285 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12286 | switch(cfg->input_pins[i]) { |
| 12287 | case 0x18: |
| 12288 | idx1 = 0; /* Mic 1 */ |
| 12289 | break; |
| 12290 | case 0x19: |
| 12291 | idx1 = 1; /* Mic 2 */ |
| 12292 | break; |
| 12293 | case 0x1a: |
| 12294 | idx1 = 2; /* Line In */ |
| 12295 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12296 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12297 | idx1 = 3; /* CD */ |
| 12298 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 12299 | case 0x12: |
| 12300 | case 0x13: |
| 12301 | idx1 = 6; /* digital mics */ |
| 12302 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12303 | default: |
| 12304 | continue; |
| 12305 | } |
| 12306 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 12307 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12308 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12309 | } |
| 12310 | return 0; |
| 12311 | } |
| 12312 | |
| 12313 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12314 | { |
| 12315 | struct alc_spec *spec = codec->spec; |
| 12316 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12317 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12318 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12319 | unsigned int dac_vol1, dac_vol2; |
| 12320 | |
| 12321 | if (speaker_nid) { |
| 12322 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12323 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 12324 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12325 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12326 | AMP_IN_UNMUTE(1)); |
| 12327 | snd_hda_codec_write(codec, 0x10, 0, |
| 12328 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12329 | AMP_IN_UNMUTE(1)); |
| 12330 | } else { |
| 12331 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12332 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12333 | snd_hda_codec_write(codec, 0x10, 0, |
| 12334 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12335 | } |
| 12336 | |
| 12337 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12338 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12339 | dac_vol2 = AMP_OUT_ZERO; |
| 12340 | else if (line_nid == 0x15) |
| 12341 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12342 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12343 | dac_vol2 = AMP_OUT_ZERO; |
| 12344 | else if (hp_nid == 0x15) |
| 12345 | dac_vol1 = AMP_OUT_ZERO; |
| 12346 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12347 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12348 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12349 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12350 | |
| 12351 | snd_hda_codec_write(codec, 0x02, 0, |
| 12352 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12353 | snd_hda_codec_write(codec, 0x03, 0, |
| 12354 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12355 | } |
| 12356 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12357 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12358 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12359 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12360 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12361 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12362 | |
| 12363 | /* |
| 12364 | * BIOS auto configuration |
| 12365 | */ |
| 12366 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12367 | { |
| 12368 | struct alc_spec *spec = codec->spec; |
| 12369 | int err; |
| 12370 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12371 | |
| 12372 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12373 | alc268_ignore); |
| 12374 | if (err < 0) |
| 12375 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12376 | if (!spec->autocfg.line_outs) { |
| 12377 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12378 | spec->multiout.max_channels = 2; |
| 12379 | spec->no_analog = 1; |
| 12380 | goto dig_only; |
| 12381 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12382 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12383 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12384 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12385 | if (err < 0) |
| 12386 | return err; |
| 12387 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12388 | if (err < 0) |
| 12389 | return err; |
| 12390 | |
| 12391 | spec->multiout.max_channels = 2; |
| 12392 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12393 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12394 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12395 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12396 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12397 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12398 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12399 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12400 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12401 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12402 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12403 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12404 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12405 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12406 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12407 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12408 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12409 | err = alc_auto_add_mic_boost(codec); |
| 12410 | if (err < 0) |
| 12411 | return err; |
| 12412 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12413 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12414 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12415 | return 1; |
| 12416 | } |
| 12417 | |
| 12418 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12419 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12420 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12421 | |
| 12422 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12423 | static void alc268_auto_init(struct hda_codec *codec) |
| 12424 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12425 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12426 | alc268_auto_init_multi_out(codec); |
| 12427 | alc268_auto_init_hp_out(codec); |
| 12428 | alc268_auto_init_mono_speaker_out(codec); |
| 12429 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12430 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12431 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12432 | } |
| 12433 | |
| 12434 | /* |
| 12435 | * configuration and preset |
| 12436 | */ |
| 12437 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12438 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12439 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12440 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12441 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12442 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12443 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12444 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12445 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12446 | #ifdef CONFIG_SND_DEBUG |
| 12447 | [ALC268_TEST] = "test", |
| 12448 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12449 | [ALC268_AUTO] = "auto", |
| 12450 | }; |
| 12451 | |
| 12452 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12453 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12454 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12455 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12456 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12457 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12458 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12459 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12460 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12461 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12462 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
| 12463 | ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12464 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12465 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
| 12466 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12467 | ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12468 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12469 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12470 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12471 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12472 | {} |
| 12473 | }; |
| 12474 | |
| 12475 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12476 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12477 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12478 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12479 | alc267_quanta_il1_verbs }, |
| 12480 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12481 | .dac_nids = alc268_dac_nids, |
| 12482 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12483 | .adc_nids = alc268_adc_nids_alt, |
| 12484 | .hp_nid = 0x03, |
| 12485 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12486 | .channel_mode = alc268_modes, |
| 12487 | .input_mux = &alc268_capture_source, |
| 12488 | .unsol_event = alc267_quanta_il1_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12489 | .init_hook = alc267_quanta_il1_init_hook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12490 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12491 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12492 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12493 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12494 | .init_verbs = { alc268_base_init_verbs }, |
| 12495 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12496 | .dac_nids = alc268_dac_nids, |
| 12497 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12498 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12499 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12500 | .hp_nid = 0x03, |
| 12501 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12502 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12503 | .channel_mode = alc268_modes, |
| 12504 | .input_mux = &alc268_capture_source, |
| 12505 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12506 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12507 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12508 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12509 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12510 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12511 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12512 | .dac_nids = alc268_dac_nids, |
| 12513 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12514 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12515 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12516 | .hp_nid = 0x03, |
| 12517 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12518 | .channel_mode = alc268_modes, |
| 12519 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12520 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12521 | .init_hook = alc268_toshiba_init_hook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12522 | }, |
| 12523 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12524 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12525 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12526 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12527 | alc268_acer_verbs }, |
| 12528 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12529 | .dac_nids = alc268_dac_nids, |
| 12530 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12531 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12532 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12533 | .hp_nid = 0x02, |
| 12534 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12535 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12536 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12537 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12538 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12539 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12540 | [ALC268_ACER_DMIC] = { |
| 12541 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12542 | alc268_beep_mixer }, |
| 12543 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12544 | alc268_acer_verbs }, |
| 12545 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12546 | .dac_nids = alc268_dac_nids, |
| 12547 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12548 | .adc_nids = alc268_adc_nids_alt, |
| 12549 | .capsrc_nids = alc268_capsrc_nids, |
| 12550 | .hp_nid = 0x02, |
| 12551 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12552 | .channel_mode = alc268_modes, |
| 12553 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12554 | .unsol_event = alc268_acer_unsol_event, |
| 12555 | .init_hook = alc268_acer_init_hook, |
| 12556 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12557 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12558 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12559 | alc268_beep_mixer, |
| 12560 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12561 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12562 | alc268_acer_aspire_one_verbs }, |
| 12563 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12564 | .dac_nids = alc268_dac_nids, |
| 12565 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12566 | .adc_nids = alc268_adc_nids_alt, |
| 12567 | .capsrc_nids = alc268_capsrc_nids, |
| 12568 | .hp_nid = 0x03, |
| 12569 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12570 | .channel_mode = alc268_modes, |
| 12571 | .input_mux = &alc268_acer_lc_capture_source, |
| 12572 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12573 | .init_hook = alc268_acer_lc_init_hook, |
| 12574 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12575 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12576 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12577 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12578 | alc268_dell_verbs }, |
| 12579 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12580 | .dac_nids = alc268_dac_nids, |
| 12581 | .hp_nid = 0x02, |
| 12582 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12583 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12584 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12585 | .init_hook = alc268_dell_init_hook, |
| 12586 | .input_mux = &alc268_capture_source, |
| 12587 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12588 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12589 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12590 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12591 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12592 | alc268_toshiba_verbs }, |
| 12593 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12594 | .dac_nids = alc268_dac_nids, |
| 12595 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12596 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12597 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12598 | .hp_nid = 0x03, |
| 12599 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12600 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12601 | .channel_mode = alc268_modes, |
| 12602 | .input_mux = &alc268_capture_source, |
| 12603 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12604 | .init_hook = alc268_toshiba_init_hook |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12605 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12606 | #ifdef CONFIG_SND_DEBUG |
| 12607 | [ALC268_TEST] = { |
| 12608 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12609 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12610 | alc268_volume_init_verbs }, |
| 12611 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12612 | .dac_nids = alc268_dac_nids, |
| 12613 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12614 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12615 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12616 | .hp_nid = 0x03, |
| 12617 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12618 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12619 | .channel_mode = alc268_modes, |
| 12620 | .input_mux = &alc268_capture_source, |
| 12621 | }, |
| 12622 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12623 | }; |
| 12624 | |
| 12625 | static int patch_alc268(struct hda_codec *codec) |
| 12626 | { |
| 12627 | struct alc_spec *spec; |
| 12628 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12629 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12630 | |
| 12631 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12632 | if (spec == NULL) |
| 12633 | return -ENOMEM; |
| 12634 | |
| 12635 | codec->spec = spec; |
| 12636 | |
| 12637 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12638 | alc268_models, |
| 12639 | alc268_cfg_tbl); |
| 12640 | |
| 12641 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12642 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12643 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12644 | board_config = ALC268_AUTO; |
| 12645 | } |
| 12646 | |
| 12647 | if (board_config == ALC268_AUTO) { |
| 12648 | /* automatic parse from the BIOS config */ |
| 12649 | err = alc268_parse_auto_config(codec); |
| 12650 | if (err < 0) { |
| 12651 | alc_free(codec); |
| 12652 | return err; |
| 12653 | } else if (!err) { |
| 12654 | printk(KERN_INFO |
| 12655 | "hda_codec: Cannot set up configuration " |
| 12656 | "from BIOS. Using base mode...\n"); |
| 12657 | board_config = ALC268_3ST; |
| 12658 | } |
| 12659 | } |
| 12660 | |
| 12661 | if (board_config != ALC268_AUTO) |
| 12662 | setup_preset(spec, &alc268_presets[board_config]); |
| 12663 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12664 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12665 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12666 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12667 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12668 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12669 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12670 | has_beep = 0; |
| 12671 | for (i = 0; i < spec->num_mixers; i++) { |
| 12672 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12673 | has_beep = 1; |
| 12674 | break; |
| 12675 | } |
| 12676 | } |
| 12677 | |
| 12678 | if (has_beep) { |
| 12679 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12680 | if (err < 0) { |
| 12681 | alc_free(codec); |
| 12682 | return err; |
| 12683 | } |
| 12684 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12685 | /* override the amp caps for beep generator */ |
| 12686 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12687 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12688 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12689 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12690 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12691 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12692 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12693 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12694 | /* check whether NID 0x07 is valid */ |
| 12695 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12696 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12697 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12698 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12699 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12700 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12701 | spec->adc_nids = alc268_adc_nids_alt; |
| 12702 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12703 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12704 | } else { |
| 12705 | spec->adc_nids = alc268_adc_nids; |
| 12706 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12707 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12708 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12709 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12710 | /* set default input source */ |
| 12711 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12712 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12713 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12714 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12715 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12716 | |
| 12717 | spec->vmaster_nid = 0x02; |
| 12718 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12719 | codec->patch_ops = alc_patch_ops; |
| 12720 | if (board_config == ALC268_AUTO) |
| 12721 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12722 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12723 | codec->proc_widget_hook = print_realtek_coef; |
| 12724 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12725 | return 0; |
| 12726 | } |
| 12727 | |
| 12728 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12729 | * ALC269 channel source setting (2 channel) |
| 12730 | */ |
| 12731 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12732 | |
| 12733 | #define alc269_dac_nids alc260_dac_nids |
| 12734 | |
| 12735 | static hda_nid_t alc269_adc_nids[1] = { |
| 12736 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12737 | 0x08, |
| 12738 | }; |
| 12739 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12740 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12741 | 0x23, |
| 12742 | }; |
| 12743 | |
| 12744 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12745 | * not a mux! |
| 12746 | */ |
| 12747 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12748 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12749 | .num_items = 2, |
| 12750 | .items = { |
| 12751 | { "i-Mic", 0x5 }, |
| 12752 | { "e-Mic", 0x0 }, |
| 12753 | }, |
| 12754 | }; |
| 12755 | |
| 12756 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12757 | .num_items = 2, |
| 12758 | .items = { |
| 12759 | { "i-Mic", 0x1 }, |
| 12760 | { "e-Mic", 0x0 }, |
| 12761 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12762 | }; |
| 12763 | |
| 12764 | #define alc269_modes alc260_modes |
| 12765 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12766 | |
| 12767 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12768 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12769 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12770 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12771 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12772 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12773 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12774 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12775 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12776 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12777 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12778 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12779 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12780 | { } /* end */ |
| 12781 | }; |
| 12782 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12783 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12784 | /* output mixer control */ |
| 12785 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12786 | { |
| 12787 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12788 | .name = "Master Playback Switch", |
| 12789 | .info = snd_hda_mixer_amp_switch_info, |
| 12790 | .get = snd_hda_mixer_amp_switch_get, |
| 12791 | .put = alc268_acer_master_sw_put, |
| 12792 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12793 | }, |
| 12794 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12795 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12796 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12797 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12798 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12799 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12800 | { } |
| 12801 | }; |
| 12802 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12803 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12804 | /* output mixer control */ |
| 12805 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12806 | { |
| 12807 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12808 | .name = "Master Playback Switch", |
| 12809 | .info = snd_hda_mixer_amp_switch_info, |
| 12810 | .get = snd_hda_mixer_amp_switch_get, |
| 12811 | .put = alc268_acer_master_sw_put, |
| 12812 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12813 | }, |
| 12814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12816 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12817 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12818 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12819 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12820 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12821 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12822 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12823 | { } |
| 12824 | }; |
| 12825 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12826 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12827 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12828 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12829 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12830 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12831 | { } /* end */ |
| 12832 | }; |
| 12833 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12834 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12835 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12836 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12837 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12838 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12839 | { } /* end */ |
| 12840 | }; |
| 12841 | |
| 12842 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12843 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12844 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12845 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12846 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12847 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12848 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12849 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12850 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12851 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12852 | { } |
| 12853 | }; |
| 12854 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12855 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12856 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12857 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12858 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12859 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12860 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12861 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12862 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12863 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12864 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12865 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12866 | { } |
| 12867 | }; |
| 12868 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12869 | /* toggle speaker-output according to the hp-jack state */ |
| 12870 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12871 | { |
| 12872 | unsigned int present; |
| 12873 | unsigned char bits; |
| 12874 | |
| 12875 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12876 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12877 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12878 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12879 | AMP_IN_MUTE(0), bits); |
| 12880 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12881 | AMP_IN_MUTE(0), bits); |
| 12882 | |
| 12883 | snd_hda_codec_write(codec, 0x20, 0, |
| 12884 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12885 | snd_hda_codec_write(codec, 0x20, 0, |
| 12886 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12887 | |
| 12888 | snd_hda_codec_write(codec, 0x20, 0, |
| 12889 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12890 | snd_hda_codec_write(codec, 0x20, 0, |
| 12891 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12892 | } |
| 12893 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12894 | /* toggle speaker-output according to the hp-jacks state */ |
| 12895 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12896 | { |
| 12897 | unsigned int present; |
| 12898 | unsigned char bits; |
| 12899 | |
| 12900 | /* Check laptop headphone socket */ |
| 12901 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12902 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12903 | |
| 12904 | /* Check port replicator headphone socket */ |
| 12905 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12906 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12907 | |
| 12908 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12909 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12910 | AMP_IN_MUTE(0), bits); |
| 12911 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12912 | AMP_IN_MUTE(0), bits); |
| 12913 | |
| 12914 | snd_hda_codec_write(codec, 0x20, 0, |
| 12915 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12916 | snd_hda_codec_write(codec, 0x20, 0, |
| 12917 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12918 | |
| 12919 | snd_hda_codec_write(codec, 0x20, 0, |
| 12920 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12921 | snd_hda_codec_write(codec, 0x20, 0, |
| 12922 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12923 | } |
| 12924 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12925 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12926 | { |
| 12927 | unsigned int present; |
| 12928 | |
| 12929 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12930 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12931 | snd_hda_codec_write(codec, 0x23, 0, |
| 12932 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12933 | } |
| 12934 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12935 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12936 | { |
| 12937 | unsigned int present_laptop; |
| 12938 | unsigned int present_dock; |
| 12939 | |
| 12940 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12941 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12942 | |
| 12943 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12944 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12945 | |
| 12946 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12947 | if (present_dock) |
| 12948 | snd_hda_codec_write(codec, 0x23, 0, |
| 12949 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12950 | if (present_laptop) |
| 12951 | snd_hda_codec_write(codec, 0x23, 0, |
| 12952 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12953 | if (!present_dock && !present_laptop) |
| 12954 | snd_hda_codec_write(codec, 0x23, 0, |
| 12955 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12956 | } |
| 12957 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12958 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12959 | unsigned int res) |
| 12960 | { |
| 12961 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12962 | alc269_quanta_fl1_speaker_automute(codec); |
| 12963 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12964 | alc269_quanta_fl1_mic_automute(codec); |
| 12965 | } |
| 12966 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12967 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12968 | unsigned int res) |
| 12969 | { |
| 12970 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12971 | alc269_lifebook_speaker_automute(codec); |
| 12972 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12973 | alc269_lifebook_mic_autoswitch(codec); |
| 12974 | } |
| 12975 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12976 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12977 | { |
| 12978 | alc269_quanta_fl1_speaker_automute(codec); |
| 12979 | alc269_quanta_fl1_mic_automute(codec); |
| 12980 | } |
| 12981 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12982 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12983 | { |
| 12984 | alc269_lifebook_speaker_automute(codec); |
| 12985 | alc269_lifebook_mic_autoswitch(codec); |
| 12986 | } |
| 12987 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12988 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12989 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12990 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12991 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12992 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12993 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12994 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12995 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12996 | {} |
| 12997 | }; |
| 12998 | |
| 12999 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 13000 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13001 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13002 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13003 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13004 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13005 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13006 | {} |
| 13007 | }; |
| 13008 | |
| 13009 | /* toggle speaker-output according to the hp-jack state */ |
| 13010 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13011 | { |
| 13012 | unsigned int present; |
| 13013 | unsigned char bits; |
| 13014 | |
| 13015 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13016 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13017 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13018 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13019 | AMP_IN_MUTE(0), bits); |
| 13020 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13021 | AMP_IN_MUTE(0), bits); |
| 13022 | } |
| 13023 | |
| 13024 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 13025 | { |
| 13026 | unsigned int present; |
| 13027 | |
| 13028 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13029 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13030 | snd_hda_codec_write(codec, 0x23, 0, |
| 13031 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 13032 | } |
| 13033 | |
| 13034 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 13035 | { |
| 13036 | unsigned int present; |
| 13037 | |
| 13038 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13039 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13040 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13041 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13042 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13043 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13044 | } |
| 13045 | |
| 13046 | /* unsolicited event for HP jack sensing */ |
| 13047 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 13048 | unsigned int res) |
| 13049 | { |
| 13050 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13051 | alc269_speaker_automute(codec); |
| 13052 | |
| 13053 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13054 | alc269_eeepc_dmic_automute(codec); |
| 13055 | } |
| 13056 | |
| 13057 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 13058 | { |
| 13059 | alc269_speaker_automute(codec); |
| 13060 | alc269_eeepc_dmic_automute(codec); |
| 13061 | } |
| 13062 | |
| 13063 | /* unsolicited event for HP jack sensing */ |
| 13064 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 13065 | unsigned int res) |
| 13066 | { |
| 13067 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13068 | alc269_speaker_automute(codec); |
| 13069 | |
| 13070 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13071 | alc269_eeepc_amic_automute(codec); |
| 13072 | } |
| 13073 | |
| 13074 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 13075 | { |
| 13076 | alc269_speaker_automute(codec); |
| 13077 | alc269_eeepc_amic_automute(codec); |
| 13078 | } |
| 13079 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13080 | /* |
| 13081 | * generic initialization of ADC, input mixers and output mixers |
| 13082 | */ |
| 13083 | static struct hda_verb alc269_init_verbs[] = { |
| 13084 | /* |
| 13085 | * Unmute ADC0 and set the default input to mic-in |
| 13086 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13087 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13088 | |
| 13089 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 13090 | * analog-loopback mixer widget |
| 13091 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 13092 | * front panel mic (mic 2) |
| 13093 | */ |
| 13094 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 13095 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13096 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13100 | |
| 13101 | /* |
| 13102 | * Set up output mixers (0x0c - 0x0e) |
| 13103 | */ |
| 13104 | /* set vol=0 to output mixers */ |
| 13105 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13106 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13107 | |
| 13108 | /* set up input amps for analog loopback */ |
| 13109 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13110 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13111 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13112 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13113 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13114 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13115 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13116 | |
| 13117 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13118 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13119 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13120 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13121 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13122 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13123 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13124 | |
| 13125 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13126 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13127 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13128 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13129 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13130 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13131 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13132 | |
| 13133 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13134 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13135 | |
| 13136 | /* FIXME: use matrix-type input source selection */ |
| 13137 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13138 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13139 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13140 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13141 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13142 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13143 | |
| 13144 | /* set EAPD */ |
| 13145 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13146 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13147 | { } |
| 13148 | }; |
| 13149 | |
| 13150 | /* add playback controls from the parsed DAC table */ |
| 13151 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13152 | const struct auto_pin_cfg *cfg) |
| 13153 | { |
| 13154 | hda_nid_t nid; |
| 13155 | int err; |
| 13156 | |
| 13157 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 13158 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13159 | spec->multiout.dac_nids[0] = 2; |
| 13160 | |
| 13161 | nid = cfg->line_out_pins[0]; |
| 13162 | if (nid) { |
| 13163 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13164 | "Front Playback Volume", |
| 13165 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 13166 | if (err < 0) |
| 13167 | return err; |
| 13168 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13169 | "Front Playback Switch", |
| 13170 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13171 | if (err < 0) |
| 13172 | return err; |
| 13173 | } |
| 13174 | |
| 13175 | nid = cfg->speaker_pins[0]; |
| 13176 | if (nid) { |
| 13177 | if (!cfg->line_out_pins[0]) { |
| 13178 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13179 | "Speaker Playback Volume", |
| 13180 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13181 | HDA_OUTPUT)); |
| 13182 | if (err < 0) |
| 13183 | return err; |
| 13184 | } |
| 13185 | if (nid == 0x16) { |
| 13186 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13187 | "Speaker Playback Switch", |
| 13188 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13189 | HDA_OUTPUT)); |
| 13190 | if (err < 0) |
| 13191 | return err; |
| 13192 | } else { |
| 13193 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13194 | "Speaker Playback Switch", |
| 13195 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13196 | HDA_OUTPUT)); |
| 13197 | if (err < 0) |
| 13198 | return err; |
| 13199 | } |
| 13200 | } |
| 13201 | nid = cfg->hp_pins[0]; |
| 13202 | if (nid) { |
| 13203 | /* spec->multiout.hp_nid = 2; */ |
| 13204 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 13205 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13206 | "Headphone Playback Volume", |
| 13207 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13208 | HDA_OUTPUT)); |
| 13209 | if (err < 0) |
| 13210 | return err; |
| 13211 | } |
| 13212 | if (nid == 0x16) { |
| 13213 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13214 | "Headphone Playback Switch", |
| 13215 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13216 | HDA_OUTPUT)); |
| 13217 | if (err < 0) |
| 13218 | return err; |
| 13219 | } else { |
| 13220 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13221 | "Headphone Playback Switch", |
| 13222 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13223 | HDA_OUTPUT)); |
| 13224 | if (err < 0) |
| 13225 | return err; |
| 13226 | } |
| 13227 | } |
| 13228 | return 0; |
| 13229 | } |
| 13230 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13231 | #define alc269_auto_create_analog_input_ctls \ |
| 13232 | alc262_auto_create_analog_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13233 | |
| 13234 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13235 | #define alc269_loopbacks alc880_loopbacks |
| 13236 | #endif |
| 13237 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13238 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13239 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13240 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13241 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13242 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13243 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13244 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13245 | .substreams = 1, |
| 13246 | .channels_min = 2, |
| 13247 | .channels_max = 8, |
| 13248 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13249 | /* NID is set in alc_build_pcms */ |
| 13250 | .ops = { |
| 13251 | .open = alc880_playback_pcm_open, |
| 13252 | .prepare = alc880_playback_pcm_prepare, |
| 13253 | .cleanup = alc880_playback_pcm_cleanup |
| 13254 | }, |
| 13255 | }; |
| 13256 | |
| 13257 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13258 | .substreams = 1, |
| 13259 | .channels_min = 2, |
| 13260 | .channels_max = 2, |
| 13261 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13262 | /* NID is set in alc_build_pcms */ |
| 13263 | }; |
| 13264 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13265 | /* |
| 13266 | * BIOS auto configuration |
| 13267 | */ |
| 13268 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13269 | { |
| 13270 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13271 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13272 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13273 | |
| 13274 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13275 | alc269_ignore); |
| 13276 | if (err < 0) |
| 13277 | return err; |
| 13278 | |
| 13279 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13280 | if (err < 0) |
| 13281 | return err; |
| 13282 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13283 | if (err < 0) |
| 13284 | return err; |
| 13285 | |
| 13286 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13287 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13288 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13289 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13290 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13291 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13292 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13293 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13294 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13295 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13296 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13297 | /* set default input source */ |
| 13298 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13299 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13300 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13301 | |
| 13302 | err = alc_auto_add_mic_boost(codec); |
| 13303 | if (err < 0) |
| 13304 | return err; |
| 13305 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13306 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13307 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13308 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13309 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13310 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13311 | return 1; |
| 13312 | } |
| 13313 | |
| 13314 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 13315 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 13316 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13317 | |
| 13318 | |
| 13319 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13320 | static void alc269_auto_init(struct hda_codec *codec) |
| 13321 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13322 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13323 | alc269_auto_init_multi_out(codec); |
| 13324 | alc269_auto_init_hp_out(codec); |
| 13325 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13326 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13327 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13328 | } |
| 13329 | |
| 13330 | /* |
| 13331 | * configuration and preset |
| 13332 | */ |
| 13333 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13334 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13335 | [ALC269_QUANTA_FL1] = "quanta", |
| 13336 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13337 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13338 | [ALC269_FUJITSU] = "fujitsu", |
| 13339 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13340 | }; |
| 13341 | |
| 13342 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13343 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13344 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13345 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13346 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13347 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13348 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13349 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13350 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13351 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13352 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13353 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13354 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13355 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13356 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13357 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13358 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13359 | {} |
| 13360 | }; |
| 13361 | |
| 13362 | static struct alc_config_preset alc269_presets[] = { |
| 13363 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13364 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13365 | .init_verbs = { alc269_init_verbs }, |
| 13366 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13367 | .dac_nids = alc269_dac_nids, |
| 13368 | .hp_nid = 0x03, |
| 13369 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13370 | .channel_mode = alc269_modes, |
| 13371 | .input_mux = &alc269_capture_source, |
| 13372 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13373 | [ALC269_QUANTA_FL1] = { |
| 13374 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13375 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13376 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13377 | .dac_nids = alc269_dac_nids, |
| 13378 | .hp_nid = 0x03, |
| 13379 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13380 | .channel_mode = alc269_modes, |
| 13381 | .input_mux = &alc269_capture_source, |
| 13382 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 13383 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13384 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13385 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13386 | .mixers = { alc269_eeepc_mixer }, |
| 13387 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13388 | .init_verbs = { alc269_init_verbs, |
| 13389 | alc269_eeepc_amic_init_verbs }, |
| 13390 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13391 | .dac_nids = alc269_dac_nids, |
| 13392 | .hp_nid = 0x03, |
| 13393 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13394 | .channel_mode = alc269_modes, |
| 13395 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 13396 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 13397 | .init_hook = alc269_eeepc_amic_inithook, |
| 13398 | }, |
| 13399 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13400 | .mixers = { alc269_eeepc_mixer }, |
| 13401 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13402 | .init_verbs = { alc269_init_verbs, |
| 13403 | alc269_eeepc_dmic_init_verbs }, |
| 13404 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13405 | .dac_nids = alc269_dac_nids, |
| 13406 | .hp_nid = 0x03, |
| 13407 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13408 | .channel_mode = alc269_modes, |
| 13409 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13410 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13411 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13412 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13413 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13414 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13415 | .cap_mixer = alc269_epc_capture_mixer, |
| 13416 | .init_verbs = { alc269_init_verbs, |
| 13417 | alc269_eeepc_dmic_init_verbs }, |
| 13418 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13419 | .dac_nids = alc269_dac_nids, |
| 13420 | .hp_nid = 0x03, |
| 13421 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13422 | .channel_mode = alc269_modes, |
| 13423 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13424 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13425 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13426 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13427 | [ALC269_LIFEBOOK] = { |
| 13428 | .mixers = { alc269_lifebook_mixer }, |
| 13429 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13430 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13431 | .dac_nids = alc269_dac_nids, |
| 13432 | .hp_nid = 0x03, |
| 13433 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13434 | .channel_mode = alc269_modes, |
| 13435 | .input_mux = &alc269_capture_source, |
| 13436 | .unsol_event = alc269_lifebook_unsol_event, |
| 13437 | .init_hook = alc269_lifebook_init_hook, |
| 13438 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13439 | }; |
| 13440 | |
| 13441 | static int patch_alc269(struct hda_codec *codec) |
| 13442 | { |
| 13443 | struct alc_spec *spec; |
| 13444 | int board_config; |
| 13445 | int err; |
| 13446 | |
| 13447 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13448 | if (spec == NULL) |
| 13449 | return -ENOMEM; |
| 13450 | |
| 13451 | codec->spec = spec; |
| 13452 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13453 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13454 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13455 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13456 | alc269_models, |
| 13457 | alc269_cfg_tbl); |
| 13458 | |
| 13459 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13460 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13461 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13462 | board_config = ALC269_AUTO; |
| 13463 | } |
| 13464 | |
| 13465 | if (board_config == ALC269_AUTO) { |
| 13466 | /* automatic parse from the BIOS config */ |
| 13467 | err = alc269_parse_auto_config(codec); |
| 13468 | if (err < 0) { |
| 13469 | alc_free(codec); |
| 13470 | return err; |
| 13471 | } else if (!err) { |
| 13472 | printk(KERN_INFO |
| 13473 | "hda_codec: Cannot set up configuration " |
| 13474 | "from BIOS. Using base mode...\n"); |
| 13475 | board_config = ALC269_BASIC; |
| 13476 | } |
| 13477 | } |
| 13478 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13479 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13480 | if (err < 0) { |
| 13481 | alc_free(codec); |
| 13482 | return err; |
| 13483 | } |
| 13484 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13485 | if (board_config != ALC269_AUTO) |
| 13486 | setup_preset(spec, &alc269_presets[board_config]); |
| 13487 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13488 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13489 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13490 | * fix the sample rate of analog I/O to 44.1kHz |
| 13491 | */ |
| 13492 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13493 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13494 | } else { |
| 13495 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13496 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13497 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13498 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13499 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13500 | |
| 13501 | spec->adc_nids = alc269_adc_nids; |
| 13502 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13503 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13504 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13505 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13506 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13507 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 13508 | spec->vmaster_nid = 0x02; |
| 13509 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13510 | codec->patch_ops = alc_patch_ops; |
| 13511 | if (board_config == ALC269_AUTO) |
| 13512 | spec->init_hook = alc269_auto_init; |
| 13513 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13514 | if (!spec->loopback.amplist) |
| 13515 | spec->loopback.amplist = alc269_loopbacks; |
| 13516 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13517 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13518 | |
| 13519 | return 0; |
| 13520 | } |
| 13521 | |
| 13522 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13523 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13524 | */ |
| 13525 | |
| 13526 | /* |
| 13527 | * set the path ways for 2 channel output |
| 13528 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13529 | */ |
| 13530 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13531 | /* set pin widget 1Ah (line in) for input */ |
| 13532 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13533 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13534 | * the vref |
| 13535 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13536 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13537 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13538 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13539 | #if 0 |
| 13540 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13541 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13542 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13543 | { } /* end */ |
| 13544 | }; |
| 13545 | /* |
| 13546 | * 6ch mode |
| 13547 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13548 | */ |
| 13549 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13550 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13551 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13552 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13553 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13554 | |
| 13555 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13556 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13557 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13558 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13559 | #if 0 |
| 13560 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13561 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13562 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13563 | { } /* end */ |
| 13564 | }; |
| 13565 | |
| 13566 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13567 | { 2, alc861_threestack_ch2_init }, |
| 13568 | { 6, alc861_threestack_ch6_init }, |
| 13569 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13570 | /* Set mic1 as input and unmute the mixer */ |
| 13571 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13572 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13573 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13574 | { } /* end */ |
| 13575 | }; |
| 13576 | /* Set mic1 as output and mute mixer */ |
| 13577 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13578 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13579 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13580 | { } /* end */ |
| 13581 | }; |
| 13582 | |
| 13583 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13584 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13585 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13586 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13587 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13588 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13589 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13590 | /* set pin widget 1Ah (line in) for input */ |
| 13591 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13592 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13593 | * the vref |
| 13594 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13595 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13596 | |
| 13597 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13598 | #if 0 |
| 13599 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13600 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13601 | #endif |
| 13602 | { } /* end */ |
| 13603 | }; |
| 13604 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13605 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13606 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13607 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13608 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13609 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13610 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13611 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13612 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13613 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13614 | |
| 13615 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13616 | #if 0 |
| 13617 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13618 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13619 | #endif |
| 13620 | { } /* end */ |
| 13621 | }; |
| 13622 | |
| 13623 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13624 | { 2, alc861_asus_ch2_init }, |
| 13625 | { 6, alc861_asus_ch6_init }, |
| 13626 | }; |
| 13627 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13628 | /* patch-ALC861 */ |
| 13629 | |
| 13630 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13631 | /* output mixer control */ |
| 13632 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13633 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13634 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13635 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13636 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13637 | |
| 13638 | /*Input mixer control */ |
| 13639 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13640 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13641 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13642 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13643 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13644 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13645 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13646 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13647 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13648 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13649 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13650 | { } /* end */ |
| 13651 | }; |
| 13652 | |
| 13653 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13654 | /* output mixer control */ |
| 13655 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13656 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13657 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13658 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13659 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13660 | |
| 13661 | /* Input mixer control */ |
| 13662 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13663 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13664 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13665 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13666 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13667 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13668 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13669 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13670 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13671 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13672 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13673 | { |
| 13674 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13675 | .name = "Channel Mode", |
| 13676 | .info = alc_ch_mode_info, |
| 13677 | .get = alc_ch_mode_get, |
| 13678 | .put = alc_ch_mode_put, |
| 13679 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13680 | }, |
| 13681 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13682 | }; |
| 13683 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13684 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13685 | /* output mixer control */ |
| 13686 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13687 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13688 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13689 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13690 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13691 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13692 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13693 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13694 | /* output mixer control */ |
| 13695 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13696 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13697 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13698 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13699 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13700 | |
| 13701 | /* Input mixer control */ |
| 13702 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13703 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13704 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13705 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13706 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13707 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13708 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13709 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13710 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13711 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13712 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13713 | { |
| 13714 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13715 | .name = "Channel Mode", |
| 13716 | .info = alc_ch_mode_info, |
| 13717 | .get = alc_ch_mode_get, |
| 13718 | .put = alc_ch_mode_put, |
| 13719 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13720 | }, |
| 13721 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13722 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13723 | |
| 13724 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13725 | /* output mixer control */ |
| 13726 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13727 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13728 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13729 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13730 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13731 | |
| 13732 | /* Input mixer control */ |
| 13733 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13734 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13735 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13736 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13737 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13738 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13739 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13740 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13741 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13742 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13743 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13744 | { |
| 13745 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13746 | .name = "Channel Mode", |
| 13747 | .info = alc_ch_mode_info, |
| 13748 | .get = alc_ch_mode_get, |
| 13749 | .put = alc_ch_mode_put, |
| 13750 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13751 | }, |
| 13752 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13753 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13754 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13755 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13756 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13757 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13758 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13759 | { } |
| 13760 | }; |
| 13761 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13762 | /* |
| 13763 | * generic initialization of ADC, input mixers and output mixers |
| 13764 | */ |
| 13765 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13766 | /* |
| 13767 | * Unmute ADC0 and set the default input to mic-in |
| 13768 | */ |
| 13769 | /* port-A for surround (rear panel) */ |
| 13770 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13771 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13772 | /* port-B for mic-in (rear panel) with vref */ |
| 13773 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13774 | /* port-C for line-in (rear panel) */ |
| 13775 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13776 | /* port-D for Front */ |
| 13777 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13778 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13779 | /* port-E for HP out (front panel) */ |
| 13780 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13781 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13782 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13783 | /* port-F for mic-in (front panel) with vref */ |
| 13784 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13785 | /* port-G for CLFE (rear panel) */ |
| 13786 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13787 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13788 | /* port-H for side (rear panel) */ |
| 13789 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13790 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13791 | /* CD-in */ |
| 13792 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13793 | /* route front mic to ADC1*/ |
| 13794 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13795 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13796 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13797 | /* Unmute DAC0~3 & spdif out*/ |
| 13798 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13799 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13800 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13801 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13802 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13803 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13804 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13805 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13806 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13807 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13808 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13809 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13810 | /* Unmute Stereo Mixer 15 */ |
| 13811 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13812 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13813 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13814 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13815 | |
| 13816 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13817 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13818 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13819 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13820 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13821 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13822 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13823 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13824 | /* hp used DAC 3 (Front) */ |
| 13825 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13826 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13827 | |
| 13828 | { } |
| 13829 | }; |
| 13830 | |
| 13831 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13832 | /* |
| 13833 | * Unmute ADC0 and set the default input to mic-in |
| 13834 | */ |
| 13835 | /* port-A for surround (rear panel) */ |
| 13836 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13837 | /* port-B for mic-in (rear panel) with vref */ |
| 13838 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13839 | /* port-C for line-in (rear panel) */ |
| 13840 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13841 | /* port-D for Front */ |
| 13842 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13843 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13844 | /* port-E for HP out (front panel) */ |
| 13845 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13846 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13847 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13848 | /* port-F for mic-in (front panel) with vref */ |
| 13849 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13850 | /* port-G for CLFE (rear panel) */ |
| 13851 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13852 | /* port-H for side (rear panel) */ |
| 13853 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13854 | /* CD-in */ |
| 13855 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13856 | /* route front mic to ADC1*/ |
| 13857 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13858 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13859 | /* Unmute DAC0~3 & spdif out*/ |
| 13860 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13861 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13862 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13863 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13864 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13865 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13866 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13867 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13868 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13869 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13870 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13871 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13872 | /* Unmute Stereo Mixer 15 */ |
| 13873 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13875 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13876 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13877 | |
| 13878 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13879 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13880 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13881 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13882 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13883 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13884 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13885 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13886 | /* hp used DAC 3 (Front) */ |
| 13887 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13888 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13889 | { } |
| 13890 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13891 | |
| 13892 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13893 | /* |
| 13894 | * Unmute ADC0 and set the default input to mic-in |
| 13895 | */ |
| 13896 | /* port-A for surround (rear panel) */ |
| 13897 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13898 | /* port-B for mic-in (rear panel) with vref */ |
| 13899 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13900 | /* port-C for line-in (rear panel) */ |
| 13901 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13902 | /* port-D for Front */ |
| 13903 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13904 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13905 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13906 | /* this has to be set to VREF80 */ |
| 13907 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13908 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13909 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13910 | /* port-F for mic-in (front panel) with vref */ |
| 13911 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13912 | /* port-G for CLFE (rear panel) */ |
| 13913 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13914 | /* port-H for side (rear panel) */ |
| 13915 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13916 | /* CD-in */ |
| 13917 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13918 | /* route front mic to ADC1*/ |
| 13919 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13920 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13921 | /* Unmute DAC0~3 & spdif out*/ |
| 13922 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13923 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13924 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13925 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13926 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13927 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13928 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13929 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13930 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13931 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13932 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13933 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13934 | /* Unmute Stereo Mixer 15 */ |
| 13935 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13936 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13937 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13938 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13939 | |
| 13940 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13941 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13942 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13943 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13944 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13945 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13946 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13947 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13948 | /* hp used DAC 3 (Front) */ |
| 13949 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13950 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13951 | { } |
| 13952 | }; |
| 13953 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13954 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13955 | /* |
| 13956 | * Unmute ADC0 and set the default input to mic-in |
| 13957 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13958 | /* port-A for surround (rear panel) |
| 13959 | * according to codec#0 this is the HP jack |
| 13960 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13961 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13962 | /* route front PCM to HP */ |
| 13963 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13964 | /* port-B for mic-in (rear panel) with vref */ |
| 13965 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13966 | /* port-C for line-in (rear panel) */ |
| 13967 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13968 | /* port-D for Front */ |
| 13969 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13970 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13971 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13972 | /* this has to be set to VREF80 */ |
| 13973 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13974 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13975 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13976 | /* port-F for mic-in (front panel) with vref */ |
| 13977 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13978 | /* port-G for CLFE (rear panel) */ |
| 13979 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13980 | /* port-H for side (rear panel) */ |
| 13981 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13982 | /* CD-in */ |
| 13983 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13984 | /* route front mic to ADC1*/ |
| 13985 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13986 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13987 | /* Unmute DAC0~3 & spdif out*/ |
| 13988 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13989 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13990 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13991 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13992 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13993 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13994 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13995 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13996 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13997 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13998 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13999 | /* Unmute Stereo Mixer 15 */ |
| 14000 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14001 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14002 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14003 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14004 | |
| 14005 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14006 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14007 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14008 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14009 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14010 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14011 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14012 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14013 | /* hp used DAC 3 (Front) */ |
| 14014 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14015 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14016 | { } |
| 14017 | }; |
| 14018 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14019 | /* additional init verbs for ASUS laptops */ |
| 14020 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14021 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14022 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14023 | { } |
| 14024 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14025 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14026 | /* |
| 14027 | * generic initialization of ADC, input mixers and output mixers |
| 14028 | */ |
| 14029 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14030 | /* |
| 14031 | * Unmute ADC0 and set the default input to mic-in |
| 14032 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14033 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14034 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14035 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14036 | /* Unmute DAC0~3 & spdif out*/ |
| 14037 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14038 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14039 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14040 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14041 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14042 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14043 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14044 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14045 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14046 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14047 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14048 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14049 | /* Unmute Stereo Mixer 15 */ |
| 14050 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14051 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14052 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14053 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14054 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14055 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14056 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14057 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14058 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14059 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14060 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14061 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14062 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14063 | |
| 14064 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14065 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14066 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14067 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14068 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14069 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14070 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14071 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14072 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14073 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14074 | |
| 14075 | { } |
| 14076 | }; |
| 14077 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14078 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14079 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14080 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14081 | { } |
| 14082 | }; |
| 14083 | |
| 14084 | /* toggle speaker-output according to the hp-jack state */ |
| 14085 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14086 | { |
| 14087 | unsigned int present; |
| 14088 | |
| 14089 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 14090 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14091 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14092 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14093 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14094 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14095 | } |
| 14096 | |
| 14097 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14098 | unsigned int res) |
| 14099 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14100 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14101 | alc861_toshiba_automute(codec); |
| 14102 | } |
| 14103 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14104 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14105 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14106 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14107 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14108 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14109 | |
| 14110 | |
| 14111 | #define ALC861_DIGOUT_NID 0x07 |
| 14112 | |
| 14113 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14114 | { 8, NULL } |
| 14115 | }; |
| 14116 | |
| 14117 | static hda_nid_t alc861_dac_nids[4] = { |
| 14118 | /* front, surround, clfe, side */ |
| 14119 | 0x03, 0x06, 0x05, 0x04 |
| 14120 | }; |
| 14121 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14122 | static hda_nid_t alc660_dac_nids[3] = { |
| 14123 | /* front, clfe, surround */ |
| 14124 | 0x03, 0x05, 0x06 |
| 14125 | }; |
| 14126 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14127 | static hda_nid_t alc861_adc_nids[1] = { |
| 14128 | /* ADC0-2 */ |
| 14129 | 0x08, |
| 14130 | }; |
| 14131 | |
| 14132 | static struct hda_input_mux alc861_capture_source = { |
| 14133 | .num_items = 5, |
| 14134 | .items = { |
| 14135 | { "Mic", 0x0 }, |
| 14136 | { "Front Mic", 0x3 }, |
| 14137 | { "Line", 0x1 }, |
| 14138 | { "CD", 0x4 }, |
| 14139 | { "Mixer", 0x5 }, |
| 14140 | }, |
| 14141 | }; |
| 14142 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14143 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 14144 | { |
| 14145 | struct alc_spec *spec = codec->spec; |
| 14146 | hda_nid_t mix, srcs[5]; |
| 14147 | int i, j, num; |
| 14148 | |
| 14149 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 14150 | return 0; |
| 14151 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14152 | if (num < 0) |
| 14153 | return 0; |
| 14154 | for (i = 0; i < num; i++) { |
| 14155 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14156 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14157 | if (type != AC_WID_AUD_OUT) |
| 14158 | continue; |
| 14159 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 14160 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 14161 | break; |
| 14162 | if (j >= spec->multiout.num_dacs) |
| 14163 | return srcs[i]; |
| 14164 | } |
| 14165 | return 0; |
| 14166 | } |
| 14167 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14168 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14169 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14170 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14171 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14172 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14173 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14174 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14175 | |
| 14176 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14177 | for (i = 0; i < cfg->line_outs; i++) { |
| 14178 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14179 | dac = alc861_look_for_dac(codec, nid); |
| 14180 | if (!dac) |
| 14181 | continue; |
| 14182 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14183 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14184 | return 0; |
| 14185 | } |
| 14186 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14187 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 14188 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14189 | { |
| 14190 | char name[32]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14191 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 14192 | return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name, |
| 14193 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 14194 | } |
| 14195 | |
| 14196 | /* add playback controls from the parsed DAC table */ |
| 14197 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 14198 | const struct auto_pin_cfg *cfg) |
| 14199 | { |
| 14200 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14201 | static const char *chname[4] = { |
| 14202 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14203 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14204 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14205 | int i, err; |
| 14206 | |
| 14207 | if (cfg->line_outs == 1) { |
| 14208 | const char *pfx = NULL; |
| 14209 | if (!cfg->hp_outs) |
| 14210 | pfx = "Master"; |
| 14211 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 14212 | pfx = "Speaker"; |
| 14213 | if (pfx) { |
| 14214 | nid = spec->multiout.dac_nids[0]; |
| 14215 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 14216 | } |
| 14217 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14218 | |
| 14219 | for (i = 0; i < cfg->line_outs; i++) { |
| 14220 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14221 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14222 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14223 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14224 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14225 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14226 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14227 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14228 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14229 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14230 | return err; |
| 14231 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14232 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14233 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14234 | return err; |
| 14235 | } |
| 14236 | } |
| 14237 | return 0; |
| 14238 | } |
| 14239 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14240 | 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] | 14241 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14242 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14243 | int err; |
| 14244 | hda_nid_t nid; |
| 14245 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14246 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14247 | return 0; |
| 14248 | |
| 14249 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14250 | nid = alc861_look_for_dac(codec, pin); |
| 14251 | if (nid) { |
| 14252 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 14253 | if (err < 0) |
| 14254 | return err; |
| 14255 | spec->multiout.hp_nid = nid; |
| 14256 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14257 | } |
| 14258 | return 0; |
| 14259 | } |
| 14260 | |
| 14261 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14262 | static int alc861_auto_create_analog_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14263 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14264 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14265 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14266 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14267 | int i, err, idx, idx1; |
| 14268 | |
| 14269 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14270 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14271 | case 0x0c: |
| 14272 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14273 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14274 | break; |
| 14275 | case 0x0f: |
| 14276 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14277 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14278 | break; |
| 14279 | case 0x0d: |
| 14280 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14281 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14282 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14283 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14284 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14285 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14286 | break; |
| 14287 | case 0x11: |
| 14288 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14289 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14290 | break; |
| 14291 | default: |
| 14292 | continue; |
| 14293 | } |
| 14294 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14295 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14296 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14297 | if (err < 0) |
| 14298 | return err; |
| 14299 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14300 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14301 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14302 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14303 | } |
| 14304 | return 0; |
| 14305 | } |
| 14306 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14307 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14308 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14309 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14310 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14311 | hda_nid_t mix, srcs[5]; |
| 14312 | int i, num; |
| 14313 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14314 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14315 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14316 | 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] | 14317 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14318 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 14319 | return; |
| 14320 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14321 | if (num < 0) |
| 14322 | return; |
| 14323 | for (i = 0; i < num; i++) { |
| 14324 | unsigned int mute; |
| 14325 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 14326 | mute = AMP_IN_UNMUTE(i); |
| 14327 | else |
| 14328 | mute = AMP_IN_MUTE(i); |
| 14329 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14330 | mute); |
| 14331 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14332 | } |
| 14333 | |
| 14334 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14335 | { |
| 14336 | struct alc_spec *spec = codec->spec; |
| 14337 | int i; |
| 14338 | |
| 14339 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14340 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14341 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14342 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14343 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14344 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14345 | } |
| 14346 | } |
| 14347 | |
| 14348 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14349 | { |
| 14350 | struct alc_spec *spec = codec->spec; |
| 14351 | hda_nid_t pin; |
| 14352 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 14353 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14354 | if (pin) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14355 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14356 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14357 | pin = spec->autocfg.speaker_pins[0]; |
| 14358 | if (pin) |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14359 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 14360 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14361 | } |
| 14362 | |
| 14363 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14364 | { |
| 14365 | struct alc_spec *spec = codec->spec; |
| 14366 | int i; |
| 14367 | |
| 14368 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14369 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14370 | if (nid >= 0x0c && nid <= 0x11) |
| 14371 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14372 | } |
| 14373 | } |
| 14374 | |
| 14375 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14376 | /* return 1 if successful, 0 if the proper config is not found, |
| 14377 | * or a negative error code |
| 14378 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14379 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14380 | { |
| 14381 | struct alc_spec *spec = codec->spec; |
| 14382 | int err; |
| 14383 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14384 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14385 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14386 | alc861_ignore); |
| 14387 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14388 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14389 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14390 | return 0; /* can't find valid BIOS pin config */ |
| 14391 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14392 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14393 | if (err < 0) |
| 14394 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14395 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14396 | if (err < 0) |
| 14397 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14398 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14399 | if (err < 0) |
| 14400 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14401 | err = alc861_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14402 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14403 | return err; |
| 14404 | |
| 14405 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14406 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14407 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14408 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14409 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14410 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14411 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14412 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14413 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14414 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14415 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14416 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14417 | |
| 14418 | spec->adc_nids = alc861_adc_nids; |
| 14419 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14420 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14421 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14422 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14423 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14424 | return 1; |
| 14425 | } |
| 14426 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14427 | /* additional initialization for auto-configuration model */ |
| 14428 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14429 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14430 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14431 | alc861_auto_init_multi_out(codec); |
| 14432 | alc861_auto_init_hp_out(codec); |
| 14433 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14434 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14435 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14436 | } |
| 14437 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14438 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14439 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14440 | { 0x15, HDA_INPUT, 0 }, |
| 14441 | { 0x15, HDA_INPUT, 1 }, |
| 14442 | { 0x15, HDA_INPUT, 2 }, |
| 14443 | { 0x15, HDA_INPUT, 3 }, |
| 14444 | { } /* end */ |
| 14445 | }; |
| 14446 | #endif |
| 14447 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14448 | |
| 14449 | /* |
| 14450 | * configuration and preset |
| 14451 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14452 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14453 | [ALC861_3ST] = "3stack", |
| 14454 | [ALC660_3ST] = "3stack-660", |
| 14455 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14456 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14457 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14458 | [ALC861_TOSHIBA] = "toshiba", |
| 14459 | [ALC861_ASUS] = "asus", |
| 14460 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14461 | [ALC861_AUTO] = "auto", |
| 14462 | }; |
| 14463 | |
| 14464 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14465 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14466 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14467 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14468 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14469 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14470 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14471 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14472 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14473 | * Any other models that need this preset? |
| 14474 | */ |
| 14475 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14476 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14477 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14478 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14479 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14480 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14481 | /* FIXME: the below seems conflict */ |
| 14482 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14483 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14484 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14485 | {} |
| 14486 | }; |
| 14487 | |
| 14488 | static struct alc_config_preset alc861_presets[] = { |
| 14489 | [ALC861_3ST] = { |
| 14490 | .mixers = { alc861_3ST_mixer }, |
| 14491 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14492 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14493 | .dac_nids = alc861_dac_nids, |
| 14494 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14495 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14496 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14497 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14498 | .adc_nids = alc861_adc_nids, |
| 14499 | .input_mux = &alc861_capture_source, |
| 14500 | }, |
| 14501 | [ALC861_3ST_DIG] = { |
| 14502 | .mixers = { alc861_base_mixer }, |
| 14503 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14504 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14505 | .dac_nids = alc861_dac_nids, |
| 14506 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14507 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14508 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14509 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14510 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14511 | .adc_nids = alc861_adc_nids, |
| 14512 | .input_mux = &alc861_capture_source, |
| 14513 | }, |
| 14514 | [ALC861_6ST_DIG] = { |
| 14515 | .mixers = { alc861_base_mixer }, |
| 14516 | .init_verbs = { alc861_base_init_verbs }, |
| 14517 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14518 | .dac_nids = alc861_dac_nids, |
| 14519 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14520 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14521 | .channel_mode = alc861_8ch_modes, |
| 14522 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14523 | .adc_nids = alc861_adc_nids, |
| 14524 | .input_mux = &alc861_capture_source, |
| 14525 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14526 | [ALC660_3ST] = { |
| 14527 | .mixers = { alc861_3ST_mixer }, |
| 14528 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14529 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14530 | .dac_nids = alc660_dac_nids, |
| 14531 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14532 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14533 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14534 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14535 | .adc_nids = alc861_adc_nids, |
| 14536 | .input_mux = &alc861_capture_source, |
| 14537 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14538 | [ALC861_UNIWILL_M31] = { |
| 14539 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14540 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14541 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14542 | .dac_nids = alc861_dac_nids, |
| 14543 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14544 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14545 | .channel_mode = alc861_uniwill_m31_modes, |
| 14546 | .need_dac_fix = 1, |
| 14547 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14548 | .adc_nids = alc861_adc_nids, |
| 14549 | .input_mux = &alc861_capture_source, |
| 14550 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14551 | [ALC861_TOSHIBA] = { |
| 14552 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14553 | .init_verbs = { alc861_base_init_verbs, |
| 14554 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14555 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14556 | .dac_nids = alc861_dac_nids, |
| 14557 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14558 | .channel_mode = alc883_3ST_2ch_modes, |
| 14559 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14560 | .adc_nids = alc861_adc_nids, |
| 14561 | .input_mux = &alc861_capture_source, |
| 14562 | .unsol_event = alc861_toshiba_unsol_event, |
| 14563 | .init_hook = alc861_toshiba_automute, |
| 14564 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14565 | [ALC861_ASUS] = { |
| 14566 | .mixers = { alc861_asus_mixer }, |
| 14567 | .init_verbs = { alc861_asus_init_verbs }, |
| 14568 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14569 | .dac_nids = alc861_dac_nids, |
| 14570 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14571 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14572 | .channel_mode = alc861_asus_modes, |
| 14573 | .need_dac_fix = 1, |
| 14574 | .hp_nid = 0x06, |
| 14575 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14576 | .adc_nids = alc861_adc_nids, |
| 14577 | .input_mux = &alc861_capture_source, |
| 14578 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14579 | [ALC861_ASUS_LAPTOP] = { |
| 14580 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14581 | .init_verbs = { alc861_asus_init_verbs, |
| 14582 | alc861_asus_laptop_init_verbs }, |
| 14583 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14584 | .dac_nids = alc861_dac_nids, |
| 14585 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14586 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14587 | .channel_mode = alc883_3ST_2ch_modes, |
| 14588 | .need_dac_fix = 1, |
| 14589 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14590 | .adc_nids = alc861_adc_nids, |
| 14591 | .input_mux = &alc861_capture_source, |
| 14592 | }, |
| 14593 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14594 | |
| 14595 | |
| 14596 | static int patch_alc861(struct hda_codec *codec) |
| 14597 | { |
| 14598 | struct alc_spec *spec; |
| 14599 | int board_config; |
| 14600 | int err; |
| 14601 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14602 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14603 | if (spec == NULL) |
| 14604 | return -ENOMEM; |
| 14605 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14606 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14607 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14608 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14609 | alc861_models, |
| 14610 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14611 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14612 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14613 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14614 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14615 | board_config = ALC861_AUTO; |
| 14616 | } |
| 14617 | |
| 14618 | if (board_config == ALC861_AUTO) { |
| 14619 | /* automatic parse from the BIOS config */ |
| 14620 | err = alc861_parse_auto_config(codec); |
| 14621 | if (err < 0) { |
| 14622 | alc_free(codec); |
| 14623 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14624 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14625 | printk(KERN_INFO |
| 14626 | "hda_codec: Cannot set up configuration " |
| 14627 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14628 | board_config = ALC861_3ST_DIG; |
| 14629 | } |
| 14630 | } |
| 14631 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14632 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14633 | if (err < 0) { |
| 14634 | alc_free(codec); |
| 14635 | return err; |
| 14636 | } |
| 14637 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14638 | if (board_config != ALC861_AUTO) |
| 14639 | setup_preset(spec, &alc861_presets[board_config]); |
| 14640 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14641 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14642 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14643 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14644 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14645 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14646 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14647 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14648 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14649 | spec->vmaster_nid = 0x03; |
| 14650 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14651 | codec->patch_ops = alc_patch_ops; |
| 14652 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14653 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14654 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14655 | if (!spec->loopback.amplist) |
| 14656 | spec->loopback.amplist = alc861_loopbacks; |
| 14657 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14658 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14659 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14660 | return 0; |
| 14661 | } |
| 14662 | |
| 14663 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14664 | * ALC861-VD support |
| 14665 | * |
| 14666 | * Based on ALC882 |
| 14667 | * |
| 14668 | * In addition, an independent DAC |
| 14669 | */ |
| 14670 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14671 | |
| 14672 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14673 | /* front, surr, clfe, side surr */ |
| 14674 | 0x02, 0x03, 0x04, 0x05 |
| 14675 | }; |
| 14676 | |
| 14677 | /* dac_nids for ALC660vd are in a different order - according to |
| 14678 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14679 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14680 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14681 | * - and it is the same as in 861vd. |
| 14682 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14683 | */ |
| 14684 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14685 | /* front, rear, clfe, rear_surr */ |
| 14686 | 0x02, 0x04, 0x03 |
| 14687 | }; |
| 14688 | |
| 14689 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14690 | /* ADC0 */ |
| 14691 | 0x09, |
| 14692 | }; |
| 14693 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14694 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14695 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14696 | /* input MUX */ |
| 14697 | /* FIXME: should be a matrix-type input source selection */ |
| 14698 | static struct hda_input_mux alc861vd_capture_source = { |
| 14699 | .num_items = 4, |
| 14700 | .items = { |
| 14701 | { "Mic", 0x0 }, |
| 14702 | { "Front Mic", 0x1 }, |
| 14703 | { "Line", 0x2 }, |
| 14704 | { "CD", 0x4 }, |
| 14705 | }, |
| 14706 | }; |
| 14707 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14708 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14709 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14710 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14711 | { "Ext Mic", 0x0 }, |
| 14712 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14713 | }, |
| 14714 | }; |
| 14715 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14716 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14717 | .num_items = 2, |
| 14718 | .items = { |
| 14719 | { "Front Mic", 0x0 }, |
| 14720 | { "ATAPI Mic", 0x1 }, |
| 14721 | }, |
| 14722 | }; |
| 14723 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14724 | /* |
| 14725 | * 2ch mode |
| 14726 | */ |
| 14727 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14728 | { 2, NULL } |
| 14729 | }; |
| 14730 | |
| 14731 | /* |
| 14732 | * 6ch mode |
| 14733 | */ |
| 14734 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14735 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14736 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14737 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14738 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14739 | { } /* end */ |
| 14740 | }; |
| 14741 | |
| 14742 | /* |
| 14743 | * 8ch mode |
| 14744 | */ |
| 14745 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14746 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14747 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14748 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14749 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14750 | { } /* end */ |
| 14751 | }; |
| 14752 | |
| 14753 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14754 | { 6, alc861vd_6stack_ch6_init }, |
| 14755 | { 8, alc861vd_6stack_ch8_init }, |
| 14756 | }; |
| 14757 | |
| 14758 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14759 | { |
| 14760 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14761 | .name = "Channel Mode", |
| 14762 | .info = alc_ch_mode_info, |
| 14763 | .get = alc_ch_mode_get, |
| 14764 | .put = alc_ch_mode_put, |
| 14765 | }, |
| 14766 | { } /* end */ |
| 14767 | }; |
| 14768 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14769 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14770 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14771 | */ |
| 14772 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14773 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14774 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14775 | |
| 14776 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14777 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14778 | |
| 14779 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14780 | HDA_OUTPUT), |
| 14781 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14782 | HDA_OUTPUT), |
| 14783 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14784 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14785 | |
| 14786 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14787 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14788 | |
| 14789 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14790 | |
| 14791 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14792 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14793 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14794 | |
| 14795 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14796 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14797 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14798 | |
| 14799 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14800 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14801 | |
| 14802 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14803 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14804 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14805 | { } /* end */ |
| 14806 | }; |
| 14807 | |
| 14808 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14809 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14810 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14811 | |
| 14812 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14813 | |
| 14814 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14815 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14816 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14817 | |
| 14818 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14819 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14820 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14821 | |
| 14822 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14823 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14824 | |
| 14825 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14826 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14827 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14828 | { } /* end */ |
| 14829 | }; |
| 14830 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14831 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14832 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14833 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14834 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14835 | |
| 14836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14837 | |
| 14838 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14839 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14840 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14841 | |
| 14842 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14843 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14844 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14845 | |
| 14846 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14847 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14848 | |
| 14849 | { } /* end */ |
| 14850 | }; |
| 14851 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14852 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14853 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14854 | */ |
| 14855 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14856 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14857 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14858 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14859 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14860 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14861 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14862 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14863 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14864 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14865 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14866 | { } /* end */ |
| 14867 | }; |
| 14868 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14869 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14870 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14871 | */ |
| 14872 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14873 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14874 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14875 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14876 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14877 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14878 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14879 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14880 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14881 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14882 | { } /* end */ |
| 14883 | }; |
| 14884 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14885 | /* |
| 14886 | * generic initialization of ADC, input mixers and output mixers |
| 14887 | */ |
| 14888 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14889 | /* |
| 14890 | * Unmute ADC0 and set the default input to mic-in |
| 14891 | */ |
| 14892 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14893 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14894 | |
| 14895 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14896 | * the analog-loopback mixer widget |
| 14897 | */ |
| 14898 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14899 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14900 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14901 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14902 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14903 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14904 | |
| 14905 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14906 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14907 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14908 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14909 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14910 | |
| 14911 | /* |
| 14912 | * Set up output mixers (0x02 - 0x05) |
| 14913 | */ |
| 14914 | /* set vol=0 to output mixers */ |
| 14915 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14916 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14917 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14918 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14919 | |
| 14920 | /* set up input amps for analog loopback */ |
| 14921 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14922 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14923 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14924 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14925 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14926 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14927 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14928 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14929 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14930 | |
| 14931 | { } |
| 14932 | }; |
| 14933 | |
| 14934 | /* |
| 14935 | * 3-stack pin configuration: |
| 14936 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14937 | */ |
| 14938 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14939 | /* |
| 14940 | * Set pin mode and muting |
| 14941 | */ |
| 14942 | /* set front pin widgets 0x14 for output */ |
| 14943 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14944 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14945 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14946 | |
| 14947 | /* Mic (rear) pin: input vref at 80% */ |
| 14948 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14949 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14950 | /* Front Mic pin: input vref at 80% */ |
| 14951 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14952 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14953 | /* Line In pin: input */ |
| 14954 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14955 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14956 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14957 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14958 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14959 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14960 | /* CD pin widget for input */ |
| 14961 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14962 | |
| 14963 | { } |
| 14964 | }; |
| 14965 | |
| 14966 | /* |
| 14967 | * 6-stack pin configuration: |
| 14968 | */ |
| 14969 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14970 | /* |
| 14971 | * Set pin mode and muting |
| 14972 | */ |
| 14973 | /* set front pin widgets 0x14 for output */ |
| 14974 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14975 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14976 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14977 | |
| 14978 | /* Rear Pin: output 1 (0x0d) */ |
| 14979 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14980 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14981 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14982 | /* CLFE Pin: output 2 (0x0e) */ |
| 14983 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14984 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14985 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14986 | /* Side Pin: output 3 (0x0f) */ |
| 14987 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14988 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14989 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14990 | |
| 14991 | /* Mic (rear) pin: input vref at 80% */ |
| 14992 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14993 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14994 | /* Front Mic pin: input vref at 80% */ |
| 14995 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14996 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14997 | /* Line In pin: input */ |
| 14998 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14999 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15000 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15001 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15002 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15003 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15004 | /* CD pin widget for input */ |
| 15005 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15006 | |
| 15007 | { } |
| 15008 | }; |
| 15009 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15010 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 15011 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15012 | { } |
| 15013 | }; |
| 15014 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15015 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 15016 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15017 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15018 | { } |
| 15019 | }; |
| 15020 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15021 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 15022 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15023 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15024 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 15025 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15026 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15027 | {} |
| 15028 | }; |
| 15029 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15030 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 15031 | { |
| 15032 | unsigned int present; |
| 15033 | unsigned char bits; |
| 15034 | |
| 15035 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15036 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15037 | bits = present ? HDA_AMP_MUTE : 0; |
| 15038 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15039 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15040 | } |
| 15041 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15042 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15043 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15044 | struct alc_spec *spec = codec->spec; |
| 15045 | |
| 15046 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15047 | spec->autocfg.speaker_pins[0] = 0x14; |
| 15048 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15049 | alc861vd_lenovo_mic_automute(codec); |
| 15050 | } |
| 15051 | |
| 15052 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15053 | unsigned int res) |
| 15054 | { |
| 15055 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15056 | case ALC880_MIC_EVENT: |
| 15057 | alc861vd_lenovo_mic_automute(codec); |
| 15058 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15059 | default: |
| 15060 | alc_automute_amp_unsol_event(codec, res); |
| 15061 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15062 | } |
| 15063 | } |
| 15064 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15065 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15066 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15067 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15068 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15069 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15070 | |
| 15071 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15072 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15073 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15074 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15075 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15076 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15077 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15078 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15079 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15080 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15081 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15082 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15083 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15084 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15085 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15086 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15087 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15088 | |
| 15089 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15090 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15091 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15092 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15093 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15094 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15095 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15096 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15097 | |
| 15098 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15099 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15101 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15102 | |
| 15103 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15104 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15105 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15106 | |
| 15107 | { } /* end */ |
| 15108 | }; |
| 15109 | |
| 15110 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15111 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15112 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15113 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15114 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15115 | spec->autocfg.hp_pins[0] = 0x15; |
| 15116 | spec->autocfg.speaker_pins[0] = 0x14; |
| 15117 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15118 | } |
| 15119 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15120 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15121 | #define alc861vd_loopbacks alc880_loopbacks |
| 15122 | #endif |
| 15123 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15124 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15125 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15126 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15127 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15128 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15129 | |
| 15130 | /* |
| 15131 | * configuration and preset |
| 15132 | */ |
| 15133 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15134 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15135 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15136 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15137 | [ALC861VD_3ST] = "3stack", |
| 15138 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15139 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15140 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15141 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15142 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15143 | [ALC861VD_AUTO] = "auto", |
| 15144 | }; |
| 15145 | |
| 15146 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15147 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15148 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15149 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15150 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15151 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15152 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15153 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15154 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15155 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 15156 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15157 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15158 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15159 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15160 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15161 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15162 | {} |
| 15163 | }; |
| 15164 | |
| 15165 | static struct alc_config_preset alc861vd_presets[] = { |
| 15166 | [ALC660VD_3ST] = { |
| 15167 | .mixers = { alc861vd_3st_mixer }, |
| 15168 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15169 | alc861vd_3stack_init_verbs }, |
| 15170 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15171 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15172 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15173 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15174 | .input_mux = &alc861vd_capture_source, |
| 15175 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15176 | [ALC660VD_3ST_DIG] = { |
| 15177 | .mixers = { alc861vd_3st_mixer }, |
| 15178 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15179 | alc861vd_3stack_init_verbs }, |
| 15180 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15181 | .dac_nids = alc660vd_dac_nids, |
| 15182 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15183 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15184 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15185 | .input_mux = &alc861vd_capture_source, |
| 15186 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15187 | [ALC861VD_3ST] = { |
| 15188 | .mixers = { alc861vd_3st_mixer }, |
| 15189 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15190 | alc861vd_3stack_init_verbs }, |
| 15191 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15192 | .dac_nids = alc861vd_dac_nids, |
| 15193 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15194 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15195 | .input_mux = &alc861vd_capture_source, |
| 15196 | }, |
| 15197 | [ALC861VD_3ST_DIG] = { |
| 15198 | .mixers = { alc861vd_3st_mixer }, |
| 15199 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15200 | alc861vd_3stack_init_verbs }, |
| 15201 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15202 | .dac_nids = alc861vd_dac_nids, |
| 15203 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15204 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15205 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15206 | .input_mux = &alc861vd_capture_source, |
| 15207 | }, |
| 15208 | [ALC861VD_6ST_DIG] = { |
| 15209 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15210 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15211 | alc861vd_6stack_init_verbs }, |
| 15212 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15213 | .dac_nids = alc861vd_dac_nids, |
| 15214 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15215 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15216 | .channel_mode = alc861vd_6stack_modes, |
| 15217 | .input_mux = &alc861vd_capture_source, |
| 15218 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15219 | [ALC861VD_LENOVO] = { |
| 15220 | .mixers = { alc861vd_lenovo_mixer }, |
| 15221 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15222 | alc861vd_3stack_init_verbs, |
| 15223 | alc861vd_eapd_verbs, |
| 15224 | alc861vd_lenovo_unsol_verbs }, |
| 15225 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15226 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15227 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15228 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15229 | .input_mux = &alc861vd_capture_source, |
| 15230 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15231 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15232 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15233 | [ALC861VD_DALLAS] = { |
| 15234 | .mixers = { alc861vd_dallas_mixer }, |
| 15235 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15236 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15237 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15238 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15239 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15240 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15241 | .unsol_event = alc_automute_amp_unsol_event, |
| 15242 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15243 | }, |
| 15244 | [ALC861VD_HP] = { |
| 15245 | .mixers = { alc861vd_hp_mixer }, |
| 15246 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15247 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15248 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15249 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15250 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15251 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15252 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15253 | .unsol_event = alc_automute_amp_unsol_event, |
| 15254 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15255 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15256 | [ALC660VD_ASUS_V1S] = { |
| 15257 | .mixers = { alc861vd_lenovo_mixer }, |
| 15258 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15259 | alc861vd_3stack_init_verbs, |
| 15260 | alc861vd_eapd_verbs, |
| 15261 | alc861vd_lenovo_unsol_verbs }, |
| 15262 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15263 | .dac_nids = alc660vd_dac_nids, |
| 15264 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15265 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15266 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15267 | .input_mux = &alc861vd_capture_source, |
| 15268 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15269 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15270 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15271 | }; |
| 15272 | |
| 15273 | /* |
| 15274 | * BIOS auto configuration |
| 15275 | */ |
| 15276 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15277 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15278 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15279 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15280 | } |
| 15281 | |
| 15282 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15283 | { |
| 15284 | struct alc_spec *spec = codec->spec; |
| 15285 | int i; |
| 15286 | |
| 15287 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15288 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15289 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15290 | if (nid) |
| 15291 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15292 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15293 | } |
| 15294 | } |
| 15295 | |
| 15296 | |
| 15297 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15298 | { |
| 15299 | struct alc_spec *spec = codec->spec; |
| 15300 | hda_nid_t pin; |
| 15301 | |
| 15302 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15303 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15304 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15305 | pin = spec->autocfg.speaker_pins[0]; |
| 15306 | if (pin) |
| 15307 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15308 | } |
| 15309 | |
| 15310 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 15311 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15312 | |
| 15313 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15314 | { |
| 15315 | struct alc_spec *spec = codec->spec; |
| 15316 | int i; |
| 15317 | |
| 15318 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15319 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 15320 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15321 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15322 | if (nid != ALC861VD_PIN_CD_NID && |
| 15323 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15324 | snd_hda_codec_write(codec, nid, 0, |
| 15325 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15326 | AMP_OUT_MUTE); |
| 15327 | } |
| 15328 | } |
| 15329 | } |
| 15330 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15331 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15332 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15333 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15334 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15335 | |
| 15336 | /* add playback controls from the parsed DAC table */ |
| 15337 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15338 | * different NIDs for mute/unmute switch and volume control */ |
| 15339 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15340 | const struct auto_pin_cfg *cfg) |
| 15341 | { |
| 15342 | char name[32]; |
| 15343 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15344 | hda_nid_t nid_v, nid_s; |
| 15345 | int i, err; |
| 15346 | |
| 15347 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15348 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15349 | continue; |
| 15350 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15351 | alc880_dac_to_idx( |
| 15352 | spec->multiout.dac_nids[i])); |
| 15353 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15354 | alc880_dac_to_idx( |
| 15355 | spec->multiout.dac_nids[i])); |
| 15356 | |
| 15357 | if (i == 2) { |
| 15358 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15359 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15360 | "Center Playback Volume", |
| 15361 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15362 | HDA_OUTPUT)); |
| 15363 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15364 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15365 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15366 | "LFE Playback Volume", |
| 15367 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15368 | HDA_OUTPUT)); |
| 15369 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15370 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15371 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15372 | "Center Playback Switch", |
| 15373 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15374 | HDA_INPUT)); |
| 15375 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15376 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15377 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15378 | "LFE Playback Switch", |
| 15379 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15380 | HDA_INPUT)); |
| 15381 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15382 | return err; |
| 15383 | } else { |
| 15384 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15385 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15386 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15387 | HDA_OUTPUT)); |
| 15388 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15389 | return err; |
| 15390 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15391 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15392 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15393 | HDA_INPUT)); |
| 15394 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15395 | return err; |
| 15396 | } |
| 15397 | } |
| 15398 | return 0; |
| 15399 | } |
| 15400 | |
| 15401 | /* add playback controls for speaker and HP outputs */ |
| 15402 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15403 | * different NIDs for mute/unmute switch and volume control */ |
| 15404 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15405 | hda_nid_t pin, const char *pfx) |
| 15406 | { |
| 15407 | hda_nid_t nid_v, nid_s; |
| 15408 | int err; |
| 15409 | char name[32]; |
| 15410 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15411 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15412 | return 0; |
| 15413 | |
| 15414 | if (alc880_is_fixed_pin(pin)) { |
| 15415 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15416 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15417 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15418 | spec->multiout.hp_nid = nid_v; |
| 15419 | else |
| 15420 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15421 | /* control HP volume/switch on the output mixer amp */ |
| 15422 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15423 | alc880_fixed_pin_idx(pin)); |
| 15424 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15425 | alc880_fixed_pin_idx(pin)); |
| 15426 | |
| 15427 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15428 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15429 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15430 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15431 | return err; |
| 15432 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15433 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15434 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15435 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15436 | return err; |
| 15437 | } else if (alc880_is_multi_pin(pin)) { |
| 15438 | /* set manual connection */ |
| 15439 | /* we have only a switch on HP-out PIN */ |
| 15440 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15441 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15442 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15443 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15444 | return err; |
| 15445 | } |
| 15446 | return 0; |
| 15447 | } |
| 15448 | |
| 15449 | /* parse the BIOS configuration and set up the alc_spec |
| 15450 | * return 1 if successful, 0 if the proper config is not found, |
| 15451 | * or a negative error code |
| 15452 | * Based on ALC880 version - had to change it to override |
| 15453 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15454 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15455 | { |
| 15456 | struct alc_spec *spec = codec->spec; |
| 15457 | int err; |
| 15458 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15459 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15460 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15461 | alc861vd_ignore); |
| 15462 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15463 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15464 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15465 | return 0; /* can't find valid BIOS pin config */ |
| 15466 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15467 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15468 | if (err < 0) |
| 15469 | return err; |
| 15470 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15471 | if (err < 0) |
| 15472 | return err; |
| 15473 | err = alc861vd_auto_create_extra_out(spec, |
| 15474 | spec->autocfg.speaker_pins[0], |
| 15475 | "Speaker"); |
| 15476 | if (err < 0) |
| 15477 | return err; |
| 15478 | err = alc861vd_auto_create_extra_out(spec, |
| 15479 | spec->autocfg.hp_pins[0], |
| 15480 | "Headphone"); |
| 15481 | if (err < 0) |
| 15482 | return err; |
| 15483 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15484 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15485 | return err; |
| 15486 | |
| 15487 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15488 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15489 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15490 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15491 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15492 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15493 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15494 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15495 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15496 | |
| 15497 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15498 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15499 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15500 | err = alc_auto_add_mic_boost(codec); |
| 15501 | if (err < 0) |
| 15502 | return err; |
| 15503 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15504 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15505 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15506 | return 1; |
| 15507 | } |
| 15508 | |
| 15509 | /* additional initialization for auto-configuration model */ |
| 15510 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15511 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15512 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15513 | alc861vd_auto_init_multi_out(codec); |
| 15514 | alc861vd_auto_init_hp_out(codec); |
| 15515 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15516 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15517 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15518 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15519 | } |
| 15520 | |
| 15521 | static int patch_alc861vd(struct hda_codec *codec) |
| 15522 | { |
| 15523 | struct alc_spec *spec; |
| 15524 | int err, board_config; |
| 15525 | |
| 15526 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15527 | if (spec == NULL) |
| 15528 | return -ENOMEM; |
| 15529 | |
| 15530 | codec->spec = spec; |
| 15531 | |
| 15532 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15533 | alc861vd_models, |
| 15534 | alc861vd_cfg_tbl); |
| 15535 | |
| 15536 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15537 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15538 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15539 | board_config = ALC861VD_AUTO; |
| 15540 | } |
| 15541 | |
| 15542 | if (board_config == ALC861VD_AUTO) { |
| 15543 | /* automatic parse from the BIOS config */ |
| 15544 | err = alc861vd_parse_auto_config(codec); |
| 15545 | if (err < 0) { |
| 15546 | alc_free(codec); |
| 15547 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15548 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15549 | printk(KERN_INFO |
| 15550 | "hda_codec: Cannot set up configuration " |
| 15551 | "from BIOS. Using base mode...\n"); |
| 15552 | board_config = ALC861VD_3ST; |
| 15553 | } |
| 15554 | } |
| 15555 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15556 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15557 | if (err < 0) { |
| 15558 | alc_free(codec); |
| 15559 | return err; |
| 15560 | } |
| 15561 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15562 | if (board_config != ALC861VD_AUTO) |
| 15563 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15564 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15565 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15566 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15567 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15568 | } |
| 15569 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15570 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15571 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15572 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15573 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15574 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15575 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 15576 | if (!spec->adc_nids) { |
| 15577 | spec->adc_nids = alc861vd_adc_nids; |
| 15578 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 15579 | } |
| 15580 | if (!spec->capsrc_nids) |
| 15581 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15582 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15583 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15584 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15585 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15586 | spec->vmaster_nid = 0x02; |
| 15587 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15588 | codec->patch_ops = alc_patch_ops; |
| 15589 | |
| 15590 | if (board_config == ALC861VD_AUTO) |
| 15591 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15592 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15593 | if (!spec->loopback.amplist) |
| 15594 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15595 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15596 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15597 | |
| 15598 | return 0; |
| 15599 | } |
| 15600 | |
| 15601 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15602 | * ALC662 support |
| 15603 | * |
| 15604 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15605 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15606 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15607 | * 6-channel independent captures. |
| 15608 | * |
| 15609 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15610 | * driver yet). |
| 15611 | */ |
| 15612 | #define ALC662_DIGOUT_NID 0x06 |
| 15613 | #define ALC662_DIGIN_NID 0x0a |
| 15614 | |
| 15615 | static hda_nid_t alc662_dac_nids[4] = { |
| 15616 | /* front, rear, clfe, rear_surr */ |
| 15617 | 0x02, 0x03, 0x04 |
| 15618 | }; |
| 15619 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15620 | static hda_nid_t alc272_dac_nids[2] = { |
| 15621 | 0x02, 0x03 |
| 15622 | }; |
| 15623 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15624 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15625 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15626 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15627 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15628 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15629 | static hda_nid_t alc272_adc_nids[1] = { |
| 15630 | /* ADC1-2 */ |
| 15631 | 0x08, |
| 15632 | }; |
| 15633 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15634 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15635 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15636 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15637 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15638 | /* input MUX */ |
| 15639 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15640 | static struct hda_input_mux alc662_capture_source = { |
| 15641 | .num_items = 4, |
| 15642 | .items = { |
| 15643 | { "Mic", 0x0 }, |
| 15644 | { "Front Mic", 0x1 }, |
| 15645 | { "Line", 0x2 }, |
| 15646 | { "CD", 0x4 }, |
| 15647 | }, |
| 15648 | }; |
| 15649 | |
| 15650 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15651 | .num_items = 2, |
| 15652 | .items = { |
| 15653 | { "Mic", 0x1 }, |
| 15654 | { "Line", 0x2 }, |
| 15655 | }, |
| 15656 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15657 | |
| 15658 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15659 | .num_items = 2, |
| 15660 | .items = { |
| 15661 | { "i-Mic", 0x1 }, |
| 15662 | { "e-Mic", 0x0 }, |
| 15663 | }, |
| 15664 | }; |
| 15665 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15666 | static struct hda_input_mux alc663_capture_source = { |
| 15667 | .num_items = 3, |
| 15668 | .items = { |
| 15669 | { "Mic", 0x0 }, |
| 15670 | { "Front Mic", 0x1 }, |
| 15671 | { "Line", 0x2 }, |
| 15672 | }, |
| 15673 | }; |
| 15674 | |
| 15675 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15676 | .num_items = 2, |
| 15677 | .items = { |
| 15678 | { "Ext-Mic", 0x0 }, |
| 15679 | { "D-Mic", 0x9 }, |
| 15680 | }, |
| 15681 | }; |
| 15682 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15683 | #if 1 /* set to 0 for testing other input sources below */ |
| 15684 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15685 | .num_items = 2, |
| 15686 | .items = { |
| 15687 | { "Autoselect Mic", 0x0 }, |
| 15688 | { "Internal Mic", 0x1 }, |
| 15689 | }, |
| 15690 | }; |
| 15691 | #else |
| 15692 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15693 | .num_items = 16, |
| 15694 | .items = { |
| 15695 | { "Autoselect Mic", 0x0 }, |
| 15696 | { "Internal Mic", 0x1 }, |
| 15697 | { "In-0x02", 0x2 }, |
| 15698 | { "In-0x03", 0x3 }, |
| 15699 | { "In-0x04", 0x4 }, |
| 15700 | { "In-0x05", 0x5 }, |
| 15701 | { "In-0x06", 0x6 }, |
| 15702 | { "In-0x07", 0x7 }, |
| 15703 | { "In-0x08", 0x8 }, |
| 15704 | { "In-0x09", 0x9 }, |
| 15705 | { "In-0x0a", 0x0a }, |
| 15706 | { "In-0x0b", 0x0b }, |
| 15707 | { "In-0x0c", 0x0c }, |
| 15708 | { "In-0x0d", 0x0d }, |
| 15709 | { "In-0x0e", 0x0e }, |
| 15710 | { "In-0x0f", 0x0f }, |
| 15711 | }, |
| 15712 | }; |
| 15713 | #endif |
| 15714 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15715 | /* |
| 15716 | * 2ch mode |
| 15717 | */ |
| 15718 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15719 | { 2, NULL } |
| 15720 | }; |
| 15721 | |
| 15722 | /* |
| 15723 | * 2ch mode |
| 15724 | */ |
| 15725 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15726 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15727 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15728 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15729 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15730 | { } /* end */ |
| 15731 | }; |
| 15732 | |
| 15733 | /* |
| 15734 | * 6ch mode |
| 15735 | */ |
| 15736 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15737 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15738 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15739 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15740 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15741 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15742 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15743 | { } /* end */ |
| 15744 | }; |
| 15745 | |
| 15746 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15747 | { 2, alc662_3ST_ch2_init }, |
| 15748 | { 6, alc662_3ST_ch6_init }, |
| 15749 | }; |
| 15750 | |
| 15751 | /* |
| 15752 | * 2ch mode |
| 15753 | */ |
| 15754 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15755 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15756 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15757 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15758 | { } /* end */ |
| 15759 | }; |
| 15760 | |
| 15761 | /* |
| 15762 | * 6ch mode |
| 15763 | */ |
| 15764 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15765 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15766 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15767 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15768 | { } /* end */ |
| 15769 | }; |
| 15770 | |
| 15771 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15772 | { 2, alc662_sixstack_ch6_init }, |
| 15773 | { 6, alc662_sixstack_ch8_init }, |
| 15774 | }; |
| 15775 | |
| 15776 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15777 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15778 | */ |
| 15779 | |
| 15780 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15781 | /* output mixer control */ |
| 15782 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15783 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15784 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15785 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15786 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15787 | 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] | 15788 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15789 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15790 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15791 | |
| 15792 | /*Input mixer control */ |
| 15793 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15794 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15795 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15796 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15797 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15798 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15799 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15800 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15801 | { } /* end */ |
| 15802 | }; |
| 15803 | |
| 15804 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15805 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15806 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15807 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15808 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15809 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15810 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15811 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15812 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15813 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15814 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15815 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15816 | { } /* end */ |
| 15817 | }; |
| 15818 | |
| 15819 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15820 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15821 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15822 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15823 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15824 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15825 | 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] | 15826 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15827 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15828 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15829 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15830 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15831 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15832 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15833 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15835 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15836 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15837 | { } /* end */ |
| 15838 | }; |
| 15839 | |
| 15840 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15841 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15842 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15843 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15844 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15845 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15846 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15847 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15848 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15849 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15850 | { } /* end */ |
| 15851 | }; |
| 15852 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15853 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15854 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15855 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15856 | |
| 15857 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15858 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15859 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15860 | |
| 15861 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15862 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15863 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15864 | { } /* end */ |
| 15865 | }; |
| 15866 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15867 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15868 | ALC262_HIPPO_MASTER_SWITCH, |
| 15869 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15870 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15871 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15872 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15873 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15874 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15875 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15876 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15877 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15878 | { } /* end */ |
| 15879 | }; |
| 15880 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15881 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15882 | .ops = &snd_hda_bind_vol, |
| 15883 | .values = { |
| 15884 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15885 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15886 | 0 |
| 15887 | }, |
| 15888 | }; |
| 15889 | |
| 15890 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15891 | .ops = &snd_hda_bind_sw, |
| 15892 | .values = { |
| 15893 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15894 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15895 | 0 |
| 15896 | }, |
| 15897 | }; |
| 15898 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15899 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15900 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15901 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15902 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15903 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15904 | { } /* end */ |
| 15905 | }; |
| 15906 | |
| 15907 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15908 | .ops = &snd_hda_bind_sw, |
| 15909 | .values = { |
| 15910 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15911 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15912 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15913 | 0 |
| 15914 | }, |
| 15915 | }; |
| 15916 | |
| 15917 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15918 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15919 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15920 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15921 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15922 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15923 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15924 | |
| 15925 | { } /* end */ |
| 15926 | }; |
| 15927 | |
| 15928 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15929 | .ops = &snd_hda_bind_sw, |
| 15930 | .values = { |
| 15931 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15932 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15933 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15934 | 0 |
| 15935 | }, |
| 15936 | }; |
| 15937 | |
| 15938 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15939 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15940 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15941 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15942 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15943 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15944 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15945 | { } /* end */ |
| 15946 | }; |
| 15947 | |
| 15948 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15949 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15950 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15951 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15952 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15953 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15954 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15955 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15956 | { } /* end */ |
| 15957 | }; |
| 15958 | |
| 15959 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15960 | .ops = &snd_hda_bind_vol, |
| 15961 | .values = { |
| 15962 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15963 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15964 | 0 |
| 15965 | }, |
| 15966 | }; |
| 15967 | |
| 15968 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15969 | .ops = &snd_hda_bind_sw, |
| 15970 | .values = { |
| 15971 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15972 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15973 | 0 |
| 15974 | }, |
| 15975 | }; |
| 15976 | |
| 15977 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15978 | HDA_BIND_VOL("Master Playback Volume", |
| 15979 | &alc663_asus_two_bind_master_vol), |
| 15980 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15981 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15982 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15983 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15984 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15985 | { } /* end */ |
| 15986 | }; |
| 15987 | |
| 15988 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15989 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15990 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15991 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15992 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15995 | { } /* end */ |
| 15996 | }; |
| 15997 | |
| 15998 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15999 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16000 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16001 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16002 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16003 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16004 | |
| 16005 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16006 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16007 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16008 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16009 | { } /* end */ |
| 16010 | }; |
| 16011 | |
| 16012 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 16013 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16014 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16015 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16016 | |
| 16017 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16018 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16019 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16020 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16021 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16022 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16023 | { } /* end */ |
| 16024 | }; |
| 16025 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16026 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 16027 | { |
| 16028 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16029 | .name = "Channel Mode", |
| 16030 | .info = alc_ch_mode_info, |
| 16031 | .get = alc_ch_mode_get, |
| 16032 | .put = alc_ch_mode_put, |
| 16033 | }, |
| 16034 | { } /* end */ |
| 16035 | }; |
| 16036 | |
| 16037 | static struct hda_verb alc662_init_verbs[] = { |
| 16038 | /* ADC: mute amp left and right */ |
| 16039 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16040 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16041 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 16042 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16044 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16045 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16046 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16047 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16048 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16049 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16050 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16051 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16052 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16053 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16054 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16055 | |
| 16056 | /* Front Pin: output 0 (0x0c) */ |
| 16057 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16058 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16059 | |
| 16060 | /* Rear Pin: output 1 (0x0d) */ |
| 16061 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16062 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16063 | |
| 16064 | /* CLFE Pin: output 2 (0x0e) */ |
| 16065 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16066 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16067 | |
| 16068 | /* Mic (rear) pin: input vref at 80% */ |
| 16069 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16070 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16071 | /* Front Mic pin: input vref at 80% */ |
| 16072 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16073 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16074 | /* Line In pin: input */ |
| 16075 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16076 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16077 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16078 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16079 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16080 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16081 | /* CD pin widget for input */ |
| 16082 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16083 | |
| 16084 | /* FIXME: use matrix-type input source selection */ |
| 16085 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16086 | /* Input mixer */ |
| 16087 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16088 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16089 | |
| 16090 | /* always trun on EAPD */ |
| 16091 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16092 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16093 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16094 | { } |
| 16095 | }; |
| 16096 | |
| 16097 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 16098 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16099 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16100 | {} |
| 16101 | }; |
| 16102 | |
| 16103 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 16104 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16105 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16106 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16107 | }; |
| 16108 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16109 | /* Set Unsolicited Event*/ |
| 16110 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 16111 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16112 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16113 | {} |
| 16114 | }; |
| 16115 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16116 | /* |
| 16117 | * generic initialization of ADC, input mixers and output mixers |
| 16118 | */ |
| 16119 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 16120 | /* |
| 16121 | * Unmute ADC and set the default input to mic-in |
| 16122 | */ |
| 16123 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16124 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16125 | |
| 16126 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 16127 | * mixer widget |
| 16128 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 16129 | * panel mic (mic 2) |
| 16130 | */ |
| 16131 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16133 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16135 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16136 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16137 | |
| 16138 | /* |
| 16139 | * Set up output mixers (0x0c - 0x0f) |
| 16140 | */ |
| 16141 | /* set vol=0 to output mixers */ |
| 16142 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16143 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16144 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16145 | |
| 16146 | /* set up input amps for analog loopback */ |
| 16147 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16148 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16149 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16150 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16151 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16152 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16153 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16154 | |
| 16155 | |
| 16156 | /* FIXME: use matrix-type input source selection */ |
| 16157 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16158 | /* Input mixer */ |
| 16159 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16160 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16161 | { } |
| 16162 | }; |
| 16163 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16164 | /* additional verbs for ALC663 */ |
| 16165 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16166 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16167 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16168 | { } |
| 16169 | }; |
| 16170 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16171 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16172 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16173 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16174 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16175 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16176 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16177 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16178 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16179 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16180 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16181 | {} |
| 16182 | }; |
| 16183 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16184 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16185 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16186 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16187 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16188 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16189 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16190 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16191 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16192 | {} |
| 16193 | }; |
| 16194 | |
| 16195 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16196 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16197 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16198 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16199 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16200 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16201 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16202 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16203 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16204 | {} |
| 16205 | }; |
| 16206 | |
| 16207 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16208 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16209 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16210 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16211 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16212 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16213 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16214 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16215 | {} |
| 16216 | }; |
| 16217 | |
| 16218 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16219 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16220 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16221 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16222 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16223 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16224 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16225 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16226 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16227 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16228 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16229 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16230 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16231 | {} |
| 16232 | }; |
| 16233 | |
| 16234 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16235 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16236 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16237 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16238 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16239 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16240 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16241 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16242 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16243 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16244 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16245 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16246 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16247 | {} |
| 16248 | }; |
| 16249 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16250 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16251 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16252 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16253 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16254 | |
| 16255 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16256 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16257 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16258 | |
| 16259 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16260 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16261 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16262 | {} |
| 16263 | }; |
| 16264 | |
| 16265 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16266 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16267 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16268 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16269 | |
| 16270 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16271 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16272 | {} |
| 16273 | }; |
| 16274 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16275 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16276 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16277 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16278 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16279 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16280 | {} |
| 16281 | }; |
| 16282 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16283 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16284 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16285 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16286 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16287 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16288 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16289 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16290 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16291 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16292 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16293 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16294 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16295 | {} |
| 16296 | }; |
| 16297 | |
| 16298 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16299 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16300 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16301 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16302 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16303 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16304 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16305 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16306 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16307 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16308 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16309 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16310 | {} |
| 16311 | }; |
| 16312 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16313 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16314 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16315 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16316 | { } /* end */ |
| 16317 | }; |
| 16318 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16319 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16320 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16321 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16322 | { } /* end */ |
| 16323 | }; |
| 16324 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16325 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16326 | { |
| 16327 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16328 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16329 | |
| 16330 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16331 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16332 | bits = present ? HDA_AMP_MUTE : 0; |
| 16333 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16334 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16335 | } |
| 16336 | |
| 16337 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16338 | { |
| 16339 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16340 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16341 | |
| 16342 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16343 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16344 | bits = present ? HDA_AMP_MUTE : 0; |
| 16345 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16346 | HDA_AMP_MUTE, bits); |
| 16347 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16348 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16349 | } |
| 16350 | |
| 16351 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16352 | unsigned int res) |
| 16353 | { |
| 16354 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16355 | alc662_lenovo_101e_all_automute(codec); |
| 16356 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16357 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16358 | } |
| 16359 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16360 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 16361 | { |
| 16362 | unsigned int present; |
| 16363 | |
| 16364 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 16365 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 16366 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16367 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16368 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16369 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16370 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16371 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16372 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16373 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16374 | } |
| 16375 | |
| 16376 | /* unsolicited event for HP jack sensing */ |
| 16377 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16378 | unsigned int res) |
| 16379 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16380 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 16381 | alc662_eeepc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16382 | else |
| 16383 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16384 | } |
| 16385 | |
| 16386 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16387 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16388 | alc262_hippo1_init_hook(codec); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16389 | alc662_eeepc_mic_automute(codec); |
| 16390 | } |
| 16391 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16392 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 16393 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16394 | struct alc_spec *spec = codec->spec; |
| 16395 | |
| 16396 | spec->autocfg.hp_pins[0] = 0x14; |
| 16397 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 16398 | alc262_hippo_master_update(codec); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16399 | } |
| 16400 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16401 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16402 | { |
| 16403 | unsigned int present; |
| 16404 | unsigned char bits; |
| 16405 | |
| 16406 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16407 | AC_VERB_GET_PIN_SENSE, 0) |
| 16408 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16409 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16410 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16411 | AMP_IN_MUTE(0), bits); |
| 16412 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16413 | AMP_IN_MUTE(0), bits); |
| 16414 | } |
| 16415 | |
| 16416 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16417 | { |
| 16418 | unsigned int present; |
| 16419 | unsigned char bits; |
| 16420 | |
| 16421 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16422 | AC_VERB_GET_PIN_SENSE, 0) |
| 16423 | & AC_PINSENSE_PRESENCE; |
| 16424 | bits = present ? HDA_AMP_MUTE : 0; |
| 16425 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16426 | AMP_IN_MUTE(0), bits); |
| 16427 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16428 | AMP_IN_MUTE(0), bits); |
| 16429 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16430 | AMP_IN_MUTE(0), bits); |
| 16431 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16432 | AMP_IN_MUTE(0), bits); |
| 16433 | } |
| 16434 | |
| 16435 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16436 | { |
| 16437 | unsigned int present; |
| 16438 | unsigned char bits; |
| 16439 | |
| 16440 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16441 | AC_VERB_GET_PIN_SENSE, 0) |
| 16442 | & AC_PINSENSE_PRESENCE; |
| 16443 | bits = present ? HDA_AMP_MUTE : 0; |
| 16444 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16445 | AMP_IN_MUTE(0), bits); |
| 16446 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16447 | AMP_IN_MUTE(0), bits); |
| 16448 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16449 | AMP_IN_MUTE(0), bits); |
| 16450 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16451 | AMP_IN_MUTE(0), bits); |
| 16452 | } |
| 16453 | |
| 16454 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16455 | { |
| 16456 | unsigned int present; |
| 16457 | unsigned char bits; |
| 16458 | |
| 16459 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16460 | AC_VERB_GET_PIN_SENSE, 0) |
| 16461 | & AC_PINSENSE_PRESENCE; |
| 16462 | bits = present ? 0 : PIN_OUT; |
| 16463 | snd_hda_codec_write(codec, 0x14, 0, |
| 16464 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16465 | } |
| 16466 | |
| 16467 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16468 | { |
| 16469 | unsigned int present1, present2; |
| 16470 | |
| 16471 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16472 | AC_VERB_GET_PIN_SENSE, 0) |
| 16473 | & AC_PINSENSE_PRESENCE; |
| 16474 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16475 | AC_VERB_GET_PIN_SENSE, 0) |
| 16476 | & AC_PINSENSE_PRESENCE; |
| 16477 | |
| 16478 | if (present1 || present2) { |
| 16479 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16480 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16481 | } else { |
| 16482 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16483 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16484 | } |
| 16485 | } |
| 16486 | |
| 16487 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16488 | { |
| 16489 | unsigned int present1, present2; |
| 16490 | |
| 16491 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16492 | AC_VERB_GET_PIN_SENSE, 0) |
| 16493 | & AC_PINSENSE_PRESENCE; |
| 16494 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16495 | AC_VERB_GET_PIN_SENSE, 0) |
| 16496 | & AC_PINSENSE_PRESENCE; |
| 16497 | |
| 16498 | if (present1 || present2) { |
| 16499 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16500 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16501 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16502 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16503 | } else { |
| 16504 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16505 | AMP_IN_MUTE(0), 0); |
| 16506 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16507 | AMP_IN_MUTE(0), 0); |
| 16508 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16509 | } |
| 16510 | |
| 16511 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16512 | { |
| 16513 | unsigned int present; |
| 16514 | |
| 16515 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16516 | AC_VERB_GET_PIN_SENSE, 0) |
| 16517 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16518 | 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] | 16519 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16520 | 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] | 16521 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16522 | 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] | 16523 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16524 | 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] | 16525 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16526 | } |
| 16527 | |
| 16528 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16529 | unsigned int res) |
| 16530 | { |
| 16531 | switch (res >> 26) { |
| 16532 | case ALC880_HP_EVENT: |
| 16533 | alc663_m51va_speaker_automute(codec); |
| 16534 | break; |
| 16535 | case ALC880_MIC_EVENT: |
| 16536 | alc663_m51va_mic_automute(codec); |
| 16537 | break; |
| 16538 | } |
| 16539 | } |
| 16540 | |
| 16541 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16542 | { |
| 16543 | alc663_m51va_speaker_automute(codec); |
| 16544 | alc663_m51va_mic_automute(codec); |
| 16545 | } |
| 16546 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16547 | /* ***************** Mode1 ******************************/ |
| 16548 | static void alc663_mode1_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_mode1_inithook(struct hda_codec *codec) |
| 16562 | { |
| 16563 | alc663_m51va_speaker_automute(codec); |
| 16564 | alc662_eeepc_mic_automute(codec); |
| 16565 | } |
| 16566 | /* ***************** Mode2 ******************************/ |
| 16567 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16568 | unsigned int res) |
| 16569 | { |
| 16570 | switch (res >> 26) { |
| 16571 | case ALC880_HP_EVENT: |
| 16572 | alc662_f5z_speaker_automute(codec); |
| 16573 | break; |
| 16574 | case ALC880_MIC_EVENT: |
| 16575 | alc662_eeepc_mic_automute(codec); |
| 16576 | break; |
| 16577 | } |
| 16578 | } |
| 16579 | |
| 16580 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16581 | { |
| 16582 | alc662_f5z_speaker_automute(codec); |
| 16583 | alc662_eeepc_mic_automute(codec); |
| 16584 | } |
| 16585 | /* ***************** Mode3 ******************************/ |
| 16586 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16587 | unsigned int res) |
| 16588 | { |
| 16589 | switch (res >> 26) { |
| 16590 | case ALC880_HP_EVENT: |
| 16591 | alc663_two_hp_m1_speaker_automute(codec); |
| 16592 | break; |
| 16593 | case ALC880_MIC_EVENT: |
| 16594 | alc662_eeepc_mic_automute(codec); |
| 16595 | break; |
| 16596 | } |
| 16597 | } |
| 16598 | |
| 16599 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16600 | { |
| 16601 | alc663_two_hp_m1_speaker_automute(codec); |
| 16602 | alc662_eeepc_mic_automute(codec); |
| 16603 | } |
| 16604 | /* ***************** Mode4 ******************************/ |
| 16605 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16606 | unsigned int res) |
| 16607 | { |
| 16608 | switch (res >> 26) { |
| 16609 | case ALC880_HP_EVENT: |
| 16610 | alc663_21jd_two_speaker_automute(codec); |
| 16611 | break; |
| 16612 | case ALC880_MIC_EVENT: |
| 16613 | alc662_eeepc_mic_automute(codec); |
| 16614 | break; |
| 16615 | } |
| 16616 | } |
| 16617 | |
| 16618 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16619 | { |
| 16620 | alc663_21jd_two_speaker_automute(codec); |
| 16621 | alc662_eeepc_mic_automute(codec); |
| 16622 | } |
| 16623 | /* ***************** Mode5 ******************************/ |
| 16624 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16625 | unsigned int res) |
| 16626 | { |
| 16627 | switch (res >> 26) { |
| 16628 | case ALC880_HP_EVENT: |
| 16629 | alc663_15jd_two_speaker_automute(codec); |
| 16630 | break; |
| 16631 | case ALC880_MIC_EVENT: |
| 16632 | alc662_eeepc_mic_automute(codec); |
| 16633 | break; |
| 16634 | } |
| 16635 | } |
| 16636 | |
| 16637 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16638 | { |
| 16639 | alc663_15jd_two_speaker_automute(codec); |
| 16640 | alc662_eeepc_mic_automute(codec); |
| 16641 | } |
| 16642 | /* ***************** Mode6 ******************************/ |
| 16643 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16644 | unsigned int res) |
| 16645 | { |
| 16646 | switch (res >> 26) { |
| 16647 | case ALC880_HP_EVENT: |
| 16648 | alc663_two_hp_m2_speaker_automute(codec); |
| 16649 | break; |
| 16650 | case ALC880_MIC_EVENT: |
| 16651 | alc662_eeepc_mic_automute(codec); |
| 16652 | break; |
| 16653 | } |
| 16654 | } |
| 16655 | |
| 16656 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16657 | { |
| 16658 | alc663_two_hp_m2_speaker_automute(codec); |
| 16659 | alc662_eeepc_mic_automute(codec); |
| 16660 | } |
| 16661 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16662 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16663 | { |
| 16664 | unsigned int present; |
| 16665 | unsigned char bits; |
| 16666 | |
| 16667 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16668 | AC_VERB_GET_PIN_SENSE, 0) |
| 16669 | & AC_PINSENSE_PRESENCE; |
| 16670 | bits = present ? HDA_AMP_MUTE : 0; |
| 16671 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16672 | HDA_AMP_MUTE, bits); |
| 16673 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16674 | HDA_AMP_MUTE, bits); |
| 16675 | } |
| 16676 | |
| 16677 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16678 | { |
| 16679 | unsigned int present; |
| 16680 | unsigned char bits; |
| 16681 | |
| 16682 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16683 | AC_VERB_GET_PIN_SENSE, 0) |
| 16684 | & AC_PINSENSE_PRESENCE; |
| 16685 | bits = present ? HDA_AMP_MUTE : 0; |
| 16686 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16687 | HDA_AMP_MUTE, bits); |
| 16688 | } |
| 16689 | |
| 16690 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16691 | unsigned int res) |
| 16692 | { |
| 16693 | switch (res >> 26) { |
| 16694 | case ALC880_HP_EVENT: |
| 16695 | alc663_g71v_hp_automute(codec); |
| 16696 | break; |
| 16697 | case ALC880_FRONT_EVENT: |
| 16698 | alc663_g71v_front_automute(codec); |
| 16699 | break; |
| 16700 | case ALC880_MIC_EVENT: |
| 16701 | alc662_eeepc_mic_automute(codec); |
| 16702 | break; |
| 16703 | } |
| 16704 | } |
| 16705 | |
| 16706 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16707 | { |
| 16708 | alc663_g71v_front_automute(codec); |
| 16709 | alc663_g71v_hp_automute(codec); |
| 16710 | alc662_eeepc_mic_automute(codec); |
| 16711 | } |
| 16712 | |
| 16713 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16714 | unsigned int res) |
| 16715 | { |
| 16716 | switch (res >> 26) { |
| 16717 | case ALC880_HP_EVENT: |
| 16718 | alc663_m51va_speaker_automute(codec); |
| 16719 | break; |
| 16720 | case ALC880_MIC_EVENT: |
| 16721 | alc662_eeepc_mic_automute(codec); |
| 16722 | break; |
| 16723 | } |
| 16724 | } |
| 16725 | |
| 16726 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16727 | { |
| 16728 | alc663_m51va_speaker_automute(codec); |
| 16729 | alc662_eeepc_mic_automute(codec); |
| 16730 | } |
| 16731 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16732 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16733 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16734 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16735 | |
| 16736 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16737 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16738 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16739 | |
| 16740 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16741 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16742 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16743 | { } /* end */ |
| 16744 | }; |
| 16745 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16746 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16747 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16748 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16749 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16750 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16751 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16752 | |
| 16753 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16754 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16755 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16756 | |
| 16757 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16758 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16759 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16760 | { } /* end */ |
| 16761 | }; |
| 16762 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16763 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16764 | #define alc662_loopbacks alc880_loopbacks |
| 16765 | #endif |
| 16766 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16767 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16768 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16769 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16770 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16771 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16772 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16773 | |
| 16774 | /* |
| 16775 | * configuration and preset |
| 16776 | */ |
| 16777 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16778 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16779 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16780 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16781 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16782 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16783 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16784 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16785 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16786 | [ALC663_ASUS_M51VA] = "m51va", |
| 16787 | [ALC663_ASUS_G71V] = "g71v", |
| 16788 | [ALC663_ASUS_H13] = "h13", |
| 16789 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16790 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16791 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16792 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16793 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16794 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16795 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16796 | [ALC272_DELL] = "dell", |
| 16797 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16798 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16799 | [ALC662_AUTO] = "auto", |
| 16800 | }; |
| 16801 | |
| 16802 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16803 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16804 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16805 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16806 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16807 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16808 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16809 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16810 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16811 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16812 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16813 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16814 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16815 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16816 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16817 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16818 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16819 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16820 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16821 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16822 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16823 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16824 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16825 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16826 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16827 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16828 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16829 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16830 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16831 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16832 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16833 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16834 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16835 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16836 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16837 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16838 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16839 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16840 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16841 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16842 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16843 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16844 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16845 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16846 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16847 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16848 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16849 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16850 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16851 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16852 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16853 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16854 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16855 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16856 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16857 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16858 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16859 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16860 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16861 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16862 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16863 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16864 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16865 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16866 | {} |
| 16867 | }; |
| 16868 | |
| 16869 | static struct alc_config_preset alc662_presets[] = { |
| 16870 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16871 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16872 | .init_verbs = { alc662_init_verbs }, |
| 16873 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16874 | .dac_nids = alc662_dac_nids, |
| 16875 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16876 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16877 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16878 | .channel_mode = alc662_3ST_2ch_modes, |
| 16879 | .input_mux = &alc662_capture_source, |
| 16880 | }, |
| 16881 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16882 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16883 | .init_verbs = { alc662_init_verbs }, |
| 16884 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16885 | .dac_nids = alc662_dac_nids, |
| 16886 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16887 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16888 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16889 | .channel_mode = alc662_3ST_6ch_modes, |
| 16890 | .need_dac_fix = 1, |
| 16891 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16892 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16893 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16894 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16895 | .init_verbs = { alc662_init_verbs }, |
| 16896 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16897 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16898 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16899 | .channel_mode = alc662_3ST_6ch_modes, |
| 16900 | .need_dac_fix = 1, |
| 16901 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16902 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16903 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16904 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16905 | .init_verbs = { alc662_init_verbs }, |
| 16906 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16907 | .dac_nids = alc662_dac_nids, |
| 16908 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16909 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16910 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16911 | .channel_mode = alc662_5stack_modes, |
| 16912 | .input_mux = &alc662_capture_source, |
| 16913 | }, |
| 16914 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16915 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16916 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16917 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16918 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16919 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16920 | .channel_mode = alc662_3ST_2ch_modes, |
| 16921 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16922 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16923 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16924 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16925 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16926 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16927 | .init_verbs = { alc662_init_verbs, |
| 16928 | alc662_eeepc_sue_init_verbs }, |
| 16929 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16930 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16931 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16932 | .channel_mode = alc662_3ST_2ch_modes, |
| 16933 | .input_mux = &alc662_eeepc_capture_source, |
| 16934 | .unsol_event = alc662_eeepc_unsol_event, |
| 16935 | .init_hook = alc662_eeepc_inithook, |
| 16936 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16937 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16938 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16939 | alc662_chmode_mixer }, |
| 16940 | .init_verbs = { alc662_init_verbs, |
| 16941 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16942 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16943 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16944 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16945 | .channel_mode = alc662_3ST_6ch_modes, |
| 16946 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16947 | .unsol_event = alc662_eeepc_unsol_event, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16948 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16949 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16950 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16951 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16952 | .init_verbs = { alc662_init_verbs, |
| 16953 | alc662_ecs_init_verbs }, |
| 16954 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16955 | .dac_nids = alc662_dac_nids, |
| 16956 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16957 | .channel_mode = alc662_3ST_2ch_modes, |
| 16958 | .input_mux = &alc662_eeepc_capture_source, |
| 16959 | .unsol_event = alc662_eeepc_unsol_event, |
| 16960 | .init_hook = alc662_eeepc_inithook, |
| 16961 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16962 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16963 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16964 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16965 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16966 | .dac_nids = alc662_dac_nids, |
| 16967 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16968 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16969 | .channel_mode = alc662_3ST_2ch_modes, |
| 16970 | .input_mux = &alc663_m51va_capture_source, |
| 16971 | .unsol_event = alc663_m51va_unsol_event, |
| 16972 | .init_hook = alc663_m51va_inithook, |
| 16973 | }, |
| 16974 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16975 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16976 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16977 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16978 | .dac_nids = alc662_dac_nids, |
| 16979 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16980 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16981 | .channel_mode = alc662_3ST_2ch_modes, |
| 16982 | .input_mux = &alc662_eeepc_capture_source, |
| 16983 | .unsol_event = alc663_g71v_unsol_event, |
| 16984 | .init_hook = alc663_g71v_inithook, |
| 16985 | }, |
| 16986 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16987 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16988 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16989 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16990 | .dac_nids = alc662_dac_nids, |
| 16991 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16992 | .channel_mode = alc662_3ST_2ch_modes, |
| 16993 | .input_mux = &alc663_m51va_capture_source, |
| 16994 | .unsol_event = alc663_m51va_unsol_event, |
| 16995 | .init_hook = alc663_m51va_inithook, |
| 16996 | }, |
| 16997 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16998 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16999 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 17000 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17001 | .dac_nids = alc662_dac_nids, |
| 17002 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17003 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17004 | .channel_mode = alc662_3ST_6ch_modes, |
| 17005 | .input_mux = &alc663_capture_source, |
| 17006 | .unsol_event = alc663_g50v_unsol_event, |
| 17007 | .init_hook = alc663_g50v_inithook, |
| 17008 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17009 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17010 | .mixers = { alc663_m51va_mixer }, |
| 17011 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17012 | .init_verbs = { alc662_init_verbs, |
| 17013 | alc663_21jd_amic_init_verbs }, |
| 17014 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17015 | .hp_nid = 0x03, |
| 17016 | .dac_nids = alc662_dac_nids, |
| 17017 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17018 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17019 | .channel_mode = alc662_3ST_2ch_modes, |
| 17020 | .input_mux = &alc662_eeepc_capture_source, |
| 17021 | .unsol_event = alc663_mode1_unsol_event, |
| 17022 | .init_hook = alc663_mode1_inithook, |
| 17023 | }, |
| 17024 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17025 | .mixers = { alc662_1bjd_mixer }, |
| 17026 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17027 | .init_verbs = { alc662_init_verbs, |
| 17028 | alc662_1bjd_amic_init_verbs }, |
| 17029 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17030 | .dac_nids = alc662_dac_nids, |
| 17031 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17032 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17033 | .channel_mode = alc662_3ST_2ch_modes, |
| 17034 | .input_mux = &alc662_eeepc_capture_source, |
| 17035 | .unsol_event = alc662_mode2_unsol_event, |
| 17036 | .init_hook = alc662_mode2_inithook, |
| 17037 | }, |
| 17038 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17039 | .mixers = { alc663_two_hp_m1_mixer }, |
| 17040 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17041 | .init_verbs = { alc662_init_verbs, |
| 17042 | alc663_two_hp_amic_m1_init_verbs }, |
| 17043 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17044 | .hp_nid = 0x03, |
| 17045 | .dac_nids = alc662_dac_nids, |
| 17046 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17047 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17048 | .channel_mode = alc662_3ST_2ch_modes, |
| 17049 | .input_mux = &alc662_eeepc_capture_source, |
| 17050 | .unsol_event = alc663_mode3_unsol_event, |
| 17051 | .init_hook = alc663_mode3_inithook, |
| 17052 | }, |
| 17053 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17054 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 17055 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17056 | .init_verbs = { alc662_init_verbs, |
| 17057 | alc663_21jd_amic_init_verbs}, |
| 17058 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17059 | .hp_nid = 0x03, |
| 17060 | .dac_nids = alc662_dac_nids, |
| 17061 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17062 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17063 | .channel_mode = alc662_3ST_2ch_modes, |
| 17064 | .input_mux = &alc662_eeepc_capture_source, |
| 17065 | .unsol_event = alc663_mode4_unsol_event, |
| 17066 | .init_hook = alc663_mode4_inithook, |
| 17067 | }, |
| 17068 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17069 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 17070 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17071 | .init_verbs = { alc662_init_verbs, |
| 17072 | alc663_15jd_amic_init_verbs }, |
| 17073 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17074 | .hp_nid = 0x03, |
| 17075 | .dac_nids = alc662_dac_nids, |
| 17076 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17077 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17078 | .channel_mode = alc662_3ST_2ch_modes, |
| 17079 | .input_mux = &alc662_eeepc_capture_source, |
| 17080 | .unsol_event = alc663_mode5_unsol_event, |
| 17081 | .init_hook = alc663_mode5_inithook, |
| 17082 | }, |
| 17083 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17084 | .mixers = { alc663_two_hp_m2_mixer }, |
| 17085 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17086 | .init_verbs = { alc662_init_verbs, |
| 17087 | alc663_two_hp_amic_m2_init_verbs }, |
| 17088 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17089 | .hp_nid = 0x03, |
| 17090 | .dac_nids = alc662_dac_nids, |
| 17091 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17092 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17093 | .channel_mode = alc662_3ST_2ch_modes, |
| 17094 | .input_mux = &alc662_eeepc_capture_source, |
| 17095 | .unsol_event = alc663_mode6_unsol_event, |
| 17096 | .init_hook = alc663_mode6_inithook, |
| 17097 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17098 | [ALC272_DELL] = { |
| 17099 | .mixers = { alc663_m51va_mixer }, |
| 17100 | .cap_mixer = alc272_auto_capture_mixer, |
| 17101 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 17102 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17103 | .dac_nids = alc662_dac_nids, |
| 17104 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17105 | .adc_nids = alc272_adc_nids, |
| 17106 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 17107 | .capsrc_nids = alc272_capsrc_nids, |
| 17108 | .channel_mode = alc662_3ST_2ch_modes, |
| 17109 | .input_mux = &alc663_m51va_capture_source, |
| 17110 | .unsol_event = alc663_m51va_unsol_event, |
| 17111 | .init_hook = alc663_m51va_inithook, |
| 17112 | }, |
| 17113 | [ALC272_DELL_ZM1] = { |
| 17114 | .mixers = { alc663_m51va_mixer }, |
| 17115 | .cap_mixer = alc662_auto_capture_mixer, |
| 17116 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 17117 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17118 | .dac_nids = alc662_dac_nids, |
| 17119 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17120 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17121 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17122 | .capsrc_nids = alc662_capsrc_nids, |
| 17123 | .channel_mode = alc662_3ST_2ch_modes, |
| 17124 | .input_mux = &alc663_m51va_capture_source, |
| 17125 | .unsol_event = alc663_m51va_unsol_event, |
| 17126 | .init_hook = alc663_m51va_inithook, |
| 17127 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17128 | [ALC272_SAMSUNG_NC10] = { |
| 17129 | .mixers = { alc272_nc10_mixer }, |
| 17130 | .init_verbs = { alc662_init_verbs, |
| 17131 | alc663_21jd_amic_init_verbs }, |
| 17132 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17133 | .dac_nids = alc272_dac_nids, |
| 17134 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17135 | .channel_mode = alc662_3ST_2ch_modes, |
| 17136 | .input_mux = &alc272_nc10_capture_source, |
| 17137 | .unsol_event = alc663_mode4_unsol_event, |
| 17138 | .init_hook = alc663_mode4_inithook, |
| 17139 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17140 | }; |
| 17141 | |
| 17142 | |
| 17143 | /* |
| 17144 | * BIOS auto configuration |
| 17145 | */ |
| 17146 | |
| 17147 | /* add playback controls from the parsed DAC table */ |
| 17148 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17149 | const struct auto_pin_cfg *cfg) |
| 17150 | { |
| 17151 | char name[32]; |
| 17152 | static const char *chname[4] = { |
| 17153 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17154 | }; |
| 17155 | hda_nid_t nid; |
| 17156 | int i, err; |
| 17157 | |
| 17158 | for (i = 0; i < cfg->line_outs; i++) { |
| 17159 | if (!spec->multiout.dac_nids[i]) |
| 17160 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17161 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17162 | if (i == 2) { |
| 17163 | /* Center/LFE */ |
| 17164 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17165 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17166 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 17167 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17168 | if (err < 0) |
| 17169 | return err; |
| 17170 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17171 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17172 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 17173 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17174 | if (err < 0) |
| 17175 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17176 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17177 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17178 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17179 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17180 | if (err < 0) |
| 17181 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17182 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17183 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17184 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17185 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17186 | if (err < 0) |
| 17187 | return err; |
| 17188 | } else { |
| 17189 | sprintf(name, "%s Playback Volume", chname[i]); |
| 17190 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17191 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 17192 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17193 | if (err < 0) |
| 17194 | return err; |
| 17195 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17196 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17197 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 17198 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17199 | if (err < 0) |
| 17200 | return err; |
| 17201 | } |
| 17202 | } |
| 17203 | return 0; |
| 17204 | } |
| 17205 | |
| 17206 | /* add playback controls for speaker and HP outputs */ |
| 17207 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 17208 | const char *pfx) |
| 17209 | { |
| 17210 | hda_nid_t nid; |
| 17211 | int err; |
| 17212 | char name[32]; |
| 17213 | |
| 17214 | if (!pin) |
| 17215 | return 0; |
| 17216 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17217 | if (pin == 0x17) { |
| 17218 | /* ALC663 has a mono output pin on 0x17 */ |
| 17219 | sprintf(name, "%s Playback Switch", pfx); |
| 17220 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17221 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 17222 | return err; |
| 17223 | } |
| 17224 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17225 | if (alc880_is_fixed_pin(pin)) { |
| 17226 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 17227 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17228 | /* specify the DAC as the extra output */ |
| 17229 | if (!spec->multiout.hp_nid) |
| 17230 | spec->multiout.hp_nid = nid; |
| 17231 | else |
| 17232 | spec->multiout.extra_out_nid[0] = nid; |
| 17233 | /* control HP volume/switch on the output mixer amp */ |
| 17234 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17235 | sprintf(name, "%s Playback Volume", pfx); |
| 17236 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 17237 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 17238 | if (err < 0) |
| 17239 | return err; |
| 17240 | sprintf(name, "%s Playback Switch", pfx); |
| 17241 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 17242 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 17243 | if (err < 0) |
| 17244 | return err; |
| 17245 | } else if (alc880_is_multi_pin(pin)) { |
| 17246 | /* set manual connection */ |
| 17247 | /* we have only a switch on HP-out PIN */ |
| 17248 | sprintf(name, "%s Playback Switch", pfx); |
| 17249 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17250 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17251 | if (err < 0) |
| 17252 | return err; |
| 17253 | } |
| 17254 | return 0; |
| 17255 | } |
| 17256 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17257 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 17258 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 17259 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17260 | return (pincap & AC_PINCAP_IN) != 0; |
| 17261 | } |
| 17262 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17263 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17264 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17265 | const struct auto_pin_cfg *cfg) |
| 17266 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17267 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17268 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17269 | int i, err, idx; |
| 17270 | |
| 17271 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17272 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 17273 | idx = get_connection_index(codec, 0x0b, |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17274 | cfg->input_pins[i]); |
| 17275 | if (idx >= 0) { |
| 17276 | err = new_analog_input(spec, cfg->input_pins[i], |
| 17277 | auto_pin_cfg_labels[i], |
| 17278 | idx, 0x0b); |
| 17279 | if (err < 0) |
| 17280 | return err; |
| 17281 | } |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 17282 | idx = get_connection_index(codec, 0x22, |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17283 | cfg->input_pins[i]); |
| 17284 | if (idx >= 0) { |
| 17285 | imux->items[imux->num_items].label = |
| 17286 | auto_pin_cfg_labels[i]; |
| 17287 | imux->items[imux->num_items].index = idx; |
| 17288 | imux->num_items++; |
| 17289 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17290 | } |
| 17291 | } |
| 17292 | return 0; |
| 17293 | } |
| 17294 | |
| 17295 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17296 | hda_nid_t nid, int pin_type, |
| 17297 | int dac_idx) |
| 17298 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17299 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17300 | /* need the manual connection? */ |
| 17301 | if (alc880_is_multi_pin(nid)) { |
| 17302 | struct alc_spec *spec = codec->spec; |
| 17303 | int idx = alc880_multi_pin_idx(nid); |
| 17304 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 17305 | AC_VERB_SET_CONNECT_SEL, |
| 17306 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 17307 | } |
| 17308 | } |
| 17309 | |
| 17310 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17311 | { |
| 17312 | struct alc_spec *spec = codec->spec; |
| 17313 | int i; |
| 17314 | |
| 17315 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17316 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17317 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17318 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17319 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17320 | i); |
| 17321 | } |
| 17322 | } |
| 17323 | |
| 17324 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17325 | { |
| 17326 | struct alc_spec *spec = codec->spec; |
| 17327 | hda_nid_t pin; |
| 17328 | |
| 17329 | pin = spec->autocfg.hp_pins[0]; |
| 17330 | if (pin) /* connect to front */ |
| 17331 | /* use dac 0 */ |
| 17332 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17333 | pin = spec->autocfg.speaker_pins[0]; |
| 17334 | if (pin) |
| 17335 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17336 | } |
| 17337 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17338 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17339 | |
| 17340 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17341 | { |
| 17342 | struct alc_spec *spec = codec->spec; |
| 17343 | int i; |
| 17344 | |
| 17345 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17346 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17347 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17348 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17349 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17350 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17351 | snd_hda_codec_write(codec, nid, 0, |
| 17352 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17353 | AMP_OUT_MUTE); |
| 17354 | } |
| 17355 | } |
| 17356 | } |
| 17357 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17358 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17359 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17360 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17361 | { |
| 17362 | struct alc_spec *spec = codec->spec; |
| 17363 | int err; |
| 17364 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17365 | |
| 17366 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17367 | alc662_ignore); |
| 17368 | if (err < 0) |
| 17369 | return err; |
| 17370 | if (!spec->autocfg.line_outs) |
| 17371 | return 0; /* can't find valid BIOS pin config */ |
| 17372 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17373 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17374 | if (err < 0) |
| 17375 | return err; |
| 17376 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17377 | if (err < 0) |
| 17378 | return err; |
| 17379 | err = alc662_auto_create_extra_out(spec, |
| 17380 | spec->autocfg.speaker_pins[0], |
| 17381 | "Speaker"); |
| 17382 | if (err < 0) |
| 17383 | return err; |
| 17384 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17385 | "Headphone"); |
| 17386 | if (err < 0) |
| 17387 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17388 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17389 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17390 | return err; |
| 17391 | |
| 17392 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17393 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17394 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17395 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17396 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17397 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17398 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17399 | |
| 17400 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17401 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17402 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17403 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17404 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17405 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17406 | |
| 17407 | err = alc_auto_add_mic_boost(codec); |
| 17408 | if (err < 0) |
| 17409 | return err; |
| 17410 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17411 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17412 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17413 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17414 | } |
| 17415 | |
| 17416 | /* additional initialization for auto-configuration model */ |
| 17417 | static void alc662_auto_init(struct hda_codec *codec) |
| 17418 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17419 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17420 | alc662_auto_init_multi_out(codec); |
| 17421 | alc662_auto_init_hp_out(codec); |
| 17422 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17423 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17424 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17425 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17426 | } |
| 17427 | |
| 17428 | static int patch_alc662(struct hda_codec *codec) |
| 17429 | { |
| 17430 | struct alc_spec *spec; |
| 17431 | int err, board_config; |
| 17432 | |
| 17433 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17434 | if (!spec) |
| 17435 | return -ENOMEM; |
| 17436 | |
| 17437 | codec->spec = spec; |
| 17438 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17439 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17440 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17441 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17442 | alc662_models, |
| 17443 | alc662_cfg_tbl); |
| 17444 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17445 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17446 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17447 | board_config = ALC662_AUTO; |
| 17448 | } |
| 17449 | |
| 17450 | if (board_config == ALC662_AUTO) { |
| 17451 | /* automatic parse from the BIOS config */ |
| 17452 | err = alc662_parse_auto_config(codec); |
| 17453 | if (err < 0) { |
| 17454 | alc_free(codec); |
| 17455 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17456 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17457 | printk(KERN_INFO |
| 17458 | "hda_codec: Cannot set up configuration " |
| 17459 | "from BIOS. Using base mode...\n"); |
| 17460 | board_config = ALC662_3ST_2ch_DIG; |
| 17461 | } |
| 17462 | } |
| 17463 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17464 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17465 | if (err < 0) { |
| 17466 | alc_free(codec); |
| 17467 | return err; |
| 17468 | } |
| 17469 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17470 | if (board_config != ALC662_AUTO) |
| 17471 | setup_preset(spec, &alc662_presets[board_config]); |
| 17472 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17473 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17474 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17475 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17476 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17477 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17478 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17479 | if (!spec->adc_nids) { |
| 17480 | spec->adc_nids = alc662_adc_nids; |
| 17481 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17482 | } |
| 17483 | if (!spec->capsrc_nids) |
| 17484 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17485 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17486 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17487 | set_capture_mixer(codec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17488 | if (codec->vendor_id == 0x10ec0662) |
| 17489 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17490 | else |
| 17491 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17492 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17493 | spec->vmaster_nid = 0x02; |
| 17494 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17495 | codec->patch_ops = alc_patch_ops; |
| 17496 | if (board_config == ALC662_AUTO) |
| 17497 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17498 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17499 | if (!spec->loopback.amplist) |
| 17500 | spec->loopback.amplist = alc662_loopbacks; |
| 17501 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17502 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17503 | |
| 17504 | return 0; |
| 17505 | } |
| 17506 | |
| 17507 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17508 | * patch entries |
| 17509 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17510 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17511 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17512 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17513 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17514 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17515 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17516 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17517 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17518 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17519 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17520 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17521 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17522 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17523 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17524 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17525 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17526 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17527 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17528 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17529 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17530 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17531 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17532 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17533 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17534 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17535 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17536 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17537 | .patch = patch_alc882 }, |
| 17538 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
| 17539 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17540 | {} /* terminator */ |
| 17541 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17542 | |
| 17543 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17544 | |
| 17545 | MODULE_LICENSE("GPL"); |
| 17546 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17547 | |
| 17548 | static struct hda_codec_preset_list realtek_list = { |
| 17549 | .preset = snd_hda_preset_realtek, |
| 17550 | .owner = THIS_MODULE, |
| 17551 | }; |
| 17552 | |
| 17553 | static int __init patch_realtek_init(void) |
| 17554 | { |
| 17555 | return snd_hda_add_codec_preset(&realtek_list); |
| 17556 | } |
| 17557 | |
| 17558 | static void __exit patch_realtek_exit(void) |
| 17559 | { |
| 17560 | snd_hda_delete_codec_preset(&realtek_list); |
| 17561 | } |
| 17562 | |
| 17563 | module_init(patch_realtek_init) |
| 17564 | module_exit(patch_realtek_exit) |