Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 33 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 81 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 82 | #ifdef CONFIG_SND_DEBUG |
| 83 | ALC260_TEST, |
| 84 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 86 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 89 | /* ALC262 models */ |
| 90 | enum { |
| 91 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 92 | ALC262_HIPPO, |
| 93 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 94 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 95 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 96 | ALC262_HP_BPC_D7000_WL, |
| 97 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 98 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 99 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 100 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 101 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 102 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 103 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 104 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 105 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 108 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | ALC262_AUTO, |
| 110 | ALC262_MODEL_LAST /* last tag */ |
| 111 | }; |
| 112 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | /* ALC268 models */ |
| 114 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 115 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 117 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 118 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 119 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 120 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 121 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 122 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_SND_DEBUG |
| 124 | ALC268_TEST, |
| 125 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 126 | ALC268_AUTO, |
| 127 | ALC268_MODEL_LAST /* last tag */ |
| 128 | }; |
| 129 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 130 | /* ALC269 models */ |
| 131 | enum { |
| 132 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 133 | ALC269_QUANTA_FL1, |
Kailang Yang | 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 | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 219 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 220 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 221 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 222 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 223 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 224 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 225 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 226 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 227 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 228 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 229 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 230 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 231 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 232 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 233 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 234 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 235 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 236 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 237 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 238 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 239 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 240 | ALC889A_INTEL, |
| 241 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 242 | ALC888_ASUS_M90V, |
| 243 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 244 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 245 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 246 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 247 | ALC882_AUTO, |
| 248 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 249 | }; |
| 250 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 251 | /* for GPIO Poll */ |
| 252 | #define GPIO_MASK 0x03 |
| 253 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 254 | /* extra amp-initialization sequence types */ |
| 255 | enum { |
| 256 | ALC_INIT_NONE, |
| 257 | ALC_INIT_DEFAULT, |
| 258 | ALC_INIT_GPIO1, |
| 259 | ALC_INIT_GPIO2, |
| 260 | ALC_INIT_GPIO3, |
| 261 | }; |
| 262 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 263 | struct alc_mic_route { |
| 264 | hda_nid_t pin; |
| 265 | unsigned char mux_idx; |
| 266 | unsigned char amix_idx; |
| 267 | }; |
| 268 | |
| 269 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 270 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | struct alc_spec { |
| 272 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 273 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 275 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 276 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 278 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 279 | * don't forget NULL |
| 280 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 281 | */ |
| 282 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 284 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | struct hda_pcm_stream *stream_analog_playback; |
| 286 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 287 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 288 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 290 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | struct hda_pcm_stream *stream_digital_playback; |
| 292 | struct hda_pcm_stream *stream_digital_capture; |
| 293 | |
| 294 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 295 | struct hda_multi_out multiout; /* playback set-up |
| 296 | * max_channels, dacs must be set |
| 297 | * dig_out_nid and hp_nid are optional |
| 298 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 299 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 300 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 301 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | |
| 303 | /* capture */ |
| 304 | unsigned int num_adc_nids; |
| 305 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 306 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 307 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | |
| 309 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 310 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | const struct hda_input_mux *input_mux; |
| 312 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 313 | struct alc_mic_route ext_mic; |
| 314 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | |
| 316 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 317 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 319 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 320 | int const_channel_count; |
| 321 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | |
| 323 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 324 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 325 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 326 | /* dynamic controls, init_verbs and input_mux */ |
| 327 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 328 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 329 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 330 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 331 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 332 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 333 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 334 | /* hooks */ |
| 335 | void (*init_hook)(struct hda_codec *codec); |
| 336 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 337 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 338 | /* for pin sensing */ |
| 339 | unsigned int sense_updated: 1; |
| 340 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 341 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 342 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 343 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 344 | /* other flags */ |
| 345 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 346 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 347 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 348 | /* for virtual master */ |
| 349 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 350 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 351 | struct hda_loopback_check loopback; |
| 352 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 353 | |
| 354 | /* for PLL fix */ |
| 355 | hda_nid_t pll_nid; |
| 356 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 357 | }; |
| 358 | |
| 359 | /* |
| 360 | * configuration template - to be copied to the spec instance |
| 361 | */ |
| 362 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 363 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 364 | * with spec |
| 365 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 366 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 367 | const struct hda_verb *init_verbs[5]; |
| 368 | unsigned int num_dacs; |
| 369 | hda_nid_t *dac_nids; |
| 370 | hda_nid_t dig_out_nid; /* optional */ |
| 371 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 372 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 373 | unsigned int num_adc_nids; |
| 374 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 375 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 376 | hda_nid_t dig_in_nid; |
| 377 | unsigned int num_channel_mode; |
| 378 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 379 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 380 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 381 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 382 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 383 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 384 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 385 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 386 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 387 | struct hda_amp_list *loopbacks; |
| 388 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | }; |
| 390 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 391 | |
| 392 | /* |
| 393 | * input MUX handling |
| 394 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 395 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 396 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | { |
| 398 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 399 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 400 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 401 | if (mux_idx >= spec->num_mux_defs) |
| 402 | mux_idx = 0; |
| 403 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | } |
| 405 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 406 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 407 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 408 | { |
| 409 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 410 | struct alc_spec *spec = codec->spec; |
| 411 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 412 | |
| 413 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 414 | return 0; |
| 415 | } |
| 416 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 417 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 418 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | { |
| 420 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 421 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 422 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 423 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 424 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 425 | hda_nid_t nid = spec->capsrc_nids ? |
| 426 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 427 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 428 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 429 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 430 | imux = &spec->input_mux[mux_idx]; |
| 431 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 432 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 433 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 434 | /* Matrix-mixer style (e.g. ALC882) */ |
| 435 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 436 | unsigned int i, idx; |
| 437 | |
| 438 | idx = ucontrol->value.enumerated.item[0]; |
| 439 | if (idx >= imux->num_items) |
| 440 | idx = imux->num_items - 1; |
| 441 | if (*cur_val == idx) |
| 442 | return 0; |
| 443 | for (i = 0; i < imux->num_items; i++) { |
| 444 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 445 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 446 | imux->items[i].index, |
| 447 | HDA_AMP_MUTE, v); |
| 448 | } |
| 449 | *cur_val = idx; |
| 450 | return 1; |
| 451 | } else { |
| 452 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 453 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 454 | &spec->cur_mux[adc_idx]); |
| 455 | } |
| 456 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 457 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | /* |
| 459 | * channel mode setting |
| 460 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 461 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 462 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | { |
| 464 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 465 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 466 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 467 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | } |
| 469 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 470 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 471 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | { |
| 473 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 474 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 475 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 476 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 477 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | } |
| 479 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 480 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 481 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | { |
| 483 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 484 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 485 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 486 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 487 | &spec->ext_channel_count); |
| 488 | if (err >= 0 && !spec->const_channel_count) { |
| 489 | spec->multiout.max_channels = spec->ext_channel_count; |
| 490 | if (spec->need_dac_fix) |
| 491 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 492 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 493 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | } |
| 495 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 497 | * Control the mode of pin widget settings via the mixer. "pc" is used |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 498 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 499 | * being part of a format specifier. Maximum allowed length of a value is |
| 500 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 501 | * |
| 502 | * Note: some retasking pin complexes seem to ignore requests for input |
| 503 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 504 | * are requested. Therefore order this list so that this behaviour will not |
| 505 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 506 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 507 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 508 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 509 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 510 | "Mic 50pc bias", "Mic 80pc bias", |
| 511 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 512 | }; |
| 513 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 514 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 515 | }; |
| 516 | /* The control can present all 5 options, or it can limit the options based |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 517 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 518 | * addition, "input" pins may or may not process the mic bias option |
| 519 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 520 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 521 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 522 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 523 | #define ALC_PIN_DIR_IN 0x00 |
| 524 | #define ALC_PIN_DIR_OUT 0x01 |
| 525 | #define ALC_PIN_DIR_INOUT 0x02 |
| 526 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 527 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 528 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 529 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 530 | * For each direction the minimum and maximum values are given. |
| 531 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 532 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 533 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 534 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 535 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 536 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 537 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 538 | }; |
| 539 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 540 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 541 | #define alc_pin_mode_n_items(_dir) \ |
| 542 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 543 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 544 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 545 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 546 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 547 | unsigned int item_num = uinfo->value.enumerated.item; |
| 548 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 549 | |
| 550 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 551 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 553 | |
| 554 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 555 | item_num = alc_pin_mode_min(dir); |
| 556 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 557 | return 0; |
| 558 | } |
| 559 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 560 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 561 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 562 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 563 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 564 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 565 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 566 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 567 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 568 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 569 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 570 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 571 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 572 | /* Find enumerated value for current pinctl setting */ |
| 573 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 574 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 575 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 576 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 577 | return 0; |
| 578 | } |
| 579 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 580 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 581 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 582 | { |
| 583 | signed int change; |
| 584 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 585 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 586 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 587 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 588 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 589 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 590 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 591 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 592 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 593 | val = alc_pin_mode_min(dir); |
| 594 | |
| 595 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 596 | if (change) { |
| 597 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 598 | snd_hda_codec_write_cache(codec, nid, 0, |
| 599 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 600 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 601 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 602 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 603 | * for the requested pin mode. Enum values of 2 or less are |
| 604 | * input modes. |
| 605 | * |
| 606 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 607 | * reduces noise slightly (particularly on input) so we'll |
| 608 | * do it. However, having both input and output buffers |
| 609 | * enabled simultaneously doesn't seem to be problematic if |
| 610 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 611 | */ |
| 612 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 613 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 614 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 615 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 616 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 617 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 618 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 619 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 620 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 621 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 622 | } |
| 623 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 624 | return change; |
| 625 | } |
| 626 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 627 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 628 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 629 | .info = alc_pin_mode_info, \ |
| 630 | .get = alc_pin_mode_get, \ |
| 631 | .put = alc_pin_mode_put, \ |
| 632 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 633 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 634 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 635 | * together using a mask with more than one bit set. This control is |
| 636 | * currently used only by the ALC260 test model. At this stage they are not |
| 637 | * needed for any "production" models. |
| 638 | */ |
| 639 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 640 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 641 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 642 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 643 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 644 | { |
| 645 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 646 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 647 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 648 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 649 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 650 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 651 | |
| 652 | *valp = (val & mask) != 0; |
| 653 | return 0; |
| 654 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 655 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 656 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 657 | { |
| 658 | signed int change; |
| 659 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 660 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 661 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 662 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 663 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 664 | AC_VERB_GET_GPIO_DATA, |
| 665 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 666 | |
| 667 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 668 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 669 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 670 | gpio_data &= ~mask; |
| 671 | else |
| 672 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 673 | snd_hda_codec_write_cache(codec, nid, 0, |
| 674 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 675 | |
| 676 | return change; |
| 677 | } |
| 678 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 679 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 680 | .info = alc_gpio_data_info, \ |
| 681 | .get = alc_gpio_data_get, \ |
| 682 | .put = alc_gpio_data_put, \ |
| 683 | .private_value = nid | (mask<<16) } |
| 684 | #endif /* CONFIG_SND_DEBUG */ |
| 685 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 686 | /* A switch control to allow the enabling of the digital IO pins on the |
| 687 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 688 | * to provide something in the test model allowing digital outputs to be |
| 689 | * identified if present. If models are found which can utilise these |
| 690 | * outputs a more complete mixer control can be devised for those models if |
| 691 | * necessary. |
| 692 | */ |
| 693 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 694 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 695 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 696 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 697 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 698 | { |
| 699 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 700 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 701 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 702 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 703 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 704 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 705 | |
| 706 | *valp = (val & mask) != 0; |
| 707 | return 0; |
| 708 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 709 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 710 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 711 | { |
| 712 | signed int change; |
| 713 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 714 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 715 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 716 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 717 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 718 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 719 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 720 | |
| 721 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 722 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 723 | if (val==0) |
| 724 | ctrl_data &= ~mask; |
| 725 | else |
| 726 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 727 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 728 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 729 | |
| 730 | return change; |
| 731 | } |
| 732 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 733 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 734 | .info = alc_spdif_ctrl_info, \ |
| 735 | .get = alc_spdif_ctrl_get, \ |
| 736 | .put = alc_spdif_ctrl_put, \ |
| 737 | .private_value = nid | (mask<<16) } |
| 738 | #endif /* CONFIG_SND_DEBUG */ |
| 739 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 740 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 741 | * Again, this is only used in the ALC26x test models to help identify when |
| 742 | * the EAPD line must be asserted for features to work. |
| 743 | */ |
| 744 | #ifdef CONFIG_SND_DEBUG |
| 745 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 746 | |
| 747 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 748 | struct snd_ctl_elem_value *ucontrol) |
| 749 | { |
| 750 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 751 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 752 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 753 | long *valp = ucontrol->value.integer.value; |
| 754 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 755 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 756 | |
| 757 | *valp = (val & mask) != 0; |
| 758 | return 0; |
| 759 | } |
| 760 | |
| 761 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 762 | struct snd_ctl_elem_value *ucontrol) |
| 763 | { |
| 764 | int change; |
| 765 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 766 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 767 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 768 | long val = *ucontrol->value.integer.value; |
| 769 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 770 | AC_VERB_GET_EAPD_BTLENABLE, |
| 771 | 0x00); |
| 772 | |
| 773 | /* Set/unset the masked control bit(s) as needed */ |
| 774 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 775 | if (!val) |
| 776 | ctrl_data &= ~mask; |
| 777 | else |
| 778 | ctrl_data |= mask; |
| 779 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 780 | ctrl_data); |
| 781 | |
| 782 | return change; |
| 783 | } |
| 784 | |
| 785 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 786 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 787 | .info = alc_eapd_ctrl_info, \ |
| 788 | .get = alc_eapd_ctrl_get, \ |
| 789 | .put = alc_eapd_ctrl_put, \ |
| 790 | .private_value = nid | (mask<<16) } |
| 791 | #endif /* CONFIG_SND_DEBUG */ |
| 792 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 793 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 794 | * set up the input pin config (depending on the given auto-pin type) |
| 795 | */ |
| 796 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 797 | int auto_pin_type) |
| 798 | { |
| 799 | unsigned int val = PIN_IN; |
| 800 | |
| 801 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 802 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 803 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 804 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 805 | if (pincap & AC_PINCAP_VREF_80) |
| 806 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 807 | else if (pincap & AC_PINCAP_VREF_50) |
| 808 | val = PIN_VREF50; |
| 809 | else if (pincap & AC_PINCAP_VREF_100) |
| 810 | val = PIN_VREF100; |
| 811 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 812 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 813 | } |
| 814 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 815 | } |
| 816 | |
| 817 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 818 | */ |
| 819 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 820 | { |
| 821 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 822 | return; |
| 823 | spec->mixers[spec->num_mixers++] = mix; |
| 824 | } |
| 825 | |
| 826 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 827 | { |
| 828 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 829 | return; |
| 830 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 831 | } |
| 832 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 833 | #ifdef CONFIG_PROC_FS |
| 834 | /* |
| 835 | * hook for proc |
| 836 | */ |
| 837 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 838 | struct hda_codec *codec, hda_nid_t nid) |
| 839 | { |
| 840 | int coeff; |
| 841 | |
| 842 | if (nid != 0x20) |
| 843 | return; |
| 844 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 845 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 846 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 847 | AC_VERB_GET_COEF_INDEX, 0); |
| 848 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 849 | } |
| 850 | #else |
| 851 | #define print_realtek_coef NULL |
| 852 | #endif |
| 853 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 854 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 855 | * set up from the preset table |
| 856 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 857 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 858 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 859 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 860 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 861 | int i; |
| 862 | |
| 863 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 864 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 865 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 866 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 867 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 868 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 869 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 870 | spec->channel_mode = preset->channel_mode; |
| 871 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 872 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 873 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 874 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 875 | if (preset->const_channel_count) |
| 876 | spec->multiout.max_channels = preset->const_channel_count; |
| 877 | else |
| 878 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 879 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 880 | |
| 881 | spec->multiout.num_dacs = preset->num_dacs; |
| 882 | spec->multiout.dac_nids = preset->dac_nids; |
| 883 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 884 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 885 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 886 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 887 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 888 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 889 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 890 | spec->input_mux = preset->input_mux; |
| 891 | |
| 892 | spec->num_adc_nids = preset->num_adc_nids; |
| 893 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 894 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 895 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 896 | |
| 897 | spec->unsol_event = preset->unsol_event; |
| 898 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 899 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 900 | spec->loopback.amplist = preset->loopbacks; |
| 901 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 902 | |
| 903 | if (preset->setup) |
| 904 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 905 | } |
| 906 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 907 | /* Enable GPIO mask and set output */ |
| 908 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 909 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 910 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 911 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 912 | { } |
| 913 | }; |
| 914 | |
| 915 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 916 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 917 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 918 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 919 | { } |
| 920 | }; |
| 921 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 922 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 923 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 924 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 925 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 926 | { } |
| 927 | }; |
| 928 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 929 | /* |
| 930 | * Fix hardware PLL issue |
| 931 | * On some codecs, the analog PLL gating control must be off while |
| 932 | * the default value is 1. |
| 933 | */ |
| 934 | static void alc_fix_pll(struct hda_codec *codec) |
| 935 | { |
| 936 | struct alc_spec *spec = codec->spec; |
| 937 | unsigned int val; |
| 938 | |
| 939 | if (!spec->pll_nid) |
| 940 | return; |
| 941 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 942 | spec->pll_coef_idx); |
| 943 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 944 | AC_VERB_GET_PROC_COEF, 0); |
| 945 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 946 | spec->pll_coef_idx); |
| 947 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 948 | val & ~(1 << spec->pll_coef_bit)); |
| 949 | } |
| 950 | |
| 951 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 952 | unsigned int coef_idx, unsigned int coef_bit) |
| 953 | { |
| 954 | struct alc_spec *spec = codec->spec; |
| 955 | spec->pll_nid = nid; |
| 956 | spec->pll_coef_idx = coef_idx; |
| 957 | spec->pll_coef_bit = coef_bit; |
| 958 | alc_fix_pll(codec); |
| 959 | } |
| 960 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 961 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 962 | { |
| 963 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 964 | unsigned int present, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 965 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 966 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 967 | |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 968 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 969 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 970 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 971 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 972 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 973 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 974 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 975 | nid = spec->autocfg.speaker_pins[i]; |
| 976 | if (!nid) |
| 977 | break; |
| 978 | snd_hda_codec_write(codec, nid, 0, |
| 979 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 980 | spec->jack_present ? 0 : PIN_OUT); |
| 981 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 982 | } |
| 983 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 984 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 985 | hda_nid_t nid) |
| 986 | { |
| 987 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 988 | int i, nums; |
| 989 | |
| 990 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 991 | for (i = 0; i < nums; i++) |
| 992 | if (conn[i] == nid) |
| 993 | return i; |
| 994 | return -1; |
| 995 | } |
| 996 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 997 | static void alc_mic_automute(struct hda_codec *codec) |
| 998 | { |
| 999 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1000 | struct alc_mic_route *dead, *alive; |
| 1001 | unsigned int present, type; |
| 1002 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1003 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1004 | if (!spec->auto_mic) |
| 1005 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1006 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1007 | return; |
| 1008 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1009 | return; |
| 1010 | |
| 1011 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1012 | |
| 1013 | present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0, |
| 1014 | AC_VERB_GET_PIN_SENSE, 0); |
| 1015 | present &= AC_PINSENSE_PRESENCE; |
| 1016 | if (present) { |
| 1017 | alive = &spec->ext_mic; |
| 1018 | dead = &spec->int_mic; |
| 1019 | } else { |
| 1020 | alive = &spec->int_mic; |
| 1021 | dead = &spec->ext_mic; |
| 1022 | } |
| 1023 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1024 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1025 | if (type == AC_WID_AUD_MIX) { |
| 1026 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1027 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1028 | alive->mux_idx, |
| 1029 | HDA_AMP_MUTE, 0); |
| 1030 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1031 | dead->mux_idx, |
| 1032 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1033 | } else { |
| 1034 | /* MUX style (e.g. ALC880) */ |
| 1035 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1036 | AC_VERB_SET_CONNECT_SEL, |
| 1037 | alive->mux_idx); |
| 1038 | } |
| 1039 | |
| 1040 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1041 | } |
| 1042 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1043 | /* unsolicited event for HP jack sensing */ |
| 1044 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1045 | { |
| 1046 | if (codec->vendor_id == 0x10ec0880) |
| 1047 | res >>= 28; |
| 1048 | else |
| 1049 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1050 | switch (res) { |
| 1051 | case ALC880_HP_EVENT: |
| 1052 | alc_automute_pin(codec); |
| 1053 | break; |
| 1054 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1055 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1056 | break; |
| 1057 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1058 | } |
| 1059 | |
| 1060 | static void alc_inithook(struct hda_codec *codec) |
| 1061 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1062 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1063 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1064 | } |
| 1065 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1066 | /* additional initialization for ALC888 variants */ |
| 1067 | static void alc888_coef_init(struct hda_codec *codec) |
| 1068 | { |
| 1069 | unsigned int tmp; |
| 1070 | |
| 1071 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1072 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1073 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
Takashi Iwai | 37db623 | 2009-03-05 09:40:16 +0100 | [diff] [blame] | 1074 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1075 | /* alc888S-VC */ |
| 1076 | snd_hda_codec_read(codec, 0x20, 0, |
| 1077 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1078 | else |
| 1079 | /* alc888-VB */ |
| 1080 | snd_hda_codec_read(codec, 0x20, 0, |
| 1081 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1082 | } |
| 1083 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1084 | static void alc889_coef_init(struct hda_codec *codec) |
| 1085 | { |
| 1086 | unsigned int tmp; |
| 1087 | |
| 1088 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1089 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1090 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1091 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1092 | } |
| 1093 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1094 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1095 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1096 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1097 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1098 | switch (type) { |
| 1099 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1100 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1101 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1102 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1103 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1104 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1105 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1106 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1107 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1108 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1109 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1110 | case 0x10ec0260: |
| 1111 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1112 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1113 | snd_hda_codec_write(codec, 0x10, 0, |
| 1114 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1115 | break; |
| 1116 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1117 | case 0x10ec0267: |
| 1118 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1119 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1120 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1121 | case 0x10ec0660: |
| 1122 | case 0x10ec0662: |
| 1123 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1124 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1125 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1126 | snd_hda_codec_write(codec, 0x14, 0, |
| 1127 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1128 | snd_hda_codec_write(codec, 0x15, 0, |
| 1129 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1130 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1131 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1132 | switch (codec->vendor_id) { |
| 1133 | case 0x10ec0260: |
| 1134 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1135 | AC_VERB_SET_COEF_INDEX, 7); |
| 1136 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1137 | AC_VERB_GET_PROC_COEF, 0); |
| 1138 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1139 | AC_VERB_SET_COEF_INDEX, 7); |
| 1140 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1141 | AC_VERB_SET_PROC_COEF, |
| 1142 | tmp | 0x2010); |
| 1143 | break; |
| 1144 | case 0x10ec0262: |
| 1145 | case 0x10ec0880: |
| 1146 | case 0x10ec0882: |
| 1147 | case 0x10ec0883: |
| 1148 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1149 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1150 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1151 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1152 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1153 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1154 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1155 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1156 | case 0x10ec0267: |
| 1157 | case 0x10ec0268: |
| 1158 | snd_hda_codec_write(codec, 0x20, 0, |
| 1159 | AC_VERB_SET_COEF_INDEX, 7); |
| 1160 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1161 | AC_VERB_GET_PROC_COEF, 0); |
| 1162 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1163 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1164 | snd_hda_codec_write(codec, 0x20, 0, |
| 1165 | AC_VERB_SET_PROC_COEF, |
| 1166 | tmp | 0x3000); |
| 1167 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1168 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1169 | break; |
| 1170 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1171 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1172 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1173 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1174 | { |
| 1175 | struct alc_spec *spec = codec->spec; |
| 1176 | |
| 1177 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1178 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1179 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1180 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1181 | if (spec->autocfg.line_out_pins[0] && |
| 1182 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1183 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1184 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1185 | else |
| 1186 | return; |
| 1187 | } |
| 1188 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1189 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1190 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1191 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1192 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1193 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1194 | spec->unsol_event = alc_sku_unsol_event; |
| 1195 | } |
| 1196 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1197 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1198 | { |
| 1199 | struct alc_spec *spec = codec->spec; |
| 1200 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1201 | hda_nid_t fixed, ext; |
| 1202 | int i; |
| 1203 | |
| 1204 | /* there must be only two mic inputs exclusively */ |
| 1205 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1206 | if (cfg->input_pins[i]) |
| 1207 | return; |
| 1208 | |
| 1209 | fixed = ext = 0; |
| 1210 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1211 | hda_nid_t nid = cfg->input_pins[i]; |
| 1212 | unsigned int defcfg; |
| 1213 | if (!nid) |
| 1214 | return; |
| 1215 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1216 | switch (get_defcfg_connect(defcfg)) { |
| 1217 | case AC_JACK_PORT_FIXED: |
| 1218 | if (fixed) |
| 1219 | return; /* already occupied */ |
| 1220 | fixed = nid; |
| 1221 | break; |
| 1222 | case AC_JACK_PORT_COMPLEX: |
| 1223 | if (ext) |
| 1224 | return; /* already occupied */ |
| 1225 | ext = nid; |
| 1226 | break; |
| 1227 | default: |
| 1228 | return; /* invalid entry */ |
| 1229 | } |
| 1230 | } |
| 1231 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1232 | return; /* no unsol support */ |
| 1233 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1234 | ext, fixed); |
| 1235 | spec->ext_mic.pin = ext; |
| 1236 | spec->int_mic.pin = fixed; |
| 1237 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1238 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1239 | spec->auto_mic = 1; |
| 1240 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1241 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1242 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1243 | spec->unsol_event = alc_sku_unsol_event; |
| 1244 | } |
| 1245 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1246 | /* check subsystem ID and set up device-specific initialization; |
| 1247 | * return 1 if initialized, 0 if invalid SSID |
| 1248 | */ |
| 1249 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1250 | * 31 ~ 16 : Manufacture ID |
| 1251 | * 15 ~ 8 : SKU ID |
| 1252 | * 7 ~ 0 : Assembly ID |
| 1253 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1254 | */ |
| 1255 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1256 | hda_nid_t porta, hda_nid_t porte, |
| 1257 | hda_nid_t portd) |
| 1258 | { |
| 1259 | unsigned int ass, tmp, i; |
| 1260 | unsigned nid; |
| 1261 | struct alc_spec *spec = codec->spec; |
| 1262 | |
| 1263 | ass = codec->subsystem_id & 0xffff; |
| 1264 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1265 | goto do_sku; |
| 1266 | |
| 1267 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1268 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1269 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1270 | * 29~21 : reserve |
| 1271 | * 20 : PCBEEP input |
| 1272 | * 19~16 : Check sum (15:1) |
| 1273 | * 15~1 : Custom |
| 1274 | * 0 : override |
| 1275 | */ |
| 1276 | nid = 0x1d; |
| 1277 | if (codec->vendor_id == 0x10ec0260) |
| 1278 | nid = 0x17; |
| 1279 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1280 | snd_printd("realtek: No valid SSID, " |
| 1281 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1282 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1283 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1284 | return 0; |
| 1285 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1286 | return 0; |
| 1287 | |
| 1288 | /* check sum */ |
| 1289 | tmp = 0; |
| 1290 | for (i = 1; i < 16; i++) { |
| 1291 | if ((ass >> i) & 1) |
| 1292 | tmp++; |
| 1293 | } |
| 1294 | if (((ass >> 16) & 0xf) != tmp) |
| 1295 | return 0; |
| 1296 | do_sku: |
| 1297 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1298 | ass & 0xffff, codec->vendor_id); |
| 1299 | /* |
| 1300 | * 0 : override |
| 1301 | * 1 : Swap Jack |
| 1302 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1303 | * 3~5 : External Amplifier control |
| 1304 | * 7~6 : Reserved |
| 1305 | */ |
| 1306 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1307 | switch (tmp) { |
| 1308 | case 1: |
| 1309 | spec->init_amp = ALC_INIT_GPIO1; |
| 1310 | break; |
| 1311 | case 3: |
| 1312 | spec->init_amp = ALC_INIT_GPIO2; |
| 1313 | break; |
| 1314 | case 7: |
| 1315 | spec->init_amp = ALC_INIT_GPIO3; |
| 1316 | break; |
| 1317 | case 5: |
| 1318 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1319 | break; |
| 1320 | } |
| 1321 | |
| 1322 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1323 | * when the external headphone out jack is plugged" |
| 1324 | */ |
| 1325 | if (!(ass & 0x8000)) |
| 1326 | return 1; |
| 1327 | /* |
| 1328 | * 10~8 : Jack location |
| 1329 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1330 | * 14~13: Resvered |
| 1331 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1332 | * when the external headphone out jack is plugged" |
| 1333 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1334 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame^] | 1335 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1336 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1337 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame^] | 1338 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1339 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame^] | 1340 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1341 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame^] | 1342 | nid = portd; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1343 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1344 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame^] | 1345 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1346 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1347 | return 1; |
| 1348 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1349 | } |
| 1350 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1351 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1352 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1353 | return 1; |
| 1354 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1355 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1356 | static void alc_ssid_check(struct hda_codec *codec, |
| 1357 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1358 | { |
| 1359 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1360 | struct alc_spec *spec = codec->spec; |
| 1361 | snd_printd("realtek: " |
| 1362 | "Enable default setup for auto mode as fallback\n"); |
| 1363 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1364 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1365 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1366 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1367 | } |
| 1368 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1369 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1370 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1371 | */ |
| 1372 | |
| 1373 | struct alc_pincfg { |
| 1374 | hda_nid_t nid; |
| 1375 | u32 val; |
| 1376 | }; |
| 1377 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1378 | struct alc_fixup { |
| 1379 | const struct alc_pincfg *pins; |
| 1380 | const struct hda_verb *verbs; |
| 1381 | }; |
| 1382 | |
| 1383 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1384 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1385 | const struct alc_fixup *fix) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1386 | { |
| 1387 | const struct alc_pincfg *cfg; |
| 1388 | |
| 1389 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1390 | if (!quirk) |
| 1391 | return; |
| 1392 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1393 | fix += quirk->value; |
| 1394 | cfg = fix->pins; |
| 1395 | if (cfg) { |
| 1396 | for (; cfg->nid; cfg++) |
| 1397 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1398 | } |
| 1399 | if (fix->verbs) |
| 1400 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1401 | } |
| 1402 | |
| 1403 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1404 | * ALC888 |
| 1405 | */ |
| 1406 | |
| 1407 | /* |
| 1408 | * 2ch mode |
| 1409 | */ |
| 1410 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1411 | /* Mic-in jack as mic in */ |
| 1412 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1413 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1414 | /* Line-in jack as Line in */ |
| 1415 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1416 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1417 | /* Line-Out as Front */ |
| 1418 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1419 | { } /* end */ |
| 1420 | }; |
| 1421 | |
| 1422 | /* |
| 1423 | * 4ch mode |
| 1424 | */ |
| 1425 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1426 | /* Mic-in jack as mic in */ |
| 1427 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1428 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1429 | /* Line-in jack as Surround */ |
| 1430 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1431 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1432 | /* Line-Out as Front */ |
| 1433 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1434 | { } /* end */ |
| 1435 | }; |
| 1436 | |
| 1437 | /* |
| 1438 | * 6ch mode |
| 1439 | */ |
| 1440 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1441 | /* Mic-in jack as CLFE */ |
| 1442 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1443 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1444 | /* Line-in jack as Surround */ |
| 1445 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1446 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1447 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1448 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1449 | { } /* end */ |
| 1450 | }; |
| 1451 | |
| 1452 | /* |
| 1453 | * 8ch mode |
| 1454 | */ |
| 1455 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1456 | /* Mic-in jack as CLFE */ |
| 1457 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1458 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1459 | /* Line-in jack as Surround */ |
| 1460 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1461 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1462 | /* Line-Out as Side */ |
| 1463 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1464 | { } /* end */ |
| 1465 | }; |
| 1466 | |
| 1467 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1468 | { 2, alc888_4ST_ch2_intel_init }, |
| 1469 | { 4, alc888_4ST_ch4_intel_init }, |
| 1470 | { 6, alc888_4ST_ch6_intel_init }, |
| 1471 | { 8, alc888_4ST_ch8_intel_init }, |
| 1472 | }; |
| 1473 | |
| 1474 | /* |
| 1475 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1476 | */ |
| 1477 | |
| 1478 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1479 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1480 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1481 | /* Connect Internal HP to Front */ |
| 1482 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1483 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1484 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1485 | /* Connect Bass HP to Front */ |
| 1486 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1487 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1488 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1489 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1490 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1491 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1492 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1493 | /* Connect Mic jack to CLFE */ |
| 1494 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1495 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1496 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1497 | /* Connect Line-in jack to Surround */ |
| 1498 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1499 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1500 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1501 | /* Connect HP out jack to Front */ |
| 1502 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1503 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1504 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1505 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1506 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1507 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1508 | {} |
| 1509 | }; |
| 1510 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1511 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1512 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1513 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1514 | unsigned int val, mute, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1515 | hda_nid_t nid; |
| 1516 | int i; |
| 1517 | |
| 1518 | spec->jack_present = 0; |
| 1519 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1520 | nid = spec->autocfg.hp_pins[i]; |
| 1521 | if (!nid) |
| 1522 | break; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1523 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 1524 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 1525 | snd_hda_codec_read(codec, nid, 0, |
| 1526 | AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1527 | val = snd_hda_codec_read(codec, nid, 0, |
| 1528 | AC_VERB_GET_PIN_SENSE, 0); |
| 1529 | if (val & AC_PINSENSE_PRESENCE) { |
| 1530 | spec->jack_present = 1; |
| 1531 | break; |
| 1532 | } |
| 1533 | } |
| 1534 | |
| 1535 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1536 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1537 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1538 | nid = spec->autocfg.speaker_pins[i]; |
| 1539 | if (!nid) |
| 1540 | break; |
| 1541 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1542 | HDA_AMP_MUTE, mute); |
| 1543 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1544 | } |
| 1545 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1546 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1547 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1548 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1549 | if (codec->vendor_id == 0x10ec0880) |
| 1550 | res >>= 28; |
| 1551 | else |
| 1552 | res >>= 26; |
| 1553 | if (res == ALC880_HP_EVENT) |
| 1554 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1555 | } |
| 1556 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1557 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1558 | { |
| 1559 | struct alc_spec *spec = codec->spec; |
| 1560 | |
| 1561 | spec->autocfg.hp_pins[0] = 0x15; |
| 1562 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1563 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1564 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1565 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1566 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1567 | } |
| 1568 | |
| 1569 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1570 | { |
| 1571 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1572 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1573 | } |
| 1574 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1575 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1576 | { |
| 1577 | struct alc_spec *spec = codec->spec; |
| 1578 | |
| 1579 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1580 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1581 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1582 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1583 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1584 | |
| 1585 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1586 | * ALC888 Acer Aspire 4930G model |
| 1587 | */ |
| 1588 | |
| 1589 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1590 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1591 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1592 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1593 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1594 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1595 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1596 | /* Connect Internal HP to front */ |
| 1597 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1598 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1599 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1600 | /* Connect HP out to front */ |
| 1601 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1602 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1603 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1604 | { } |
| 1605 | }; |
| 1606 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1607 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1608 | * ALC888 Acer Aspire 6530G model |
| 1609 | */ |
| 1610 | |
| 1611 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1612 | /* Bias voltage on for external mic port */ |
| 1613 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1614 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1615 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1616 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1617 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1618 | /* Enable unsolicited event for HP jack */ |
| 1619 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1620 | /* Enable speaker output */ |
| 1621 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1622 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1623 | /* Enable headphone output */ |
| 1624 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1625 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1626 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1627 | { } |
| 1628 | }; |
| 1629 | |
| 1630 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1631 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1632 | */ |
| 1633 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1634 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1635 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1636 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1637 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1638 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1639 | /* Enable unsolicited event for HP jack */ |
| 1640 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1641 | /* Connect Internal Front to Front */ |
| 1642 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1643 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1644 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1645 | /* Connect Internal Rear to Rear */ |
| 1646 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1647 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1648 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1649 | /* Connect Internal CLFE to CLFE */ |
| 1650 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1651 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1652 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1653 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1654 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1655 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1656 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1657 | /* Enable all DACs */ |
| 1658 | /* DAC DISABLE/MUTE 1? */ |
| 1659 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1660 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1661 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1662 | /* DAC DISABLE/MUTE 2? */ |
| 1663 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1664 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1665 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1666 | /* Enable amplifiers */ |
| 1667 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1668 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1669 | /* DMIC fix |
| 1670 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1671 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1672 | * makes the signal become a difference/sum signal instead of standard |
| 1673 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1674 | * codec replicate the sum signal to both channels, turning it into a |
| 1675 | * normal mono mic. |
| 1676 | */ |
| 1677 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1678 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1679 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1680 | { } |
| 1681 | }; |
| 1682 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1683 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1684 | /* Front mic only available on one ADC */ |
| 1685 | { |
| 1686 | .num_items = 4, |
| 1687 | .items = { |
| 1688 | { "Mic", 0x0 }, |
| 1689 | { "Line", 0x2 }, |
| 1690 | { "CD", 0x4 }, |
| 1691 | { "Front Mic", 0xb }, |
| 1692 | }, |
| 1693 | }, |
| 1694 | { |
| 1695 | .num_items = 3, |
| 1696 | .items = { |
| 1697 | { "Mic", 0x0 }, |
| 1698 | { "Line", 0x2 }, |
| 1699 | { "CD", 0x4 }, |
| 1700 | }, |
| 1701 | } |
| 1702 | }; |
| 1703 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1704 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1705 | /* Interal mic only available on one ADC */ |
| 1706 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1707 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1708 | .items = { |
| 1709 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1710 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1711 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1712 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1713 | { "Int Mic", 0xb }, |
| 1714 | }, |
| 1715 | }, |
| 1716 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1717 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1718 | .items = { |
| 1719 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1720 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1721 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1722 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1723 | }, |
| 1724 | } |
| 1725 | }; |
| 1726 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1727 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1728 | /* Digital mic only available on first "ADC" */ |
| 1729 | { |
| 1730 | .num_items = 5, |
| 1731 | .items = { |
| 1732 | { "Mic", 0x0 }, |
| 1733 | { "Line", 0x2 }, |
| 1734 | { "CD", 0x4 }, |
| 1735 | { "Front Mic", 0xb }, |
| 1736 | { "Input Mix", 0xa }, |
| 1737 | }, |
| 1738 | }, |
| 1739 | { |
| 1740 | .num_items = 4, |
| 1741 | .items = { |
| 1742 | { "Mic", 0x0 }, |
| 1743 | { "Line", 0x2 }, |
| 1744 | { "CD", 0x4 }, |
| 1745 | { "Input Mix", 0xa }, |
| 1746 | }, |
| 1747 | }, |
| 1748 | { |
| 1749 | .num_items = 4, |
| 1750 | .items = { |
| 1751 | { "Mic", 0x0 }, |
| 1752 | { "Line", 0x2 }, |
| 1753 | { "CD", 0x4 }, |
| 1754 | { "Input Mix", 0xa }, |
| 1755 | }, |
| 1756 | } |
| 1757 | }; |
| 1758 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1759 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1760 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1761 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1762 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1763 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1764 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1765 | HDA_OUTPUT), |
| 1766 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1767 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1768 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1769 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1770 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1771 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1772 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1773 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1774 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1775 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1776 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1777 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1778 | { } /* end */ |
| 1779 | }; |
| 1780 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1781 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1782 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1783 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1784 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1785 | spec->autocfg.hp_pins[0] = 0x15; |
| 1786 | spec->autocfg.speaker_pins[0] = 0x14; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1787 | } |
| 1788 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1789 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1790 | { |
| 1791 | struct alc_spec *spec = codec->spec; |
| 1792 | |
| 1793 | spec->autocfg.hp_pins[0] = 0x15; |
| 1794 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1795 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1796 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1797 | } |
| 1798 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1799 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1800 | { |
| 1801 | struct alc_spec *spec = codec->spec; |
| 1802 | |
| 1803 | spec->autocfg.hp_pins[0] = 0x15; |
| 1804 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1805 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1806 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1807 | } |
| 1808 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1809 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1810 | * ALC880 3-stack model |
| 1811 | * |
| 1812 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1813 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1814 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1815 | */ |
| 1816 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1817 | static hda_nid_t alc880_dac_nids[4] = { |
| 1818 | /* front, rear, clfe, rear_surr */ |
| 1819 | 0x02, 0x05, 0x04, 0x03 |
| 1820 | }; |
| 1821 | |
| 1822 | static hda_nid_t alc880_adc_nids[3] = { |
| 1823 | /* ADC0-2 */ |
| 1824 | 0x07, 0x08, 0x09, |
| 1825 | }; |
| 1826 | |
| 1827 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1828 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1829 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1830 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1831 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1832 | /* ADC1-2 */ |
| 1833 | 0x08, 0x09, |
| 1834 | }; |
| 1835 | |
| 1836 | #define ALC880_DIGOUT_NID 0x06 |
| 1837 | #define ALC880_DIGIN_NID 0x0a |
| 1838 | |
| 1839 | static struct hda_input_mux alc880_capture_source = { |
| 1840 | .num_items = 4, |
| 1841 | .items = { |
| 1842 | { "Mic", 0x0 }, |
| 1843 | { "Front Mic", 0x3 }, |
| 1844 | { "Line", 0x2 }, |
| 1845 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1846 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1847 | }; |
| 1848 | |
| 1849 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1850 | /* 2ch mode */ |
| 1851 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1852 | /* set line-in to input, mute it */ |
| 1853 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1854 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1855 | /* set mic-in to input vref 80%, mute it */ |
| 1856 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1857 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1858 | { } /* end */ |
| 1859 | }; |
| 1860 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1861 | /* 6ch mode */ |
| 1862 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1863 | /* set line-in to output, unmute it */ |
| 1864 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1865 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1866 | /* set mic-in to output, unmute it */ |
| 1867 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1868 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1869 | { } /* end */ |
| 1870 | }; |
| 1871 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1872 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1873 | { 2, alc880_threestack_ch2_init }, |
| 1874 | { 6, alc880_threestack_ch6_init }, |
| 1875 | }; |
| 1876 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1877 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1878 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1879 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1880 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1881 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1882 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1883 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1884 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1885 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1886 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1887 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1888 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1889 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1890 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1891 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1892 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1893 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1894 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1895 | { |
| 1896 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1897 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1898 | .info = alc_ch_mode_info, |
| 1899 | .get = alc_ch_mode_get, |
| 1900 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1901 | }, |
| 1902 | { } /* end */ |
| 1903 | }; |
| 1904 | |
| 1905 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1906 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1907 | struct snd_ctl_elem_info *uinfo) |
| 1908 | { |
| 1909 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1910 | struct alc_spec *spec = codec->spec; |
| 1911 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1912 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1913 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1914 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1915 | HDA_INPUT); |
| 1916 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1917 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1918 | return err; |
| 1919 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1920 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1921 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1922 | unsigned int size, unsigned int __user *tlv) |
| 1923 | { |
| 1924 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1925 | struct alc_spec *spec = codec->spec; |
| 1926 | int err; |
| 1927 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1928 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1929 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1930 | HDA_INPUT); |
| 1931 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1932 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1933 | return err; |
| 1934 | } |
| 1935 | |
| 1936 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1937 | struct snd_ctl_elem_value *ucontrol); |
| 1938 | |
| 1939 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1940 | struct snd_ctl_elem_value *ucontrol, |
| 1941 | getput_call_t func) |
| 1942 | { |
| 1943 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1944 | struct alc_spec *spec = codec->spec; |
| 1945 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1946 | int err; |
| 1947 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1948 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1949 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1950 | 3, 0, HDA_INPUT); |
| 1951 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1952 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1953 | return err; |
| 1954 | } |
| 1955 | |
| 1956 | static int alc_cap_vol_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_volume_get); |
| 1961 | } |
| 1962 | |
| 1963 | static int alc_cap_vol_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_volume_put); |
| 1968 | } |
| 1969 | |
| 1970 | /* capture mixer elements */ |
| 1971 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1972 | |
| 1973 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1974 | struct snd_ctl_elem_value *ucontrol) |
| 1975 | { |
| 1976 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1977 | snd_hda_mixer_amp_switch_get); |
| 1978 | } |
| 1979 | |
| 1980 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1981 | struct snd_ctl_elem_value *ucontrol) |
| 1982 | { |
| 1983 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1984 | snd_hda_mixer_amp_switch_put); |
| 1985 | } |
| 1986 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1987 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1988 | { \ |
| 1989 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1990 | .name = "Capture Switch", \ |
| 1991 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1992 | .count = num, \ |
| 1993 | .info = alc_cap_sw_info, \ |
| 1994 | .get = alc_cap_sw_get, \ |
| 1995 | .put = alc_cap_sw_put, \ |
| 1996 | }, \ |
| 1997 | { \ |
| 1998 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1999 | .name = "Capture Volume", \ |
| 2000 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2001 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2002 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2003 | .count = num, \ |
| 2004 | .info = alc_cap_vol_info, \ |
| 2005 | .get = alc_cap_vol_get, \ |
| 2006 | .put = alc_cap_vol_put, \ |
| 2007 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2008 | } |
| 2009 | |
| 2010 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2011 | { \ |
| 2012 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2013 | /* .name = "Capture Source", */ \ |
| 2014 | .name = "Input Source", \ |
| 2015 | .count = num, \ |
| 2016 | .info = alc_mux_enum_info, \ |
| 2017 | .get = alc_mux_enum_get, \ |
| 2018 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2019 | } |
| 2020 | |
| 2021 | #define DEFINE_CAPMIX(num) \ |
| 2022 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2023 | _DEFINE_CAPMIX(num), \ |
| 2024 | _DEFINE_CAPSRC(num), \ |
| 2025 | { } /* end */ \ |
| 2026 | } |
| 2027 | |
| 2028 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2029 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2030 | _DEFINE_CAPMIX(num), \ |
| 2031 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2032 | } |
| 2033 | |
| 2034 | /* up to three ADCs */ |
| 2035 | DEFINE_CAPMIX(1); |
| 2036 | DEFINE_CAPMIX(2); |
| 2037 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2038 | DEFINE_CAPMIX_NOSRC(1); |
| 2039 | DEFINE_CAPMIX_NOSRC(2); |
| 2040 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2041 | |
| 2042 | /* |
| 2043 | * ALC880 5-stack model |
| 2044 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2045 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2046 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2047 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2048 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2049 | */ |
| 2050 | |
| 2051 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2052 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2053 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2054 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2055 | { } /* end */ |
| 2056 | }; |
| 2057 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2058 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2059 | /* 6ch mode */ |
| 2060 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2061 | /* set line-in to input, mute it */ |
| 2062 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2063 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2064 | { } /* end */ |
| 2065 | }; |
| 2066 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2067 | /* 8ch mode */ |
| 2068 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2069 | /* set line-in to output, unmute it */ |
| 2070 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2071 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2072 | { } /* end */ |
| 2073 | }; |
| 2074 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2075 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2076 | { 6, alc880_fivestack_ch6_init }, |
| 2077 | { 8, alc880_fivestack_ch8_init }, |
| 2078 | }; |
| 2079 | |
| 2080 | |
| 2081 | /* |
| 2082 | * ALC880 6-stack model |
| 2083 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2084 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2085 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2086 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2087 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2088 | */ |
| 2089 | |
| 2090 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2091 | /* front, rear, clfe, rear_surr */ |
| 2092 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2093 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2094 | |
| 2095 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2096 | .num_items = 4, |
| 2097 | .items = { |
| 2098 | { "Mic", 0x0 }, |
| 2099 | { "Front Mic", 0x1 }, |
| 2100 | { "Line", 0x2 }, |
| 2101 | { "CD", 0x4 }, |
| 2102 | }, |
| 2103 | }; |
| 2104 | |
| 2105 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2106 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2107 | { 8, NULL }, |
| 2108 | }; |
| 2109 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2110 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2111 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2112 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2113 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2114 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2115 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2116 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2117 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2118 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2119 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2120 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2121 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2122 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2123 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2124 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2125 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2126 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2127 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2128 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2129 | { |
| 2130 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2131 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2132 | .info = alc_ch_mode_info, |
| 2133 | .get = alc_ch_mode_get, |
| 2134 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2135 | }, |
| 2136 | { } /* end */ |
| 2137 | }; |
| 2138 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2139 | |
| 2140 | /* |
| 2141 | * ALC880 W810 model |
| 2142 | * |
| 2143 | * W810 has rear IO for: |
| 2144 | * Front (DAC 02) |
| 2145 | * Surround (DAC 03) |
| 2146 | * Center/LFE (DAC 04) |
| 2147 | * Digital out (06) |
| 2148 | * |
| 2149 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2150 | * 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] | 2151 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2152 | * There is a variable resistor to control the speaker or headphone |
| 2153 | * volume. This is a hardware-only device without a software API. |
| 2154 | * |
| 2155 | * Plugging headphones in will disable the internal speakers. This is |
| 2156 | * implemented in hardware, not via the driver using jack sense. In |
| 2157 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2158 | * disable both the speakers and headphones. |
| 2159 | * |
| 2160 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2161 | * These may not do anything useful with this driver yet, because I |
| 2162 | * haven't setup any initialization verbs for these yet... |
| 2163 | */ |
| 2164 | |
| 2165 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2166 | /* front, rear/surround, clfe */ |
| 2167 | 0x02, 0x03, 0x04 |
| 2168 | }; |
| 2169 | |
| 2170 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2171 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2172 | { 6, NULL } |
| 2173 | }; |
| 2174 | |
| 2175 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2176 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2177 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2178 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2179 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2180 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2181 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2182 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2183 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2184 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2185 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2186 | { } /* end */ |
| 2187 | }; |
| 2188 | |
| 2189 | |
| 2190 | /* |
| 2191 | * Z710V model |
| 2192 | * |
| 2193 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2194 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2195 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2196 | */ |
| 2197 | |
| 2198 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2199 | 0x02 |
| 2200 | }; |
| 2201 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2202 | |
| 2203 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2204 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2205 | { 2, NULL } |
| 2206 | }; |
| 2207 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2208 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2209 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2210 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2211 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2212 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2213 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2214 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2217 | { } /* end */ |
| 2218 | }; |
| 2219 | |
| 2220 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2221 | /* |
| 2222 | * ALC880 F1734 model |
| 2223 | * |
| 2224 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2225 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2226 | */ |
| 2227 | |
| 2228 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2229 | 0x03 |
| 2230 | }; |
| 2231 | #define ALC880_F1734_HP_DAC 0x02 |
| 2232 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2233 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2234 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2235 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2236 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2237 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2238 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2239 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2240 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2241 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2242 | { } /* end */ |
| 2243 | }; |
| 2244 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2245 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2246 | .num_items = 2, |
| 2247 | .items = { |
| 2248 | { "Mic", 0x1 }, |
| 2249 | { "CD", 0x4 }, |
| 2250 | }, |
| 2251 | }; |
| 2252 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2253 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2254 | /* |
| 2255 | * ALC880 ASUS model |
| 2256 | * |
| 2257 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2258 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2259 | * Mic = 0x18, Line = 0x1a |
| 2260 | */ |
| 2261 | |
| 2262 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2263 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2264 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2265 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2266 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2267 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2268 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2269 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2270 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2271 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2272 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2273 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2274 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2275 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2276 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2277 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2278 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2279 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2280 | { |
| 2281 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2282 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2283 | .info = alc_ch_mode_info, |
| 2284 | .get = alc_ch_mode_get, |
| 2285 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2286 | }, |
| 2287 | { } /* end */ |
| 2288 | }; |
| 2289 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2290 | /* |
| 2291 | * ALC880 ASUS W1V model |
| 2292 | * |
| 2293 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2294 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2295 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2296 | */ |
| 2297 | |
| 2298 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2299 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2300 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2301 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2302 | { } /* end */ |
| 2303 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2304 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2305 | /* TCL S700 */ |
| 2306 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2307 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2308 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2309 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2310 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2311 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2312 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2313 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2314 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2315 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2316 | { } /* end */ |
| 2317 | }; |
| 2318 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2319 | /* Uniwill */ |
| 2320 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2321 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2322 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2323 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2324 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2325 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2326 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2327 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2328 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2329 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2330 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2331 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2332 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2333 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2334 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2335 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2336 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2337 | { |
| 2338 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2339 | .name = "Channel Mode", |
| 2340 | .info = alc_ch_mode_info, |
| 2341 | .get = alc_ch_mode_get, |
| 2342 | .put = alc_ch_mode_put, |
| 2343 | }, |
| 2344 | { } /* end */ |
| 2345 | }; |
| 2346 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2347 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2348 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2349 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2350 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2351 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2352 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2353 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2354 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2355 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2356 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2357 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2358 | { } /* end */ |
| 2359 | }; |
| 2360 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2361 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2362 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2363 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2364 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2365 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2366 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2367 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2368 | { } /* end */ |
| 2369 | }; |
| 2370 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2371 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2372 | * virtual master controls |
| 2373 | */ |
| 2374 | |
| 2375 | /* |
| 2376 | * slave controls for virtual master |
| 2377 | */ |
| 2378 | static const char *alc_slave_vols[] = { |
| 2379 | "Front Playback Volume", |
| 2380 | "Surround Playback Volume", |
| 2381 | "Center Playback Volume", |
| 2382 | "LFE Playback Volume", |
| 2383 | "Side Playback Volume", |
| 2384 | "Headphone Playback Volume", |
| 2385 | "Speaker Playback Volume", |
| 2386 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2387 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2388 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2389 | NULL, |
| 2390 | }; |
| 2391 | |
| 2392 | static const char *alc_slave_sws[] = { |
| 2393 | "Front Playback Switch", |
| 2394 | "Surround Playback Switch", |
| 2395 | "Center Playback Switch", |
| 2396 | "LFE Playback Switch", |
| 2397 | "Side Playback Switch", |
| 2398 | "Headphone Playback Switch", |
| 2399 | "Speaker Playback Switch", |
| 2400 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2401 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2402 | NULL, |
| 2403 | }; |
| 2404 | |
| 2405 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2406 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2407 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2408 | |
| 2409 | static void alc_free_kctls(struct hda_codec *codec); |
| 2410 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2411 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2412 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2413 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2414 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2415 | { } /* end */ |
| 2416 | }; |
| 2417 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2418 | static int alc_build_controls(struct hda_codec *codec) |
| 2419 | { |
| 2420 | struct alc_spec *spec = codec->spec; |
| 2421 | int err; |
| 2422 | int i; |
| 2423 | |
| 2424 | for (i = 0; i < spec->num_mixers; i++) { |
| 2425 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2426 | if (err < 0) |
| 2427 | return err; |
| 2428 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2429 | if (spec->cap_mixer) { |
| 2430 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2431 | if (err < 0) |
| 2432 | return err; |
| 2433 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2434 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2435 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2436 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2437 | if (err < 0) |
| 2438 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2439 | if (!spec->no_analog) { |
| 2440 | err = snd_hda_create_spdif_share_sw(codec, |
| 2441 | &spec->multiout); |
| 2442 | if (err < 0) |
| 2443 | return err; |
| 2444 | spec->multiout.share_spdif = 1; |
| 2445 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2446 | } |
| 2447 | if (spec->dig_in_nid) { |
| 2448 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2449 | if (err < 0) |
| 2450 | return err; |
| 2451 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2452 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2453 | /* create beep controls if needed */ |
| 2454 | if (spec->beep_amp) { |
| 2455 | struct snd_kcontrol_new *knew; |
| 2456 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2457 | struct snd_kcontrol *kctl; |
| 2458 | kctl = snd_ctl_new1(knew, codec); |
| 2459 | if (!kctl) |
| 2460 | return -ENOMEM; |
| 2461 | kctl->private_value = spec->beep_amp; |
| 2462 | err = snd_hda_ctl_add(codec, kctl); |
| 2463 | if (err < 0) |
| 2464 | return err; |
| 2465 | } |
| 2466 | } |
| 2467 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2468 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2469 | if (!spec->no_analog && |
| 2470 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2471 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2472 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2473 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2474 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2475 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2476 | if (err < 0) |
| 2477 | return err; |
| 2478 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2479 | if (!spec->no_analog && |
| 2480 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2481 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2482 | NULL, alc_slave_sws); |
| 2483 | if (err < 0) |
| 2484 | return err; |
| 2485 | } |
| 2486 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2487 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2488 | return 0; |
| 2489 | } |
| 2490 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2491 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2492 | /* |
| 2493 | * initialize the codec volumes, etc |
| 2494 | */ |
| 2495 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2496 | /* |
| 2497 | * generic initialization of ADC, input mixers and output mixers |
| 2498 | */ |
| 2499 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2500 | /* |
| 2501 | * Unmute ADC0-2 and set the default input to mic-in |
| 2502 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2503 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2505 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2506 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2507 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2508 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
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 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2511 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2512 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2513 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2514 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2515 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2516 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2517 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2518 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2519 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2520 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2521 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2522 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2523 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2524 | /* |
| 2525 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2526 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2527 | /* set vol=0 to output mixers */ |
| 2528 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2529 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2530 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2531 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2532 | /* set up input amps for analog loopback */ |
| 2533 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2534 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2535 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2536 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2537 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2538 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2539 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2540 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2541 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2542 | |
| 2543 | { } |
| 2544 | }; |
| 2545 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2546 | /* |
| 2547 | * 3-stack pin configuration: |
| 2548 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2549 | */ |
| 2550 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2551 | /* |
| 2552 | * preset connection lists of input pins |
| 2553 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2554 | */ |
| 2555 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2556 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2557 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2558 | |
| 2559 | /* |
| 2560 | * Set pin mode and muting |
| 2561 | */ |
| 2562 | /* set front pin widgets 0x14 for output */ |
| 2563 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2564 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2565 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2566 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2567 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2568 | /* Mic2 (as headphone out) for HP output */ |
| 2569 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2570 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2571 | /* Line In pin widget for input */ |
| 2572 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2573 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2574 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2575 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2576 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2577 | /* CD pin widget for input */ |
| 2578 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2579 | |
| 2580 | { } |
| 2581 | }; |
| 2582 | |
| 2583 | /* |
| 2584 | * 5-stack pin configuration: |
| 2585 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2586 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2587 | */ |
| 2588 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2589 | /* |
| 2590 | * preset connection lists of input pins |
| 2591 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2592 | */ |
| 2593 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2594 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2595 | |
| 2596 | /* |
| 2597 | * Set pin mode and muting |
| 2598 | */ |
| 2599 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2600 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2601 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2602 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2603 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2604 | /* unmute pins for output (no gain on this amp) */ |
| 2605 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2606 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2607 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2608 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2609 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2610 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2611 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2612 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2613 | /* Mic2 (as headphone out) for HP output */ |
| 2614 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2615 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2616 | /* Line In pin widget for input */ |
| 2617 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2618 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2619 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2620 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2621 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2622 | /* CD pin widget for input */ |
| 2623 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2624 | |
| 2625 | { } |
| 2626 | }; |
| 2627 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2628 | /* |
| 2629 | * W810 pin configuration: |
| 2630 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2631 | */ |
| 2632 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2633 | /* hphone/speaker input selector: front DAC */ |
| 2634 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2635 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2636 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2637 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2638 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2639 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2640 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2641 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2642 | |
| 2643 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2644 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2645 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2646 | { } |
| 2647 | }; |
| 2648 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2649 | /* |
| 2650 | * Z71V pin configuration: |
| 2651 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2652 | */ |
| 2653 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2654 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2655 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2656 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2657 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2658 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2659 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2660 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2661 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2662 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2663 | |
| 2664 | { } |
| 2665 | }; |
| 2666 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2667 | /* |
| 2668 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2669 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2670 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2671 | */ |
| 2672 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2673 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2674 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2675 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2676 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2677 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2678 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2679 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2680 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2681 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2682 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2683 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2684 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2685 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2686 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2687 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2688 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2689 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2690 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2691 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2692 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2693 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2694 | { } |
| 2695 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2696 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2697 | /* |
| 2698 | * Uniwill pin configuration: |
| 2699 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2700 | * line = 0x1a |
| 2701 | */ |
| 2702 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2703 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2704 | |
| 2705 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2706 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2707 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2708 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2709 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2710 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2711 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2712 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2713 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2714 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2715 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2716 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2717 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2718 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2719 | |
| 2720 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2721 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2722 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2723 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2724 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2725 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2726 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2727 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2728 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2729 | |
| 2730 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2731 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2732 | |
| 2733 | { } |
| 2734 | }; |
| 2735 | |
| 2736 | /* |
| 2737 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2738 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2739 | */ |
| 2740 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2741 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2742 | |
| 2743 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2744 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2745 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2746 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2747 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2748 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2749 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2750 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2751 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2752 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2753 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2754 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2755 | |
| 2756 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2757 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2758 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2759 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2760 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2761 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2762 | |
| 2763 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2764 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2765 | |
| 2766 | { } |
| 2767 | }; |
| 2768 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2769 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2770 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2771 | { } |
| 2772 | }; |
| 2773 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2774 | /* auto-toggle front mic */ |
| 2775 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2776 | { |
| 2777 | unsigned int present; |
| 2778 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2779 | |
| 2780 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2781 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2782 | bits = present ? HDA_AMP_MUTE : 0; |
| 2783 | 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] | 2784 | } |
| 2785 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2786 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2787 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2788 | struct alc_spec *spec = codec->spec; |
| 2789 | |
| 2790 | spec->autocfg.hp_pins[0] = 0x14; |
| 2791 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2792 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2793 | } |
| 2794 | |
| 2795 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 2796 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2797 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2798 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2799 | } |
| 2800 | |
| 2801 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2802 | unsigned int res) |
| 2803 | { |
| 2804 | /* Looks like the unsol event is incompatible with the standard |
| 2805 | * definition. 4bit tag is placed at 28 bit! |
| 2806 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2807 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2808 | case ALC880_MIC_EVENT: |
| 2809 | alc880_uniwill_mic_automute(codec); |
| 2810 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2811 | default: |
| 2812 | alc_automute_amp_unsol_event(codec, res); |
| 2813 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2814 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2815 | } |
| 2816 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2817 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2818 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2819 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2820 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2821 | spec->autocfg.hp_pins[0] = 0x14; |
| 2822 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2823 | } |
| 2824 | |
| 2825 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2826 | { |
| 2827 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2828 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2829 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2830 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2831 | present &= HDA_AMP_VOLMASK; |
| 2832 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2833 | HDA_AMP_VOLMASK, present); |
| 2834 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2835 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2836 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2837 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2838 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2839 | unsigned int res) |
| 2840 | { |
| 2841 | /* Looks like the unsol event is incompatible with the standard |
| 2842 | * definition. 4bit tag is placed at 28 bit! |
| 2843 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2844 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2845 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2846 | else |
| 2847 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2848 | } |
| 2849 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2850 | /* |
| 2851 | * F1734 pin configuration: |
| 2852 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2853 | */ |
| 2854 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2855 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2856 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2857 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2858 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2859 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2860 | |
| 2861 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2862 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2863 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2864 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2865 | |
| 2866 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2867 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2868 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2869 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2870 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2871 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2872 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2873 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2874 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2875 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2876 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2877 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2878 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2879 | { } |
| 2880 | }; |
| 2881 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2882 | /* |
| 2883 | * ASUS pin configuration: |
| 2884 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2885 | */ |
| 2886 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2887 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2888 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2889 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2890 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2891 | |
| 2892 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2893 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2894 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2895 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2896 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2897 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2898 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2899 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2900 | |
| 2901 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2902 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2903 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2904 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2905 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2906 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2907 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2908 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2909 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2910 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2911 | { } |
| 2912 | }; |
| 2913 | |
| 2914 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2915 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2916 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2917 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2918 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2919 | /* Clevo m520g init */ |
| 2920 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2921 | /* headphone output */ |
| 2922 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2923 | /* line-out */ |
| 2924 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2925 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2926 | /* Line-in */ |
| 2927 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2928 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2929 | /* CD */ |
| 2930 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2931 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2932 | /* Mic1 (rear panel) */ |
| 2933 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2934 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2935 | /* Mic2 (front panel) */ |
| 2936 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2937 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2938 | /* headphone */ |
| 2939 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2940 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2941 | /* change to EAPD mode */ |
| 2942 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2943 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2944 | |
| 2945 | { } |
| 2946 | }; |
| 2947 | |
| 2948 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2949 | /* change to EAPD mode */ |
| 2950 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2951 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2952 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2953 | /* Headphone output */ |
| 2954 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2955 | /* Front output*/ |
| 2956 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2957 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2958 | |
| 2959 | /* Line In pin widget for input */ |
| 2960 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2961 | /* CD pin widget for input */ |
| 2962 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2963 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2964 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2965 | |
| 2966 | /* change to EAPD mode */ |
| 2967 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2968 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2969 | |
| 2970 | { } |
| 2971 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2972 | |
| 2973 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2974 | * LG m1 express dual |
| 2975 | * |
| 2976 | * Pin assignment: |
| 2977 | * Rear Line-In/Out (blue): 0x14 |
| 2978 | * Build-in Mic-In: 0x15 |
| 2979 | * Speaker-out: 0x17 |
| 2980 | * HP-Out (green): 0x1b |
| 2981 | * Mic-In/Out (red): 0x19 |
| 2982 | * SPDIF-Out: 0x1e |
| 2983 | */ |
| 2984 | |
| 2985 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2986 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2987 | 0x05, 0x02, 0x03 |
| 2988 | }; |
| 2989 | |
| 2990 | /* seems analog CD is not working */ |
| 2991 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2992 | .num_items = 3, |
| 2993 | .items = { |
| 2994 | { "Mic", 0x1 }, |
| 2995 | { "Line", 0x5 }, |
| 2996 | { "Internal Mic", 0x6 }, |
| 2997 | }, |
| 2998 | }; |
| 2999 | |
| 3000 | /* 2,4,6 channel modes */ |
| 3001 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3002 | /* set line-in and mic-in to input */ |
| 3003 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3004 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3005 | { } |
| 3006 | }; |
| 3007 | |
| 3008 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3009 | /* set line-in to out and mic-in to input */ |
| 3010 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3011 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3012 | { } |
| 3013 | }; |
| 3014 | |
| 3015 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3016 | /* set line-in and mic-in to output */ |
| 3017 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3018 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3019 | { } |
| 3020 | }; |
| 3021 | |
| 3022 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3023 | { 2, alc880_lg_ch2_init }, |
| 3024 | { 4, alc880_lg_ch4_init }, |
| 3025 | { 6, alc880_lg_ch6_init }, |
| 3026 | }; |
| 3027 | |
| 3028 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3029 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3030 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3031 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3032 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3033 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3034 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3035 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3036 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3037 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3038 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3039 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3040 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3041 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3042 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3043 | { |
| 3044 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3045 | .name = "Channel Mode", |
| 3046 | .info = alc_ch_mode_info, |
| 3047 | .get = alc_ch_mode_get, |
| 3048 | .put = alc_ch_mode_put, |
| 3049 | }, |
| 3050 | { } /* end */ |
| 3051 | }; |
| 3052 | |
| 3053 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3054 | /* set capture source to mic-in */ |
| 3055 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3056 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3057 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3058 | /* mute all amp mixer inputs */ |
| 3059 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3060 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3061 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3062 | /* line-in to input */ |
| 3063 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3064 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3065 | /* built-in mic */ |
| 3066 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3068 | /* speaker-out */ |
| 3069 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3070 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3071 | /* mic-in to input */ |
| 3072 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3073 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3074 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3075 | /* HP-out */ |
| 3076 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3077 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3078 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3079 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3080 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3081 | { } |
| 3082 | }; |
| 3083 | |
| 3084 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3085 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3086 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3087 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3088 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3089 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3090 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3091 | } |
| 3092 | |
| 3093 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3094 | * LG LW20 |
| 3095 | * |
| 3096 | * Pin assignment: |
| 3097 | * Speaker-out: 0x14 |
| 3098 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3099 | * Built-in Mic-In: 0x19 |
| 3100 | * Line-In: 0x1b |
| 3101 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3102 | * SPDIF-Out: 0x1e |
| 3103 | */ |
| 3104 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3105 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3106 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3107 | .items = { |
| 3108 | { "Mic", 0x0 }, |
| 3109 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3110 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3111 | }, |
| 3112 | }; |
| 3113 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3114 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3115 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3116 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3117 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3118 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3119 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3120 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3121 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3122 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3123 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3124 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3125 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3126 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3127 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3128 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3129 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3130 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3131 | { |
| 3132 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3133 | .name = "Channel Mode", |
| 3134 | .info = alc_ch_mode_info, |
| 3135 | .get = alc_ch_mode_get, |
| 3136 | .put = alc_ch_mode_put, |
| 3137 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3138 | { } /* end */ |
| 3139 | }; |
| 3140 | |
| 3141 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3142 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3143 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3144 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3145 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3146 | /* set capture source to mic-in */ |
| 3147 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3148 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3149 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3150 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3151 | /* speaker-out */ |
| 3152 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3153 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3154 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3155 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3156 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3157 | /* mic-in to input */ |
| 3158 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3159 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3160 | /* built-in mic */ |
| 3161 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3162 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3163 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3164 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3165 | { } |
| 3166 | }; |
| 3167 | |
| 3168 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3169 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3170 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3171 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3172 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3173 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3174 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3175 | } |
| 3176 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3177 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3178 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3179 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3180 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3181 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3182 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3183 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3184 | { } /* end */ |
| 3185 | }; |
| 3186 | |
| 3187 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3188 | .num_items = 2, |
| 3189 | .items = { |
| 3190 | { "Mic", 0x0 }, |
| 3191 | { "Internal Mic", 0x1 }, |
| 3192 | }, |
| 3193 | }; |
| 3194 | |
| 3195 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3196 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3197 | |
| 3198 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3199 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3200 | |
| 3201 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3202 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3203 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3204 | /* Mic2 (as headphone out) for HP output */ |
| 3205 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3206 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3207 | /* Internal Speaker */ |
| 3208 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3209 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3210 | |
| 3211 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3212 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3213 | |
| 3214 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3215 | { } |
| 3216 | }; |
| 3217 | |
| 3218 | /* toggle speaker-output according to the hp-jack state */ |
| 3219 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3220 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3221 | struct alc_spec *spec = codec->spec; |
| 3222 | alc_automute_amp(codec); |
| 3223 | /* toggle EAPD */ |
| 3224 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3225 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3226 | else |
| 3227 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3228 | } |
| 3229 | |
| 3230 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3231 | unsigned int res) |
| 3232 | { |
| 3233 | /* Looks like the unsol event is incompatible with the standard |
| 3234 | * definition. 4bit tag is placed at 28 bit! |
| 3235 | */ |
| 3236 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3237 | alc880_medion_rim_automute(codec); |
| 3238 | } |
| 3239 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3240 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3241 | { |
| 3242 | struct alc_spec *spec = codec->spec; |
| 3243 | |
| 3244 | spec->autocfg.hp_pins[0] = 0x14; |
| 3245 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3246 | } |
| 3247 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3248 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3249 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3250 | { 0x0b, HDA_INPUT, 0 }, |
| 3251 | { 0x0b, HDA_INPUT, 1 }, |
| 3252 | { 0x0b, HDA_INPUT, 2 }, |
| 3253 | { 0x0b, HDA_INPUT, 3 }, |
| 3254 | { 0x0b, HDA_INPUT, 4 }, |
| 3255 | { } /* end */ |
| 3256 | }; |
| 3257 | |
| 3258 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3259 | { 0x0b, HDA_INPUT, 1 }, |
| 3260 | { 0x0b, HDA_INPUT, 6 }, |
| 3261 | { 0x0b, HDA_INPUT, 7 }, |
| 3262 | { } /* end */ |
| 3263 | }; |
| 3264 | #endif |
| 3265 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3266 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3267 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3268 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3269 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3270 | static int alc_init(struct hda_codec *codec) |
| 3271 | { |
| 3272 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3273 | unsigned int i; |
| 3274 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3275 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3276 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3277 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3278 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3279 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3280 | |
| 3281 | if (spec->init_hook) |
| 3282 | spec->init_hook(codec); |
| 3283 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3284 | return 0; |
| 3285 | } |
| 3286 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3287 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3288 | { |
| 3289 | struct alc_spec *spec = codec->spec; |
| 3290 | |
| 3291 | if (spec->unsol_event) |
| 3292 | spec->unsol_event(codec, res); |
| 3293 | } |
| 3294 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3295 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3296 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3297 | { |
| 3298 | struct alc_spec *spec = codec->spec; |
| 3299 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3300 | } |
| 3301 | #endif |
| 3302 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3303 | /* |
| 3304 | * Analog playback callbacks |
| 3305 | */ |
| 3306 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3307 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3308 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3309 | { |
| 3310 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3311 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3312 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3313 | } |
| 3314 | |
| 3315 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3316 | struct hda_codec *codec, |
| 3317 | unsigned int stream_tag, |
| 3318 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3319 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3320 | { |
| 3321 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3322 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3323 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3324 | } |
| 3325 | |
| 3326 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3327 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3328 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3329 | { |
| 3330 | struct alc_spec *spec = codec->spec; |
| 3331 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3332 | } |
| 3333 | |
| 3334 | /* |
| 3335 | * Digital out |
| 3336 | */ |
| 3337 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3338 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3339 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3340 | { |
| 3341 | struct alc_spec *spec = codec->spec; |
| 3342 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3343 | } |
| 3344 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3345 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3346 | struct hda_codec *codec, |
| 3347 | unsigned int stream_tag, |
| 3348 | unsigned int format, |
| 3349 | struct snd_pcm_substream *substream) |
| 3350 | { |
| 3351 | struct alc_spec *spec = codec->spec; |
| 3352 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3353 | stream_tag, format, substream); |
| 3354 | } |
| 3355 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3356 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3357 | struct hda_codec *codec, |
| 3358 | struct snd_pcm_substream *substream) |
| 3359 | { |
| 3360 | struct alc_spec *spec = codec->spec; |
| 3361 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3362 | } |
| 3363 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3364 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3365 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3366 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3367 | { |
| 3368 | struct alc_spec *spec = codec->spec; |
| 3369 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3370 | } |
| 3371 | |
| 3372 | /* |
| 3373 | * Analog capture |
| 3374 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3375 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3376 | struct hda_codec *codec, |
| 3377 | unsigned int stream_tag, |
| 3378 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3379 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3380 | { |
| 3381 | struct alc_spec *spec = codec->spec; |
| 3382 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3383 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3384 | stream_tag, 0, format); |
| 3385 | return 0; |
| 3386 | } |
| 3387 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3388 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3389 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3390 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3391 | { |
| 3392 | struct alc_spec *spec = codec->spec; |
| 3393 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3394 | snd_hda_codec_cleanup_stream(codec, |
| 3395 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3396 | return 0; |
| 3397 | } |
| 3398 | |
| 3399 | |
| 3400 | /* |
| 3401 | */ |
| 3402 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3403 | .substreams = 1, |
| 3404 | .channels_min = 2, |
| 3405 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3406 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3407 | .ops = { |
| 3408 | .open = alc880_playback_pcm_open, |
| 3409 | .prepare = alc880_playback_pcm_prepare, |
| 3410 | .cleanup = alc880_playback_pcm_cleanup |
| 3411 | }, |
| 3412 | }; |
| 3413 | |
| 3414 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3415 | .substreams = 1, |
| 3416 | .channels_min = 2, |
| 3417 | .channels_max = 2, |
| 3418 | /* NID is set in alc_build_pcms */ |
| 3419 | }; |
| 3420 | |
| 3421 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3422 | .substreams = 1, |
| 3423 | .channels_min = 2, |
| 3424 | .channels_max = 2, |
| 3425 | /* NID is set in alc_build_pcms */ |
| 3426 | }; |
| 3427 | |
| 3428 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3429 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3430 | .channels_min = 2, |
| 3431 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3432 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3433 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3434 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3435 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3436 | }, |
| 3437 | }; |
| 3438 | |
| 3439 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3440 | .substreams = 1, |
| 3441 | .channels_min = 2, |
| 3442 | .channels_max = 2, |
| 3443 | /* NID is set in alc_build_pcms */ |
| 3444 | .ops = { |
| 3445 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3446 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3447 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3448 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3449 | }, |
| 3450 | }; |
| 3451 | |
| 3452 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3453 | .substreams = 1, |
| 3454 | .channels_min = 2, |
| 3455 | .channels_max = 2, |
| 3456 | /* NID is set in alc_build_pcms */ |
| 3457 | }; |
| 3458 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3459 | /* 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] | 3460 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3461 | .substreams = 0, |
| 3462 | .channels_min = 0, |
| 3463 | .channels_max = 0, |
| 3464 | }; |
| 3465 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3466 | static int alc_build_pcms(struct hda_codec *codec) |
| 3467 | { |
| 3468 | struct alc_spec *spec = codec->spec; |
| 3469 | struct hda_pcm *info = spec->pcm_rec; |
| 3470 | int i; |
| 3471 | |
| 3472 | codec->num_pcms = 1; |
| 3473 | codec->pcm_info = info; |
| 3474 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3475 | if (spec->no_analog) |
| 3476 | goto skip_analog; |
| 3477 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3478 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3479 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3480 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3481 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3482 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3483 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3484 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3485 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3486 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3487 | } |
| 3488 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3489 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3490 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3491 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3492 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3493 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3494 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3495 | if (spec->channel_mode) { |
| 3496 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3497 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3498 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3499 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3500 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3501 | } |
| 3502 | } |
| 3503 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3504 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3505 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3506 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3507 | snprintf(spec->stream_name_digital, |
| 3508 | sizeof(spec->stream_name_digital), |
| 3509 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3510 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3511 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3512 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3513 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3514 | if (spec->dig_out_type) |
| 3515 | info->pcm_type = spec->dig_out_type; |
| 3516 | else |
| 3517 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3518 | if (spec->multiout.dig_out_nid && |
| 3519 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3520 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3521 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3522 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3523 | if (spec->dig_in_nid && |
| 3524 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3525 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3526 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3527 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3528 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3529 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3530 | } |
| 3531 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3532 | if (spec->no_analog) |
| 3533 | return 0; |
| 3534 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3535 | /* If the use of more than one ADC is requested for the current |
| 3536 | * model, configure a second analog capture-only PCM. |
| 3537 | */ |
| 3538 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3539 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3540 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3541 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3542 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3543 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3544 | if (spec->alt_dac_nid) { |
| 3545 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3546 | *spec->stream_analog_alt_playback; |
| 3547 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3548 | spec->alt_dac_nid; |
| 3549 | } else { |
| 3550 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3551 | alc_pcm_null_stream; |
| 3552 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3553 | } |
| 3554 | if (spec->num_adc_nids > 1) { |
| 3555 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3556 | *spec->stream_analog_alt_capture; |
| 3557 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3558 | spec->adc_nids[1]; |
| 3559 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3560 | spec->num_adc_nids - 1; |
| 3561 | } else { |
| 3562 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3563 | alc_pcm_null_stream; |
| 3564 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3565 | } |
| 3566 | } |
| 3567 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3568 | return 0; |
| 3569 | } |
| 3570 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3571 | static void alc_free_kctls(struct hda_codec *codec) |
| 3572 | { |
| 3573 | struct alc_spec *spec = codec->spec; |
| 3574 | |
| 3575 | if (spec->kctls.list) { |
| 3576 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3577 | int i; |
| 3578 | for (i = 0; i < spec->kctls.used; i++) |
| 3579 | kfree(kctl[i].name); |
| 3580 | } |
| 3581 | snd_array_free(&spec->kctls); |
| 3582 | } |
| 3583 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3584 | static void alc_free(struct hda_codec *codec) |
| 3585 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3586 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3587 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3588 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3589 | return; |
| 3590 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3591 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3592 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3593 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3594 | } |
| 3595 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3596 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3597 | static int alc_resume(struct hda_codec *codec) |
| 3598 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3599 | codec->patch_ops.init(codec); |
| 3600 | snd_hda_codec_resume_amp(codec); |
| 3601 | snd_hda_codec_resume_cache(codec); |
| 3602 | return 0; |
| 3603 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3604 | #endif |
| 3605 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3606 | /* |
| 3607 | */ |
| 3608 | static struct hda_codec_ops alc_patch_ops = { |
| 3609 | .build_controls = alc_build_controls, |
| 3610 | .build_pcms = alc_build_pcms, |
| 3611 | .init = alc_init, |
| 3612 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3613 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3614 | #ifdef SND_HDA_NEEDS_RESUME |
| 3615 | .resume = alc_resume, |
| 3616 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3617 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3618 | .check_power_status = alc_check_power_status, |
| 3619 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3620 | }; |
| 3621 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3622 | |
| 3623 | /* |
| 3624 | * Test configuration for debugging |
| 3625 | * |
| 3626 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3627 | * enum controls. |
| 3628 | */ |
| 3629 | #ifdef CONFIG_SND_DEBUG |
| 3630 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3631 | 0x02, 0x03, 0x04, 0x05 |
| 3632 | }; |
| 3633 | |
| 3634 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3635 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3636 | .items = { |
| 3637 | { "In-1", 0x0 }, |
| 3638 | { "In-2", 0x1 }, |
| 3639 | { "In-3", 0x2 }, |
| 3640 | { "In-4", 0x3 }, |
| 3641 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3642 | { "Front", 0x5 }, |
| 3643 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3644 | }, |
| 3645 | }; |
| 3646 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3647 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3648 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3649 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3650 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3651 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3652 | }; |
| 3653 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3654 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3655 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3656 | { |
| 3657 | static char *texts[] = { |
| 3658 | "N/A", "Line Out", "HP Out", |
| 3659 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3660 | }; |
| 3661 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3662 | uinfo->count = 1; |
| 3663 | uinfo->value.enumerated.items = 8; |
| 3664 | if (uinfo->value.enumerated.item >= 8) |
| 3665 | uinfo->value.enumerated.item = 7; |
| 3666 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3667 | return 0; |
| 3668 | } |
| 3669 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3670 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3671 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3672 | { |
| 3673 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3674 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3675 | unsigned int pin_ctl, item = 0; |
| 3676 | |
| 3677 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3678 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3679 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3680 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3681 | item = 2; |
| 3682 | else |
| 3683 | item = 1; |
| 3684 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3685 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3686 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3687 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3688 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3689 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3690 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3691 | } |
| 3692 | } |
| 3693 | ucontrol->value.enumerated.item[0] = item; |
| 3694 | return 0; |
| 3695 | } |
| 3696 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3697 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3698 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3699 | { |
| 3700 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3701 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3702 | static unsigned int ctls[] = { |
| 3703 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3704 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3705 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3706 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3707 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3708 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3709 | }; |
| 3710 | unsigned int old_ctl, new_ctl; |
| 3711 | |
| 3712 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3713 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3714 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3715 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3716 | int val; |
| 3717 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3718 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3719 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3720 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3721 | HDA_AMP_MUTE : 0; |
| 3722 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3723 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3724 | return 1; |
| 3725 | } |
| 3726 | return 0; |
| 3727 | } |
| 3728 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3729 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3730 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3731 | { |
| 3732 | static char *texts[] = { |
| 3733 | "Front", "Surround", "CLFE", "Side" |
| 3734 | }; |
| 3735 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3736 | uinfo->count = 1; |
| 3737 | uinfo->value.enumerated.items = 4; |
| 3738 | if (uinfo->value.enumerated.item >= 4) |
| 3739 | uinfo->value.enumerated.item = 3; |
| 3740 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3741 | return 0; |
| 3742 | } |
| 3743 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3744 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3745 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3746 | { |
| 3747 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3748 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3749 | unsigned int sel; |
| 3750 | |
| 3751 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3752 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3753 | return 0; |
| 3754 | } |
| 3755 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3756 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3757 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3758 | { |
| 3759 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3760 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3761 | unsigned int sel; |
| 3762 | |
| 3763 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3764 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3765 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3766 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3767 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3768 | return 1; |
| 3769 | } |
| 3770 | return 0; |
| 3771 | } |
| 3772 | |
| 3773 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3774 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3775 | .name = xname, \ |
| 3776 | .info = alc_test_pin_ctl_info, \ |
| 3777 | .get = alc_test_pin_ctl_get, \ |
| 3778 | .put = alc_test_pin_ctl_put, \ |
| 3779 | .private_value = nid \ |
| 3780 | } |
| 3781 | |
| 3782 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3783 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3784 | .name = xname, \ |
| 3785 | .info = alc_test_pin_src_info, \ |
| 3786 | .get = alc_test_pin_src_get, \ |
| 3787 | .put = alc_test_pin_src_put, \ |
| 3788 | .private_value = nid \ |
| 3789 | } |
| 3790 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3791 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3792 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3793 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3794 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3795 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3796 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3797 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3798 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3799 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3800 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3801 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3802 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3803 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3804 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3805 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3806 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3807 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3808 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3809 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3810 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3811 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3812 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3813 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3814 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3815 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3816 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3817 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3818 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3819 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3820 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3821 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3822 | { |
| 3823 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3824 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3825 | .info = alc_ch_mode_info, |
| 3826 | .get = alc_ch_mode_get, |
| 3827 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3828 | }, |
| 3829 | { } /* end */ |
| 3830 | }; |
| 3831 | |
| 3832 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3833 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3834 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3835 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3836 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3837 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3838 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3839 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3840 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3841 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3842 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3843 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3844 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3845 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3846 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3847 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3848 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3849 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3850 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3851 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3852 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3853 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3854 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3855 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3856 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3857 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3858 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3859 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3860 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3861 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3862 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3863 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3864 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3865 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3866 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3867 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3868 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3869 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3870 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3871 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3872 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3873 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3874 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3875 | /* Analog input/passthru */ |
| 3876 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3877 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3878 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3879 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3880 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3881 | { } |
| 3882 | }; |
| 3883 | #endif |
| 3884 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3885 | /* |
| 3886 | */ |
| 3887 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3888 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3889 | [ALC880_3ST] = "3stack", |
| 3890 | [ALC880_TCL_S700] = "tcl", |
| 3891 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3892 | [ALC880_CLEVO] = "clevo", |
| 3893 | [ALC880_5ST] = "5stack", |
| 3894 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3895 | [ALC880_W810] = "w810", |
| 3896 | [ALC880_Z71V] = "z71v", |
| 3897 | [ALC880_6ST] = "6stack", |
| 3898 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3899 | [ALC880_ASUS] = "asus", |
| 3900 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3901 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3902 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3903 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3904 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3905 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3906 | [ALC880_F1734] = "F1734", |
| 3907 | [ALC880_LG] = "lg", |
| 3908 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3909 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3910 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3911 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3912 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3913 | [ALC880_AUTO] = "auto", |
| 3914 | }; |
| 3915 | |
| 3916 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3917 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3918 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3919 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3920 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3921 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3922 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3923 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3924 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3925 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3926 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3927 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3928 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3929 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3930 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3931 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3932 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3933 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3934 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3935 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3936 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3937 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3938 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3939 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3940 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3941 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3942 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3943 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3944 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3945 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3946 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3947 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3948 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3949 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3950 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3951 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3952 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3953 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3954 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3955 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3956 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3957 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3958 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3959 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3960 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3961 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3962 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3963 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3964 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3965 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3966 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3967 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3968 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3969 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3970 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3971 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3972 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3973 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3974 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3975 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3976 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3977 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3978 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3979 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3980 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3981 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3982 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3983 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3984 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3985 | /* default Intel */ |
| 3986 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3987 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3988 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3989 | {} |
| 3990 | }; |
| 3991 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3992 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3993 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3994 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3995 | static struct alc_config_preset alc880_presets[] = { |
| 3996 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3997 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3998 | .init_verbs = { alc880_volume_init_verbs, |
| 3999 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4000 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4001 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4002 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4003 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4004 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4005 | .input_mux = &alc880_capture_source, |
| 4006 | }, |
| 4007 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4008 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4009 | .init_verbs = { alc880_volume_init_verbs, |
| 4010 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4011 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4012 | .dac_nids = alc880_dac_nids, |
| 4013 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4014 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4015 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4016 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4017 | .input_mux = &alc880_capture_source, |
| 4018 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4019 | [ALC880_TCL_S700] = { |
| 4020 | .mixers = { alc880_tcl_s700_mixer }, |
| 4021 | .init_verbs = { alc880_volume_init_verbs, |
| 4022 | alc880_pin_tcl_S700_init_verbs, |
| 4023 | alc880_gpio2_init_verbs }, |
| 4024 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4025 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4026 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4027 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4028 | .hp_nid = 0x03, |
| 4029 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4030 | .channel_mode = alc880_2_jack_modes, |
| 4031 | .input_mux = &alc880_capture_source, |
| 4032 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4033 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4034 | .mixers = { alc880_three_stack_mixer, |
| 4035 | alc880_five_stack_mixer}, |
| 4036 | .init_verbs = { alc880_volume_init_verbs, |
| 4037 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4038 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4039 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4040 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4041 | .channel_mode = alc880_fivestack_modes, |
| 4042 | .input_mux = &alc880_capture_source, |
| 4043 | }, |
| 4044 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4045 | .mixers = { alc880_three_stack_mixer, |
| 4046 | alc880_five_stack_mixer }, |
| 4047 | .init_verbs = { alc880_volume_init_verbs, |
| 4048 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4049 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4050 | .dac_nids = alc880_dac_nids, |
| 4051 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4052 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4053 | .channel_mode = alc880_fivestack_modes, |
| 4054 | .input_mux = &alc880_capture_source, |
| 4055 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4056 | [ALC880_6ST] = { |
| 4057 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4058 | .init_verbs = { alc880_volume_init_verbs, |
| 4059 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4060 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4061 | .dac_nids = alc880_6st_dac_nids, |
| 4062 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4063 | .channel_mode = alc880_sixstack_modes, |
| 4064 | .input_mux = &alc880_6stack_capture_source, |
| 4065 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4066 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4067 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4068 | .init_verbs = { alc880_volume_init_verbs, |
| 4069 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4070 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4071 | .dac_nids = alc880_6st_dac_nids, |
| 4072 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4073 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4074 | .channel_mode = alc880_sixstack_modes, |
| 4075 | .input_mux = &alc880_6stack_capture_source, |
| 4076 | }, |
| 4077 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4078 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4079 | .init_verbs = { alc880_volume_init_verbs, |
| 4080 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4081 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4082 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4083 | .dac_nids = alc880_w810_dac_nids, |
| 4084 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4085 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4086 | .channel_mode = alc880_w810_modes, |
| 4087 | .input_mux = &alc880_capture_source, |
| 4088 | }, |
| 4089 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4090 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4091 | .init_verbs = { alc880_volume_init_verbs, |
| 4092 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4093 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4094 | .dac_nids = alc880_z71v_dac_nids, |
| 4095 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4096 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4097 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4098 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4099 | .input_mux = &alc880_capture_source, |
| 4100 | }, |
| 4101 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4102 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4103 | .init_verbs = { alc880_volume_init_verbs, |
| 4104 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4105 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4106 | .dac_nids = alc880_f1734_dac_nids, |
| 4107 | .hp_nid = 0x02, |
| 4108 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4109 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4110 | .input_mux = &alc880_f1734_capture_source, |
| 4111 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4112 | .setup = alc880_uniwill_p53_setup, |
| 4113 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4114 | }, |
| 4115 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4116 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4117 | .init_verbs = { alc880_volume_init_verbs, |
| 4118 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4119 | alc880_gpio1_init_verbs }, |
| 4120 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4121 | .dac_nids = alc880_asus_dac_nids, |
| 4122 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4123 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4124 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4125 | .input_mux = &alc880_capture_source, |
| 4126 | }, |
| 4127 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4128 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4129 | .init_verbs = { alc880_volume_init_verbs, |
| 4130 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4131 | alc880_gpio1_init_verbs }, |
| 4132 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4133 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4134 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4135 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4136 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4137 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4138 | .input_mux = &alc880_capture_source, |
| 4139 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4140 | [ALC880_ASUS_DIG2] = { |
| 4141 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4142 | .init_verbs = { alc880_volume_init_verbs, |
| 4143 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4144 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4145 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4146 | .dac_nids = alc880_asus_dac_nids, |
| 4147 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4148 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4149 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4150 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4151 | .input_mux = &alc880_capture_source, |
| 4152 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4153 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4154 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4155 | .init_verbs = { alc880_volume_init_verbs, |
| 4156 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4157 | alc880_gpio1_init_verbs }, |
| 4158 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4159 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4160 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4161 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4162 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4163 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4164 | .input_mux = &alc880_capture_source, |
| 4165 | }, |
| 4166 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4167 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4168 | .init_verbs = { alc880_volume_init_verbs, |
| 4169 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4170 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4171 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4172 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4173 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4174 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4175 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4176 | .input_mux = &alc880_capture_source, |
| 4177 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4178 | [ALC880_UNIWILL] = { |
| 4179 | .mixers = { alc880_uniwill_mixer }, |
| 4180 | .init_verbs = { alc880_volume_init_verbs, |
| 4181 | alc880_uniwill_init_verbs }, |
| 4182 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4183 | .dac_nids = alc880_asus_dac_nids, |
| 4184 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4185 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4186 | .channel_mode = alc880_threestack_modes, |
| 4187 | .need_dac_fix = 1, |
| 4188 | .input_mux = &alc880_capture_source, |
| 4189 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4190 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4191 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4192 | }, |
| 4193 | [ALC880_UNIWILL_P53] = { |
| 4194 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4195 | .init_verbs = { alc880_volume_init_verbs, |
| 4196 | alc880_uniwill_p53_init_verbs }, |
| 4197 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4198 | .dac_nids = alc880_asus_dac_nids, |
| 4199 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4200 | .channel_mode = alc880_threestack_modes, |
| 4201 | .input_mux = &alc880_capture_source, |
| 4202 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4203 | .setup = alc880_uniwill_p53_setup, |
| 4204 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4205 | }, |
| 4206 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4207 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4208 | .init_verbs = { alc880_volume_init_verbs, |
| 4209 | alc880_uniwill_p53_init_verbs, |
| 4210 | alc880_beep_init_verbs }, |
| 4211 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4212 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4213 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4214 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4215 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4216 | .input_mux = &alc880_capture_source, |
| 4217 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4218 | .setup = alc880_uniwill_p53_setup, |
| 4219 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4220 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4221 | [ALC880_CLEVO] = { |
| 4222 | .mixers = { alc880_three_stack_mixer }, |
| 4223 | .init_verbs = { alc880_volume_init_verbs, |
| 4224 | alc880_pin_clevo_init_verbs }, |
| 4225 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4226 | .dac_nids = alc880_dac_nids, |
| 4227 | .hp_nid = 0x03, |
| 4228 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4229 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4230 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4231 | .input_mux = &alc880_capture_source, |
| 4232 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4233 | [ALC880_LG] = { |
| 4234 | .mixers = { alc880_lg_mixer }, |
| 4235 | .init_verbs = { alc880_volume_init_verbs, |
| 4236 | alc880_lg_init_verbs }, |
| 4237 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4238 | .dac_nids = alc880_lg_dac_nids, |
| 4239 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4240 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4241 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4242 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4243 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4244 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4245 | .setup = alc880_lg_setup, |
| 4246 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4247 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4248 | .loopbacks = alc880_lg_loopbacks, |
| 4249 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4250 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4251 | [ALC880_LG_LW] = { |
| 4252 | .mixers = { alc880_lg_lw_mixer }, |
| 4253 | .init_verbs = { alc880_volume_init_verbs, |
| 4254 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4255 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4256 | .dac_nids = alc880_dac_nids, |
| 4257 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4258 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4259 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4260 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4261 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4262 | .setup = alc880_lg_lw_setup, |
| 4263 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4264 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4265 | [ALC880_MEDION_RIM] = { |
| 4266 | .mixers = { alc880_medion_rim_mixer }, |
| 4267 | .init_verbs = { alc880_volume_init_verbs, |
| 4268 | alc880_medion_rim_init_verbs, |
| 4269 | alc_gpio2_init_verbs }, |
| 4270 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4271 | .dac_nids = alc880_dac_nids, |
| 4272 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4273 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4274 | .channel_mode = alc880_2_jack_modes, |
| 4275 | .input_mux = &alc880_medion_rim_capture_source, |
| 4276 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4277 | .setup = alc880_medion_rim_setup, |
| 4278 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4279 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4280 | #ifdef CONFIG_SND_DEBUG |
| 4281 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4282 | .mixers = { alc880_test_mixer }, |
| 4283 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4284 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4285 | .dac_nids = alc880_test_dac_nids, |
| 4286 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4287 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4288 | .channel_mode = alc880_test_modes, |
| 4289 | .input_mux = &alc880_test_capture_source, |
| 4290 | }, |
| 4291 | #endif |
| 4292 | }; |
| 4293 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4294 | /* |
| 4295 | * Automatic parse of I/O pins from the BIOS configuration |
| 4296 | */ |
| 4297 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4298 | enum { |
| 4299 | ALC_CTL_WIDGET_VOL, |
| 4300 | ALC_CTL_WIDGET_MUTE, |
| 4301 | ALC_CTL_BIND_MUTE, |
| 4302 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4303 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4304 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4305 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4306 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4307 | }; |
| 4308 | |
| 4309 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4310 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4311 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4312 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4313 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4314 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4315 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4316 | knew = snd_array_new(&spec->kctls); |
| 4317 | if (!knew) |
| 4318 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4319 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4320 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4321 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4322 | return -ENOMEM; |
| 4323 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4324 | return 0; |
| 4325 | } |
| 4326 | |
| 4327 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4328 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4329 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4330 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4331 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4332 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4333 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4334 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4335 | #define ALC880_PIN_CD_NID 0x1c |
| 4336 | |
| 4337 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4338 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4339 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4340 | { |
| 4341 | hda_nid_t nid; |
| 4342 | int assigned[4]; |
| 4343 | int i, j; |
| 4344 | |
| 4345 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4346 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4347 | |
| 4348 | /* check the pins hardwired to audio widget */ |
| 4349 | for (i = 0; i < cfg->line_outs; i++) { |
| 4350 | nid = cfg->line_out_pins[i]; |
| 4351 | if (alc880_is_fixed_pin(nid)) { |
| 4352 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4353 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4354 | assigned[idx] = 1; |
| 4355 | } |
| 4356 | } |
| 4357 | /* left pins can be connect to any audio widget */ |
| 4358 | for (i = 0; i < cfg->line_outs; i++) { |
| 4359 | nid = cfg->line_out_pins[i]; |
| 4360 | if (alc880_is_fixed_pin(nid)) |
| 4361 | continue; |
| 4362 | /* search for an empty channel */ |
| 4363 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4364 | if (!assigned[j]) { |
| 4365 | spec->multiout.dac_nids[i] = |
| 4366 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4367 | assigned[j] = 1; |
| 4368 | break; |
| 4369 | } |
| 4370 | } |
| 4371 | } |
| 4372 | spec->multiout.num_dacs = cfg->line_outs; |
| 4373 | return 0; |
| 4374 | } |
| 4375 | |
| 4376 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4377 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4378 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4379 | { |
| 4380 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4381 | static const char *chname[4] = { |
| 4382 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4383 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4384 | hda_nid_t nid; |
| 4385 | int i, err; |
| 4386 | |
| 4387 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4388 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4389 | continue; |
| 4390 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4391 | if (i == 2) { |
| 4392 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4393 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4394 | "Center Playback Volume", |
| 4395 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4396 | HDA_OUTPUT)); |
| 4397 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4398 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4399 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4400 | "LFE Playback Volume", |
| 4401 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4402 | HDA_OUTPUT)); |
| 4403 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4404 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4405 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4406 | "Center Playback Switch", |
| 4407 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4408 | HDA_INPUT)); |
| 4409 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4410 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4411 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4412 | "LFE Playback Switch", |
| 4413 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4414 | HDA_INPUT)); |
| 4415 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4416 | return err; |
| 4417 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4418 | const char *pfx; |
| 4419 | if (cfg->line_outs == 1 && |
| 4420 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4421 | pfx = "Speaker"; |
| 4422 | else |
| 4423 | pfx = chname[i]; |
| 4424 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4425 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4426 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4427 | HDA_OUTPUT)); |
| 4428 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4429 | return err; |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4430 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4431 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4432 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4433 | HDA_INPUT)); |
| 4434 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4435 | return err; |
| 4436 | } |
| 4437 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4438 | return 0; |
| 4439 | } |
| 4440 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4441 | /* add playback controls for speaker and HP outputs */ |
| 4442 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4443 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4444 | { |
| 4445 | hda_nid_t nid; |
| 4446 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4447 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4448 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4449 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4450 | return 0; |
| 4451 | |
| 4452 | if (alc880_is_fixed_pin(pin)) { |
| 4453 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4454 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4455 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4456 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4457 | else |
| 4458 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4459 | /* control HP volume/switch on the output mixer amp */ |
| 4460 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4461 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4462 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4463 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4464 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4465 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4466 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4467 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4468 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4469 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4470 | return err; |
| 4471 | } else if (alc880_is_multi_pin(pin)) { |
| 4472 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4473 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4474 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4475 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4476 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4477 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4478 | return err; |
| 4479 | } |
| 4480 | return 0; |
| 4481 | } |
| 4482 | |
| 4483 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4484 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4485 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4486 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4487 | { |
| 4488 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4489 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4490 | |
| 4491 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4492 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4493 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4494 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4495 | return err; |
| 4496 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4497 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4498 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4499 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4500 | return err; |
| 4501 | return 0; |
| 4502 | } |
| 4503 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4504 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4505 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4506 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4507 | return (pincap & AC_PINCAP_IN) != 0; |
| 4508 | } |
| 4509 | |
| 4510 | /* create playback/capture controls for input pins */ |
| 4511 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4512 | const struct auto_pin_cfg *cfg, |
| 4513 | hda_nid_t mixer, |
| 4514 | hda_nid_t cap1, hda_nid_t cap2) |
| 4515 | { |
| 4516 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4517 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4518 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4519 | |
| 4520 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4521 | hda_nid_t pin; |
| 4522 | |
| 4523 | pin = cfg->input_pins[i]; |
| 4524 | if (!alc_is_input_pin(codec, pin)) |
| 4525 | continue; |
| 4526 | |
| 4527 | if (mixer) { |
| 4528 | idx = get_connection_index(codec, mixer, pin); |
| 4529 | if (idx >= 0) { |
| 4530 | err = new_analog_input(spec, pin, |
| 4531 | auto_pin_cfg_labels[i], |
| 4532 | idx, mixer); |
| 4533 | if (err < 0) |
| 4534 | return err; |
| 4535 | } |
| 4536 | } |
| 4537 | |
| 4538 | if (!cap1) |
| 4539 | continue; |
| 4540 | idx = get_connection_index(codec, cap1, pin); |
| 4541 | if (idx < 0 && cap2) |
| 4542 | idx = get_connection_index(codec, cap2, pin); |
| 4543 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4544 | imux->items[imux->num_items].label = |
| 4545 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4546 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4547 | imux->num_items++; |
| 4548 | } |
| 4549 | } |
| 4550 | return 0; |
| 4551 | } |
| 4552 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4553 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4554 | const struct auto_pin_cfg *cfg) |
| 4555 | { |
| 4556 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4557 | } |
| 4558 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4559 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4560 | unsigned int pin_type) |
| 4561 | { |
| 4562 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4563 | pin_type); |
| 4564 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4565 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4566 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4567 | } |
| 4568 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4569 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4570 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4571 | int dac_idx) |
| 4572 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4573 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4574 | /* need the manual connection? */ |
| 4575 | if (alc880_is_multi_pin(nid)) { |
| 4576 | struct alc_spec *spec = codec->spec; |
| 4577 | int idx = alc880_multi_pin_idx(nid); |
| 4578 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4579 | AC_VERB_SET_CONNECT_SEL, |
| 4580 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4581 | } |
| 4582 | } |
| 4583 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4584 | static int get_pin_type(int line_out_type) |
| 4585 | { |
| 4586 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4587 | return PIN_HP; |
| 4588 | else |
| 4589 | return PIN_OUT; |
| 4590 | } |
| 4591 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4592 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4593 | { |
| 4594 | struct alc_spec *spec = codec->spec; |
| 4595 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4596 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4597 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4598 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4599 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4600 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4601 | } |
| 4602 | } |
| 4603 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4604 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4605 | { |
| 4606 | struct alc_spec *spec = codec->spec; |
| 4607 | hda_nid_t pin; |
| 4608 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4609 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4610 | if (pin) /* connect to front */ |
| 4611 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4612 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4613 | if (pin) /* connect to front */ |
| 4614 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4615 | } |
| 4616 | |
| 4617 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4618 | { |
| 4619 | struct alc_spec *spec = codec->spec; |
| 4620 | int i; |
| 4621 | |
| 4622 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4623 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4624 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4625 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4626 | if (nid != ALC880_PIN_CD_NID && |
| 4627 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4628 | snd_hda_codec_write(codec, nid, 0, |
| 4629 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4630 | AMP_OUT_MUTE); |
| 4631 | } |
| 4632 | } |
| 4633 | } |
| 4634 | |
| 4635 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4636 | /* return 1 if successful, 0 if the proper config is not found, |
| 4637 | * or a negative error code |
| 4638 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4639 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4640 | { |
| 4641 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4642 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4643 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4644 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4645 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4646 | alc880_ignore); |
| 4647 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4648 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4649 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4650 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4651 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4652 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4653 | if (err < 0) |
| 4654 | return err; |
| 4655 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4656 | if (err < 0) |
| 4657 | return err; |
| 4658 | err = alc880_auto_create_extra_out(spec, |
| 4659 | spec->autocfg.speaker_pins[0], |
| 4660 | "Speaker"); |
| 4661 | if (err < 0) |
| 4662 | return err; |
| 4663 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4664 | "Headphone"); |
| 4665 | if (err < 0) |
| 4666 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4667 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4668 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4669 | return err; |
| 4670 | |
| 4671 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4672 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4673 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4674 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4675 | hda_nid_t dig_nid; |
| 4676 | err = snd_hda_get_connections(codec, |
| 4677 | spec->autocfg.dig_out_pins[i], |
| 4678 | &dig_nid, 1); |
| 4679 | if (err < 0) |
| 4680 | continue; |
| 4681 | if (!i) |
| 4682 | spec->multiout.dig_out_nid = dig_nid; |
| 4683 | else { |
| 4684 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4685 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4686 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4687 | break; |
| 4688 | } |
| 4689 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4690 | if (spec->autocfg.dig_in_pin) |
| 4691 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4692 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4693 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4694 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4695 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4696 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4697 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4698 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4699 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4700 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4701 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4702 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4703 | return 1; |
| 4704 | } |
| 4705 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4706 | /* additional initialization for auto-configuration model */ |
| 4707 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4708 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4709 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4710 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4711 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4712 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4713 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4714 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4715 | } |
| 4716 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4717 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 4718 | * one of two digital mic pins, e.g. on ALC272 |
| 4719 | */ |
| 4720 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4721 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4722 | struct alc_spec *spec = codec->spec; |
| 4723 | int i; |
| 4724 | |
| 4725 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4726 | hda_nid_t cap = spec->capsrc_nids ? |
| 4727 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4728 | int iidx, eidx; |
| 4729 | |
| 4730 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 4731 | if (iidx < 0) |
| 4732 | continue; |
| 4733 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 4734 | if (eidx < 0) |
| 4735 | continue; |
| 4736 | spec->int_mic.mux_idx = iidx; |
| 4737 | spec->ext_mic.mux_idx = eidx; |
| 4738 | if (spec->capsrc_nids) |
| 4739 | spec->capsrc_nids += i; |
| 4740 | spec->adc_nids += i; |
| 4741 | spec->num_adc_nids = 1; |
| 4742 | return; |
| 4743 | } |
| 4744 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 4745 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 4746 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 4747 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 4748 | } |
| 4749 | |
| 4750 | static void set_capture_mixer(struct hda_codec *codec) |
| 4751 | { |
| 4752 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4753 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4754 | { alc_capture_mixer_nosrc1, |
| 4755 | alc_capture_mixer_nosrc2, |
| 4756 | alc_capture_mixer_nosrc3 }, |
| 4757 | { alc_capture_mixer1, |
| 4758 | alc_capture_mixer2, |
| 4759 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4760 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4761 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4762 | int mux; |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4763 | if (spec->auto_mic) { |
| 4764 | mux = 0; |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4765 | fixup_automic_adc(codec); |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4766 | } else if (spec->input_mux && spec->input_mux->num_items > 1) |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4767 | mux = 1; |
| 4768 | else |
| 4769 | mux = 0; |
| 4770 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4771 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4772 | } |
| 4773 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4774 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4775 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4776 | |
| 4777 | /* |
| 4778 | * OK, here we have finally the patch for ALC880 |
| 4779 | */ |
| 4780 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4781 | static int patch_alc880(struct hda_codec *codec) |
| 4782 | { |
| 4783 | struct alc_spec *spec; |
| 4784 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4785 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4786 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4787 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4788 | if (spec == NULL) |
| 4789 | return -ENOMEM; |
| 4790 | |
| 4791 | codec->spec = spec; |
| 4792 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4793 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4794 | alc880_models, |
| 4795 | alc880_cfg_tbl); |
| 4796 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 4797 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 4798 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4799 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4800 | } |
| 4801 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4802 | if (board_config == ALC880_AUTO) { |
| 4803 | /* automatic parse from the BIOS config */ |
| 4804 | err = alc880_parse_auto_config(codec); |
| 4805 | if (err < 0) { |
| 4806 | alc_free(codec); |
| 4807 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4808 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4809 | printk(KERN_INFO |
| 4810 | "hda_codec: Cannot set up configuration " |
| 4811 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4812 | board_config = ALC880_3ST; |
| 4813 | } |
| 4814 | } |
| 4815 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4816 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4817 | if (err < 0) { |
| 4818 | alc_free(codec); |
| 4819 | return err; |
| 4820 | } |
| 4821 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4822 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 4823 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4824 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4825 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4826 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4827 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4828 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4829 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4830 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4831 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4832 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4833 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4834 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4835 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 4836 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4837 | if (wcap != AC_WID_AUD_IN) { |
| 4838 | spec->adc_nids = alc880_adc_nids_alt; |
| 4839 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4840 | } else { |
| 4841 | spec->adc_nids = alc880_adc_nids; |
| 4842 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4843 | } |
| 4844 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4845 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4846 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4847 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4848 | spec->vmaster_nid = 0x0c; |
| 4849 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4850 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4851 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4852 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4853 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4854 | if (!spec->loopback.amplist) |
| 4855 | spec->loopback.amplist = alc880_loopbacks; |
| 4856 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4857 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4858 | |
| 4859 | return 0; |
| 4860 | } |
| 4861 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4862 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4863 | /* |
| 4864 | * ALC260 support |
| 4865 | */ |
| 4866 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4867 | static hda_nid_t alc260_dac_nids[1] = { |
| 4868 | /* front */ |
| 4869 | 0x02, |
| 4870 | }; |
| 4871 | |
| 4872 | static hda_nid_t alc260_adc_nids[1] = { |
| 4873 | /* ADC0 */ |
| 4874 | 0x04, |
| 4875 | }; |
| 4876 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4877 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4878 | /* ADC1 */ |
| 4879 | 0x05, |
| 4880 | }; |
| 4881 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4882 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4883 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4884 | */ |
| 4885 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4886 | /* ADC0, ADC1 */ |
| 4887 | 0x04, 0x05 |
| 4888 | }; |
| 4889 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4890 | #define ALC260_DIGOUT_NID 0x03 |
| 4891 | #define ALC260_DIGIN_NID 0x06 |
| 4892 | |
| 4893 | static struct hda_input_mux alc260_capture_source = { |
| 4894 | .num_items = 4, |
| 4895 | .items = { |
| 4896 | { "Mic", 0x0 }, |
| 4897 | { "Front Mic", 0x1 }, |
| 4898 | { "Line", 0x2 }, |
| 4899 | { "CD", 0x4 }, |
| 4900 | }, |
| 4901 | }; |
| 4902 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4903 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4904 | * headphone jack and the internal CD lines since these are the only pins at |
| 4905 | * which audio can appear. For flexibility, also allow the option of |
| 4906 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4907 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4908 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4909 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4910 | { |
| 4911 | .num_items = 3, |
| 4912 | .items = { |
| 4913 | { "Mic/Line", 0x0 }, |
| 4914 | { "CD", 0x4 }, |
| 4915 | { "Headphone", 0x2 }, |
| 4916 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4917 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4918 | { |
| 4919 | .num_items = 4, |
| 4920 | .items = { |
| 4921 | { "Mic/Line", 0x0 }, |
| 4922 | { "CD", 0x4 }, |
| 4923 | { "Headphone", 0x2 }, |
| 4924 | { "Mixer", 0x5 }, |
| 4925 | }, |
| 4926 | }, |
| 4927 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4928 | }; |
| 4929 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4930 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4931 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4932 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4933 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4934 | { |
| 4935 | .num_items = 4, |
| 4936 | .items = { |
| 4937 | { "Mic", 0x0 }, |
| 4938 | { "Line", 0x2 }, |
| 4939 | { "CD", 0x4 }, |
| 4940 | { "Headphone", 0x5 }, |
| 4941 | }, |
| 4942 | }, |
| 4943 | { |
| 4944 | .num_items = 5, |
| 4945 | .items = { |
| 4946 | { "Mic", 0x0 }, |
| 4947 | { "Line", 0x2 }, |
| 4948 | { "CD", 0x4 }, |
| 4949 | { "Headphone", 0x6 }, |
| 4950 | { "Mixer", 0x5 }, |
| 4951 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4952 | }, |
| 4953 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4954 | |
| 4955 | /* Maxdata Favorit 100XS */ |
| 4956 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4957 | { |
| 4958 | .num_items = 2, |
| 4959 | .items = { |
| 4960 | { "Line/Mic", 0x0 }, |
| 4961 | { "CD", 0x4 }, |
| 4962 | }, |
| 4963 | }, |
| 4964 | { |
| 4965 | .num_items = 3, |
| 4966 | .items = { |
| 4967 | { "Line/Mic", 0x0 }, |
| 4968 | { "CD", 0x4 }, |
| 4969 | { "Mixer", 0x5 }, |
| 4970 | }, |
| 4971 | }, |
| 4972 | }; |
| 4973 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4974 | /* |
| 4975 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4976 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4977 | * element which allows changing the channel mode, so the verb list is |
| 4978 | * never used. |
| 4979 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4980 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4981 | { 2, NULL }, |
| 4982 | }; |
| 4983 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4984 | |
| 4985 | /* Mixer combinations |
| 4986 | * |
| 4987 | * basic: base_output + input + pc_beep + capture |
| 4988 | * HP: base_output + input + capture_alt |
| 4989 | * HP_3013: hp_3013 + input + capture |
| 4990 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4991 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4992 | */ |
| 4993 | |
| 4994 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4995 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4996 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4997 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4998 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4999 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5000 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5001 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5002 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5003 | |
| 5004 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5005 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5006 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5007 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5008 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5009 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5010 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5011 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5012 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5013 | { } /* end */ |
| 5014 | }; |
| 5015 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5016 | /* update HP, line and mono out pins according to the master switch */ |
| 5017 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5018 | hda_nid_t hp, hda_nid_t line, |
| 5019 | hda_nid_t mono) |
| 5020 | { |
| 5021 | struct alc_spec *spec = codec->spec; |
| 5022 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5023 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5024 | 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] | 5025 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5026 | 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] | 5027 | val); |
| 5028 | /* mono (speaker) depending on the HP jack sense */ |
| 5029 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5030 | 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] | 5031 | val); |
| 5032 | } |
| 5033 | |
| 5034 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5035 | struct snd_ctl_elem_value *ucontrol) |
| 5036 | { |
| 5037 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5038 | struct alc_spec *spec = codec->spec; |
| 5039 | *ucontrol->value.integer.value = spec->master_sw; |
| 5040 | return 0; |
| 5041 | } |
| 5042 | |
| 5043 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5044 | struct snd_ctl_elem_value *ucontrol) |
| 5045 | { |
| 5046 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5047 | struct alc_spec *spec = codec->spec; |
| 5048 | int val = !!*ucontrol->value.integer.value; |
| 5049 | hda_nid_t hp, line, mono; |
| 5050 | |
| 5051 | if (val == spec->master_sw) |
| 5052 | return 0; |
| 5053 | spec->master_sw = val; |
| 5054 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5055 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5056 | mono = kcontrol->private_value & 0xff; |
| 5057 | alc260_hp_master_update(codec, hp, line, mono); |
| 5058 | return 1; |
| 5059 | } |
| 5060 | |
| 5061 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5062 | { |
| 5063 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5064 | .name = "Master Playback Switch", |
| 5065 | .info = snd_ctl_boolean_mono_info, |
| 5066 | .get = alc260_hp_master_sw_get, |
| 5067 | .put = alc260_hp_master_sw_put, |
| 5068 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5069 | }, |
| 5070 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5071 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5072 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5073 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5074 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5075 | HDA_OUTPUT), |
| 5076 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5077 | { } /* end */ |
| 5078 | }; |
| 5079 | |
| 5080 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5081 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5082 | {}, |
| 5083 | }; |
| 5084 | |
| 5085 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5086 | { |
| 5087 | struct alc_spec *spec = codec->spec; |
| 5088 | unsigned int present; |
| 5089 | |
| 5090 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 5091 | AC_VERB_GET_PIN_SENSE, 0); |
| 5092 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 5093 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5094 | } |
| 5095 | |
| 5096 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5097 | { |
| 5098 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5099 | alc260_hp_automute(codec); |
| 5100 | } |
| 5101 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5102 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5103 | { |
| 5104 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5105 | .name = "Master Playback Switch", |
| 5106 | .info = snd_ctl_boolean_mono_info, |
| 5107 | .get = alc260_hp_master_sw_get, |
| 5108 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5109 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5110 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5111 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5112 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5113 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5114 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5115 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5116 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5117 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5118 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5119 | { } /* end */ |
| 5120 | }; |
| 5121 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5122 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5123 | .ops = &snd_hda_bind_vol, |
| 5124 | .values = { |
| 5125 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5126 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5127 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5128 | 0 |
| 5129 | }, |
| 5130 | }; |
| 5131 | |
| 5132 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5133 | .ops = &snd_hda_bind_sw, |
| 5134 | .values = { |
| 5135 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5136 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5137 | 0 |
| 5138 | }, |
| 5139 | }; |
| 5140 | |
| 5141 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5142 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5143 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5144 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5145 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5146 | { } /* end */ |
| 5147 | }; |
| 5148 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5149 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5150 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5151 | {}, |
| 5152 | }; |
| 5153 | |
| 5154 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5155 | { |
| 5156 | struct alc_spec *spec = codec->spec; |
| 5157 | unsigned int present; |
| 5158 | |
| 5159 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5160 | AC_VERB_GET_PIN_SENSE, 0); |
| 5161 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5162 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5163 | } |
| 5164 | |
| 5165 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5166 | unsigned int res) |
| 5167 | { |
| 5168 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5169 | alc260_hp_3013_automute(codec); |
| 5170 | } |
| 5171 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5172 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5173 | { |
| 5174 | unsigned int present, bits; |
| 5175 | |
| 5176 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 5177 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 5178 | |
| 5179 | bits = present ? 0 : PIN_OUT; |
| 5180 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5181 | bits); |
| 5182 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5183 | bits); |
| 5184 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5185 | bits); |
| 5186 | } |
| 5187 | |
| 5188 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5189 | unsigned int res) |
| 5190 | { |
| 5191 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5192 | alc260_hp_3012_automute(codec); |
| 5193 | } |
| 5194 | |
| 5195 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5196 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5197 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5198 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5199 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5200 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5201 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5202 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5203 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5204 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5205 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5206 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5207 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5208 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5209 | { } /* end */ |
| 5210 | }; |
| 5211 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5212 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5213 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5214 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5215 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5216 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5217 | * revisions available in early 2006. Therefore for now allow the |
| 5218 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5219 | * that the lack of mic bias for this NID is intentional we could change the |
| 5220 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5221 | * |
| 5222 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5223 | * don't appear to make the mic bias available from the "line" jack, even |
| 5224 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5225 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5226 | * and the output jack. If this turns out to be the case for all such |
| 5227 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5228 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5229 | * |
| 5230 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5231 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5232 | * controls for such models. On models without a "mono speaker" the control |
| 5233 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5234 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5235 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5236 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5237 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5238 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5239 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5240 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5241 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5242 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5243 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5244 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5245 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5246 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5247 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5248 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5249 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5250 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5251 | { } /* end */ |
| 5252 | }; |
| 5253 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5254 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5255 | */ |
| 5256 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5257 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5258 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5259 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5260 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5261 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5262 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5263 | { } /* end */ |
| 5264 | }; |
| 5265 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5266 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5267 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5268 | */ |
| 5269 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5270 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5271 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5272 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5273 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5274 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5275 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5276 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5277 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5278 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5279 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5280 | { } /* end */ |
| 5281 | }; |
| 5282 | |
| 5283 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5284 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5285 | */ |
| 5286 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5287 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5288 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5289 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5290 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5291 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5292 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5293 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5294 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5295 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5296 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5297 | { } /* end */ |
| 5298 | }; |
| 5299 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5300 | /* |
| 5301 | * initialization verbs |
| 5302 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5303 | static struct hda_verb alc260_init_verbs[] = { |
| 5304 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5305 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5306 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5307 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5308 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5309 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5310 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5311 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5312 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5313 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5314 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5315 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5316 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5317 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5318 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5319 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5320 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5321 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5322 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5323 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5324 | /* set connection select to line in (default select for this ADC) */ |
| 5325 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5326 | /* mute capture amp left and right */ |
| 5327 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5328 | /* set connection select to line in (default select for this ADC) */ |
| 5329 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5330 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5331 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5332 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5333 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5334 | /* set vol=0 HP mixer amp left and right */ |
| 5335 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5336 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5337 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5338 | /* set vol=0 Mono mixer amp left and right */ |
| 5339 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5340 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5341 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5342 | /* unmute LINE-2 out pin */ |
| 5343 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5344 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5345 | * Line In 2 = 0x03 |
| 5346 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5347 | /* mute analog inputs */ |
| 5348 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5349 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5350 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5351 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5352 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5353 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5354 | /* mute Front out path */ |
| 5355 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5356 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5357 | /* mute Headphone out path */ |
| 5358 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5359 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5360 | /* mute Mono out path */ |
| 5361 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5362 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5363 | { } |
| 5364 | }; |
| 5365 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5366 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5367 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5368 | /* Headphone and output */ |
| 5369 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5370 | /* mono output */ |
| 5371 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5372 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5373 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5374 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5375 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5376 | /* Line In pin widget for input */ |
| 5377 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5378 | /* Line-2 pin widget for output */ |
| 5379 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5380 | /* CD pin widget for input */ |
| 5381 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5382 | /* unmute amp left and right */ |
| 5383 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5384 | /* set connection select to line in (default select for this ADC) */ |
| 5385 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5386 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5387 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5388 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5389 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5390 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5391 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5392 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5393 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5394 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5395 | * Line In 2 = 0x03 |
| 5396 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5397 | /* mute analog inputs */ |
| 5398 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5399 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5400 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5401 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5402 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5403 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5404 | /* Unmute Front out path */ |
| 5405 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5406 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5407 | /* Unmute Headphone out path */ |
| 5408 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5409 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5410 | /* Unmute Mono out path */ |
| 5411 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5412 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5413 | { } |
| 5414 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5415 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5416 | |
| 5417 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5418 | /* Line out and output */ |
| 5419 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5420 | /* mono output */ |
| 5421 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5422 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5423 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5424 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5425 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5426 | /* Line In pin widget for input */ |
| 5427 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5428 | /* Headphone pin widget for output */ |
| 5429 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5430 | /* CD pin widget for input */ |
| 5431 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5432 | /* unmute amp left and right */ |
| 5433 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5434 | /* set connection select to line in (default select for this ADC) */ |
| 5435 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5436 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5437 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5438 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5439 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5440 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5441 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5442 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5443 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5444 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5445 | * Line In 2 = 0x03 |
| 5446 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5447 | /* mute analog inputs */ |
| 5448 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5449 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5450 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5451 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5452 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5453 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5454 | /* Unmute Front out path */ |
| 5455 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5456 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5457 | /* Unmute Headphone out path */ |
| 5458 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5459 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5460 | /* Unmute Mono out path */ |
| 5461 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5462 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5463 | { } |
| 5464 | }; |
| 5465 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5466 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5467 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5468 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5469 | */ |
| 5470 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5471 | /* Disable all GPIOs */ |
| 5472 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5473 | /* Internal speaker is connected to headphone pin */ |
| 5474 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5475 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5476 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5477 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5478 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5479 | /* Ensure all other unused pins are disabled and muted. */ |
| 5480 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5481 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5482 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5483 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5484 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5485 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5486 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5487 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5488 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5489 | /* Disable digital (SPDIF) pins */ |
| 5490 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5491 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5492 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5493 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5494 | * when acting as an output. |
| 5495 | */ |
| 5496 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5497 | |
| 5498 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5499 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5500 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5501 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5502 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5503 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5504 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5505 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5506 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5507 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5508 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5509 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5510 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5511 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5512 | * If the pin mode is changed by the user the pin mode control will |
| 5513 | * take care of enabling the pin's input/output buffers as needed. |
| 5514 | * Therefore there's no need to enable the input buffer at this |
| 5515 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5516 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5517 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5518 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5519 | * mixer ctrl) |
| 5520 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5521 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5522 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5523 | /* Mute capture amp left and right */ |
| 5524 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5525 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5526 | * in (on mic1 pin) |
| 5527 | */ |
| 5528 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5529 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5530 | /* Do the same for the second ADC: mute capture input amp and |
| 5531 | * set ADC connection to line in (on mic1 pin) |
| 5532 | */ |
| 5533 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5534 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5535 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5536 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5537 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5538 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5539 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5540 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5541 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5542 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5543 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5544 | {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] | 5545 | |
| 5546 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5547 | }; |
| 5548 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5549 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5550 | * similar laptops (adapted from Fujitsu init verbs). |
| 5551 | */ |
| 5552 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5553 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5554 | * the headphone jack. Turn this on and rely on the standard mute |
| 5555 | * methods whenever the user wants to turn these outputs off. |
| 5556 | */ |
| 5557 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5558 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5559 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5560 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5561 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5562 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5563 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5564 | /* Line In jack is connected to Line1 pin */ |
| 5565 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5566 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5567 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5568 | /* Ensure all other unused pins are disabled and muted. */ |
| 5569 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5570 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5571 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5572 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5573 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5574 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5575 | /* Disable digital (SPDIF) pins */ |
| 5576 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5577 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5578 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5579 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5580 | * bus when acting as outputs. |
| 5581 | */ |
| 5582 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5583 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5584 | |
| 5585 | /* Start with output sum widgets muted and their output gains at min */ |
| 5586 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5587 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5588 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5589 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5590 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5591 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5592 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5593 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5594 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5595 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5596 | /* Unmute Line-out pin widget amp left and right |
| 5597 | * (no equiv mixer ctrl) |
| 5598 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5599 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5600 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5601 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5602 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5603 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5604 | * will take care of enabling the pin's input/output buffers as needed. |
| 5605 | * Therefore there's no need to enable the input buffer at this |
| 5606 | * stage. |
| 5607 | */ |
| 5608 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5609 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5610 | |
| 5611 | /* Mute capture amp left and right */ |
| 5612 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5613 | /* Set ADC connection select to match default mixer setting - mic |
| 5614 | * (on mic1 pin) |
| 5615 | */ |
| 5616 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5617 | |
| 5618 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5619 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5620 | */ |
| 5621 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5622 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5623 | |
| 5624 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5625 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5626 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5627 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5628 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5629 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5630 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5631 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5632 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5633 | |
| 5634 | { } |
| 5635 | }; |
| 5636 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5637 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5638 | * (adapted from Acer init verbs). |
| 5639 | */ |
| 5640 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5641 | /* GPIO 0 enables the output jack. |
| 5642 | * Turn this on and rely on the standard mute |
| 5643 | * methods whenever the user wants to turn these outputs off. |
| 5644 | */ |
| 5645 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5646 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5647 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5648 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5649 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5650 | /* Ensure all other unused pins are disabled and muted. */ |
| 5651 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5652 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5653 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5654 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5655 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5656 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5657 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5658 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5659 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5660 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5661 | /* Disable digital (SPDIF) pins */ |
| 5662 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5663 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5664 | |
| 5665 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5666 | * bus when acting as outputs. |
| 5667 | */ |
| 5668 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5669 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5670 | |
| 5671 | /* Start with output sum widgets muted and their output gains at min */ |
| 5672 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5673 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5674 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5675 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5676 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5677 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5678 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5679 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5680 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5681 | |
| 5682 | /* Unmute Line-out pin widget amp left and right |
| 5683 | * (no equiv mixer ctrl) |
| 5684 | */ |
| 5685 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5686 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5687 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5688 | * will take care of enabling the pin's input/output buffers as needed. |
| 5689 | * Therefore there's no need to enable the input buffer at this |
| 5690 | * stage. |
| 5691 | */ |
| 5692 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5693 | |
| 5694 | /* Mute capture amp left and right */ |
| 5695 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5696 | /* Set ADC connection select to match default mixer setting - mic |
| 5697 | * (on mic1 pin) |
| 5698 | */ |
| 5699 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5700 | |
| 5701 | /* Do similar with the second ADC: mute capture input amp and |
| 5702 | * set ADC connection to mic to match ALSA's default state. |
| 5703 | */ |
| 5704 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5705 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5706 | |
| 5707 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5708 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5709 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5710 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5711 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5712 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5713 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5714 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5715 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5716 | |
| 5717 | { } |
| 5718 | }; |
| 5719 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5720 | static struct hda_verb alc260_will_verbs[] = { |
| 5721 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5722 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5723 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5724 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5725 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5726 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5727 | {} |
| 5728 | }; |
| 5729 | |
| 5730 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5731 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5732 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5733 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5734 | |
| 5735 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5736 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5737 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5738 | |
| 5739 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5740 | {} |
| 5741 | }; |
| 5742 | |
| 5743 | /* toggle speaker-output according to the hp-jack state */ |
| 5744 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5745 | { |
| 5746 | unsigned int present; |
| 5747 | |
| 5748 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5749 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5750 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5751 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5752 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5753 | AC_VERB_SET_GPIO_DATA, 1); |
| 5754 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5755 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5756 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5757 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5758 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5759 | AC_VERB_SET_GPIO_DATA, 0); |
| 5760 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5761 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5762 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5763 | } |
| 5764 | } |
| 5765 | |
| 5766 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5767 | unsigned int res) |
| 5768 | { |
| 5769 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5770 | alc260_replacer_672v_automute(codec); |
| 5771 | } |
| 5772 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5773 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5774 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5775 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5776 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5777 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5778 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5779 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5780 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5781 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5782 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5783 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5784 | {} |
| 5785 | }; |
| 5786 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5787 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5788 | * configuration. |
| 5789 | */ |
| 5790 | #ifdef CONFIG_SND_DEBUG |
| 5791 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5792 | 0x02, |
| 5793 | }; |
| 5794 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5795 | 0x04, 0x05, |
| 5796 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5797 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5798 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5799 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5800 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5801 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5802 | { |
| 5803 | .num_items = 7, |
| 5804 | .items = { |
| 5805 | { "MIC1 pin", 0x0 }, |
| 5806 | { "MIC2 pin", 0x1 }, |
| 5807 | { "LINE1 pin", 0x2 }, |
| 5808 | { "LINE2 pin", 0x3 }, |
| 5809 | { "CD pin", 0x4 }, |
| 5810 | { "LINE-OUT pin", 0x5 }, |
| 5811 | { "HP-OUT pin", 0x6 }, |
| 5812 | }, |
| 5813 | }, |
| 5814 | { |
| 5815 | .num_items = 8, |
| 5816 | .items = { |
| 5817 | { "MIC1 pin", 0x0 }, |
| 5818 | { "MIC2 pin", 0x1 }, |
| 5819 | { "LINE1 pin", 0x2 }, |
| 5820 | { "LINE2 pin", 0x3 }, |
| 5821 | { "CD pin", 0x4 }, |
| 5822 | { "Mixer", 0x5 }, |
| 5823 | { "LINE-OUT pin", 0x6 }, |
| 5824 | { "HP-OUT pin", 0x7 }, |
| 5825 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5826 | }, |
| 5827 | }; |
| 5828 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5829 | /* Output driver widgets */ |
| 5830 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5831 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5832 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5833 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5834 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5835 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5836 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5837 | /* Modes for retasking pin widgets |
| 5838 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5839 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5840 | * mention this restriction. At this stage it's not clear whether |
| 5841 | * this behaviour is intentional or is a hardware bug in chip |
| 5842 | * revisions available at least up until early 2006. Therefore for |
| 5843 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5844 | * choices, but if it turns out that the lack of mic bias for these |
| 5845 | * NIDs is intentional we could change their modes from |
| 5846 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5847 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5848 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5849 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5850 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5851 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5852 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5853 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5854 | |
| 5855 | /* Loopback mixer controls */ |
| 5856 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5857 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5858 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5859 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5860 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5861 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5862 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5863 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5864 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5865 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5866 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5867 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5868 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5869 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5870 | |
| 5871 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5872 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5873 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5874 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5875 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5876 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5877 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5878 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5879 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5880 | */ |
| 5881 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5882 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5883 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5884 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5885 | * this output to turn on an external amplifier. |
| 5886 | */ |
| 5887 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5888 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5889 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5890 | { } /* end */ |
| 5891 | }; |
| 5892 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5893 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5894 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5895 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5896 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5897 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5898 | /* Enable retasking pins as output, initially without power amp */ |
| 5899 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5900 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5901 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5902 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5903 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5904 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5905 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5906 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5907 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5908 | * payload also sets the generation to 0, output to be in "consumer" |
| 5909 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5910 | * control. |
| 5911 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5912 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5913 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5914 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5915 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5916 | * OUT1 sum bus when acting as an output. |
| 5917 | */ |
| 5918 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5919 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5920 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5921 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5922 | |
| 5923 | /* Start with output sum widgets muted and their output gains at min */ |
| 5924 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5925 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5926 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5927 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5928 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5929 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5930 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5931 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5932 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5933 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5934 | /* Unmute retasking pin widget output buffers since the default |
| 5935 | * state appears to be output. As the pin mode is changed by the |
| 5936 | * user the pin mode control will take care of enabling the pin's |
| 5937 | * input/output buffers as needed. |
| 5938 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5939 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5940 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5941 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5942 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5943 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5944 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5945 | /* Also unmute the mono-out pin widget */ |
| 5946 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5947 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5948 | /* Mute capture amp left and right */ |
| 5949 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5950 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5951 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5952 | */ |
| 5953 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5954 | |
| 5955 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5956 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5957 | */ |
| 5958 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5959 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5960 | |
| 5961 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5962 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5963 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5964 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5965 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5966 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5967 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5968 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5969 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5970 | |
| 5971 | { } |
| 5972 | }; |
| 5973 | #endif |
| 5974 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5975 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5976 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5977 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5978 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5979 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5980 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5981 | /* |
| 5982 | * for BIOS auto-configuration |
| 5983 | */ |
| 5984 | |
| 5985 | 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] | 5986 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5987 | { |
| 5988 | hda_nid_t nid_vol; |
| 5989 | unsigned long vol_val, sw_val; |
| 5990 | char name[32]; |
| 5991 | int err; |
| 5992 | |
| 5993 | if (nid >= 0x0f && nid < 0x11) { |
| 5994 | nid_vol = nid - 0x7; |
| 5995 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5996 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5997 | } else if (nid == 0x11) { |
| 5998 | nid_vol = nid - 0x7; |
| 5999 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6000 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6001 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6002 | nid_vol = 0x08; |
| 6003 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6004 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6005 | } else |
| 6006 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6007 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6008 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6009 | /* first control for the volume widget */ |
| 6010 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 6011 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 6012 | if (err < 0) |
| 6013 | return err; |
| 6014 | *vol_bits |= (1 << nid_vol); |
| 6015 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6016 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6017 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 6018 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6019 | return err; |
| 6020 | return 1; |
| 6021 | } |
| 6022 | |
| 6023 | /* add playback controls from the parsed DAC table */ |
| 6024 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6025 | const struct auto_pin_cfg *cfg) |
| 6026 | { |
| 6027 | hda_nid_t nid; |
| 6028 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6029 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6030 | |
| 6031 | spec->multiout.num_dacs = 1; |
| 6032 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6033 | spec->multiout.dac_nids[0] = 0x02; |
| 6034 | |
| 6035 | nid = cfg->line_out_pins[0]; |
| 6036 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6037 | const char *pfx; |
| 6038 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6039 | pfx = "Master"; |
| 6040 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6041 | pfx = "Speaker"; |
| 6042 | else |
| 6043 | pfx = "Front"; |
| 6044 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6045 | if (err < 0) |
| 6046 | return err; |
| 6047 | } |
| 6048 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6049 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6050 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6051 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6052 | if (err < 0) |
| 6053 | return err; |
| 6054 | } |
| 6055 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6056 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6057 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6058 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6059 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6060 | if (err < 0) |
| 6061 | return err; |
| 6062 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6063 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6064 | } |
| 6065 | |
| 6066 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6067 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6068 | const struct auto_pin_cfg *cfg) |
| 6069 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6070 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6071 | } |
| 6072 | |
| 6073 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6074 | hda_nid_t nid, int pin_type, |
| 6075 | int sel_idx) |
| 6076 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6077 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6078 | /* need the manual connection? */ |
| 6079 | if (nid >= 0x12) { |
| 6080 | int idx = nid - 0x12; |
| 6081 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6082 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6083 | } |
| 6084 | } |
| 6085 | |
| 6086 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6087 | { |
| 6088 | struct alc_spec *spec = codec->spec; |
| 6089 | hda_nid_t nid; |
| 6090 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6091 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6092 | if (nid) { |
| 6093 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6094 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6095 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6096 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6097 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6098 | if (nid) |
| 6099 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6100 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6101 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6102 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6103 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6104 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6105 | |
| 6106 | #define ALC260_PIN_CD_NID 0x16 |
| 6107 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6108 | { |
| 6109 | struct alc_spec *spec = codec->spec; |
| 6110 | int i; |
| 6111 | |
| 6112 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6113 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6114 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6115 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6116 | if (nid != ALC260_PIN_CD_NID && |
| 6117 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6118 | snd_hda_codec_write(codec, nid, 0, |
| 6119 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6120 | AMP_OUT_MUTE); |
| 6121 | } |
| 6122 | } |
| 6123 | } |
| 6124 | |
| 6125 | /* |
| 6126 | * generic initialization of ADC, input mixers and output mixers |
| 6127 | */ |
| 6128 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6129 | /* |
| 6130 | * Unmute ADC0-1 and set the default input to mic-in |
| 6131 | */ |
| 6132 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6133 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6134 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6135 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6136 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6137 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6138 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6139 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6140 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6141 | */ |
| 6142 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6143 | /* mute analog inputs */ |
| 6144 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6145 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6146 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6147 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6148 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6149 | |
| 6150 | /* |
| 6151 | * Set up output mixers (0x08 - 0x0a) |
| 6152 | */ |
| 6153 | /* set vol=0 to output mixers */ |
| 6154 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6155 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6156 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6157 | /* set up input amps for analog loopback */ |
| 6158 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6159 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6160 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6161 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6162 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6163 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6164 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6165 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6166 | { } |
| 6167 | }; |
| 6168 | |
| 6169 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6170 | { |
| 6171 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6172 | int err; |
| 6173 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6174 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6175 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6176 | alc260_ignore); |
| 6177 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6178 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6179 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6180 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6181 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6182 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6183 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6184 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6185 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6186 | return err; |
| 6187 | |
| 6188 | spec->multiout.max_channels = 2; |
| 6189 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6190 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6191 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6192 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6193 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6194 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6195 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6196 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6197 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6198 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6199 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6200 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6202 | return 1; |
| 6203 | } |
| 6204 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6205 | /* additional initialization for auto-configuration model */ |
| 6206 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6207 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6208 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6209 | alc260_auto_init_multi_out(codec); |
| 6210 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6211 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6212 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6213 | } |
| 6214 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6215 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6216 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6217 | { 0x07, HDA_INPUT, 0 }, |
| 6218 | { 0x07, HDA_INPUT, 1 }, |
| 6219 | { 0x07, HDA_INPUT, 2 }, |
| 6220 | { 0x07, HDA_INPUT, 3 }, |
| 6221 | { 0x07, HDA_INPUT, 4 }, |
| 6222 | { } /* end */ |
| 6223 | }; |
| 6224 | #endif |
| 6225 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6226 | /* |
| 6227 | * ALC260 configurations |
| 6228 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6229 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6230 | [ALC260_BASIC] = "basic", |
| 6231 | [ALC260_HP] = "hp", |
| 6232 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6233 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6234 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6235 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6236 | [ALC260_WILL] = "will", |
| 6237 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6238 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6239 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6240 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6241 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6242 | [ALC260_AUTO] = "auto", |
| 6243 | }; |
| 6244 | |
| 6245 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6246 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6247 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6248 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6249 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 6250 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6251 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6252 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6253 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6254 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6255 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6256 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6257 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6258 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6259 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6260 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6261 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6262 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6263 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6264 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6265 | {} |
| 6266 | }; |
| 6267 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6268 | static struct alc_config_preset alc260_presets[] = { |
| 6269 | [ALC260_BASIC] = { |
| 6270 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6271 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6272 | .init_verbs = { alc260_init_verbs }, |
| 6273 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6274 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6275 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6276 | .adc_nids = alc260_adc_nids, |
| 6277 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6278 | .channel_mode = alc260_modes, |
| 6279 | .input_mux = &alc260_capture_source, |
| 6280 | }, |
| 6281 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6282 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6283 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6284 | .init_verbs = { alc260_init_verbs, |
| 6285 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6286 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6287 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6288 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6289 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6290 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6291 | .channel_mode = alc260_modes, |
| 6292 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6293 | .unsol_event = alc260_hp_unsol_event, |
| 6294 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6295 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6296 | [ALC260_HP_DC7600] = { |
| 6297 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6298 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6299 | .init_verbs = { alc260_init_verbs, |
| 6300 | alc260_hp_dc7600_verbs }, |
| 6301 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6302 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6303 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6304 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6305 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6306 | .channel_mode = alc260_modes, |
| 6307 | .input_mux = &alc260_capture_source, |
| 6308 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6309 | .init_hook = alc260_hp_3012_automute, |
| 6310 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6311 | [ALC260_HP_3013] = { |
| 6312 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6313 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6314 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6315 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6316 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6317 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6318 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6319 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6320 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6321 | .channel_mode = alc260_modes, |
| 6322 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6323 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6324 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6325 | }, |
| 6326 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6327 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6328 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6329 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6330 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6331 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6332 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6333 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6334 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6335 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6336 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6337 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6338 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6339 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6340 | .init_verbs = { alc260_acer_init_verbs }, |
| 6341 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6342 | .dac_nids = alc260_dac_nids, |
| 6343 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6344 | .adc_nids = alc260_dual_adc_nids, |
| 6345 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6346 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6347 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6348 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6349 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6350 | [ALC260_FAVORIT100] = { |
| 6351 | .mixers = { alc260_favorit100_mixer }, |
| 6352 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6353 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6354 | .dac_nids = alc260_dac_nids, |
| 6355 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6356 | .adc_nids = alc260_dual_adc_nids, |
| 6357 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6358 | .channel_mode = alc260_modes, |
| 6359 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6360 | .input_mux = alc260_favorit100_capture_sources, |
| 6361 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6362 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6363 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6364 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6365 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6366 | .dac_nids = alc260_dac_nids, |
| 6367 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6368 | .adc_nids = alc260_adc_nids, |
| 6369 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6370 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6371 | .channel_mode = alc260_modes, |
| 6372 | .input_mux = &alc260_capture_source, |
| 6373 | }, |
| 6374 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6375 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6376 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6377 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6378 | .dac_nids = alc260_dac_nids, |
| 6379 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6380 | .adc_nids = alc260_adc_nids, |
| 6381 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6382 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6383 | .channel_mode = alc260_modes, |
| 6384 | .input_mux = &alc260_capture_source, |
| 6385 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6386 | .init_hook = alc260_replacer_672v_automute, |
| 6387 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6388 | #ifdef CONFIG_SND_DEBUG |
| 6389 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6390 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6391 | .init_verbs = { alc260_test_init_verbs }, |
| 6392 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6393 | .dac_nids = alc260_test_dac_nids, |
| 6394 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6395 | .adc_nids = alc260_test_adc_nids, |
| 6396 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6397 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6398 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6399 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6400 | }, |
| 6401 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6402 | }; |
| 6403 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6404 | static int patch_alc260(struct hda_codec *codec) |
| 6405 | { |
| 6406 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6407 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6408 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6409 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6410 | if (spec == NULL) |
| 6411 | return -ENOMEM; |
| 6412 | |
| 6413 | codec->spec = spec; |
| 6414 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6415 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6416 | alc260_models, |
| 6417 | alc260_cfg_tbl); |
| 6418 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6419 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6420 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6421 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6422 | } |
| 6423 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6424 | if (board_config == ALC260_AUTO) { |
| 6425 | /* automatic parse from the BIOS config */ |
| 6426 | err = alc260_parse_auto_config(codec); |
| 6427 | if (err < 0) { |
| 6428 | alc_free(codec); |
| 6429 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6430 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6431 | printk(KERN_INFO |
| 6432 | "hda_codec: Cannot set up configuration " |
| 6433 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6434 | board_config = ALC260_BASIC; |
| 6435 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6436 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6437 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6438 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6439 | if (err < 0) { |
| 6440 | alc_free(codec); |
| 6441 | return err; |
| 6442 | } |
| 6443 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6444 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6445 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6446 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6447 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6448 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6449 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6450 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6451 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6452 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6453 | if (!spec->adc_nids && spec->input_mux) { |
| 6454 | /* check whether NID 0x04 is valid */ |
| 6455 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6456 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6457 | /* get type */ |
| 6458 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6459 | spec->adc_nids = alc260_adc_nids_alt; |
| 6460 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6461 | } else { |
| 6462 | spec->adc_nids = alc260_adc_nids; |
| 6463 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6464 | } |
| 6465 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6466 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6467 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6468 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6469 | spec->vmaster_nid = 0x08; |
| 6470 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6471 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6472 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6473 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6474 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6475 | if (!spec->loopback.amplist) |
| 6476 | spec->loopback.amplist = alc260_loopbacks; |
| 6477 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6478 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6479 | |
| 6480 | return 0; |
| 6481 | } |
| 6482 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6483 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6484 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6485 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6486 | * |
| 6487 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6488 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6489 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6490 | * 6-channel independent captures. |
| 6491 | * |
| 6492 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6493 | * driver yet). |
| 6494 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6495 | #define ALC882_DIGOUT_NID 0x06 |
| 6496 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6497 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6498 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6499 | #define ALC1200_DIGOUT_NID 0x10 |
| 6500 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6501 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6502 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6503 | { 8, NULL } |
| 6504 | }; |
| 6505 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6506 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6507 | static hda_nid_t alc882_dac_nids[4] = { |
| 6508 | /* front, rear, clfe, rear_surr */ |
| 6509 | 0x02, 0x03, 0x04, 0x05 |
| 6510 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6511 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6512 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6513 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6514 | #define alc882_adc_nids alc880_adc_nids |
| 6515 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6516 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6517 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6518 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6519 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6520 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6521 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6522 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6523 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6524 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6525 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6526 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6527 | /* input MUX */ |
| 6528 | /* FIXME: should be a matrix-type input source selection */ |
| 6529 | |
| 6530 | static struct hda_input_mux alc882_capture_source = { |
| 6531 | .num_items = 4, |
| 6532 | .items = { |
| 6533 | { "Mic", 0x0 }, |
| 6534 | { "Front Mic", 0x1 }, |
| 6535 | { "Line", 0x2 }, |
| 6536 | { "CD", 0x4 }, |
| 6537 | }, |
| 6538 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6539 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6540 | #define alc883_capture_source alc882_capture_source |
| 6541 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6542 | static struct hda_input_mux alc889_capture_source = { |
| 6543 | .num_items = 3, |
| 6544 | .items = { |
| 6545 | { "Front Mic", 0x0 }, |
| 6546 | { "Mic", 0x3 }, |
| 6547 | { "Line", 0x2 }, |
| 6548 | }, |
| 6549 | }; |
| 6550 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6551 | static struct hda_input_mux mb5_capture_source = { |
| 6552 | .num_items = 3, |
| 6553 | .items = { |
| 6554 | { "Mic", 0x1 }, |
| 6555 | { "Line", 0x2 }, |
| 6556 | { "CD", 0x4 }, |
| 6557 | }, |
| 6558 | }; |
| 6559 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6560 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6561 | .num_items = 4, |
| 6562 | .items = { |
| 6563 | { "Mic", 0x1 }, |
| 6564 | { "Front Mic", 0x0 }, |
| 6565 | { "Line", 0x2 }, |
| 6566 | { "CD", 0x4 }, |
| 6567 | }, |
| 6568 | }; |
| 6569 | |
| 6570 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6571 | .num_items = 2, |
| 6572 | .items = { |
| 6573 | { "Mic", 0x1 }, |
| 6574 | { "Line", 0x2 }, |
| 6575 | }, |
| 6576 | }; |
| 6577 | |
| 6578 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6579 | .num_items = 4, |
| 6580 | .items = { |
| 6581 | { "Mic", 0x0 }, |
| 6582 | { "iMic", 0x1 }, |
| 6583 | { "Line", 0x2 }, |
| 6584 | { "CD", 0x4 }, |
| 6585 | }, |
| 6586 | }; |
| 6587 | |
| 6588 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6589 | .num_items = 2, |
| 6590 | .items = { |
| 6591 | { "Mic", 0x0 }, |
| 6592 | { "Int Mic", 0x1 }, |
| 6593 | }, |
| 6594 | }; |
| 6595 | |
| 6596 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6597 | .num_items = 3, |
| 6598 | .items = { |
| 6599 | { "Mic", 0x0 }, |
| 6600 | { "Front Mic", 0x1 }, |
| 6601 | { "Line", 0x4 }, |
| 6602 | }, |
| 6603 | }; |
| 6604 | |
| 6605 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6606 | .num_items = 2, |
| 6607 | .items = { |
| 6608 | { "Mic", 0x0 }, |
| 6609 | { "Line", 0x2 }, |
| 6610 | }, |
| 6611 | }; |
| 6612 | |
| 6613 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6614 | .num_items = 2, |
| 6615 | .items = { |
| 6616 | { "Mic", 0x0 }, |
| 6617 | /* Front Mic (0x01) unused */ |
| 6618 | { "Line", 0x2 }, |
| 6619 | /* Line 2 (0x03) unused */ |
| 6620 | /* CD (0x04) unsused? */ |
| 6621 | }, |
| 6622 | }; |
| 6623 | |
| 6624 | /* |
| 6625 | * 2ch mode |
| 6626 | */ |
| 6627 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6628 | { 2, NULL } |
| 6629 | }; |
| 6630 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6631 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6632 | * 2ch mode |
| 6633 | */ |
| 6634 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6635 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6636 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6637 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6638 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6639 | { } /* end */ |
| 6640 | }; |
| 6641 | |
| 6642 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6643 | * 4ch mode |
| 6644 | */ |
| 6645 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6646 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6647 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6648 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6649 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6650 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6651 | { } /* end */ |
| 6652 | }; |
| 6653 | |
| 6654 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6655 | * 6ch mode |
| 6656 | */ |
| 6657 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6658 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6659 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6660 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6661 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6662 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6663 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6664 | { } /* end */ |
| 6665 | }; |
| 6666 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6667 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6668 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6669 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6670 | { 6, alc882_3ST_ch6_init }, |
| 6671 | }; |
| 6672 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6673 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6674 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6675 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 6676 | * 2ch mode |
| 6677 | */ |
| 6678 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 6679 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 6680 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6681 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6682 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6683 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6684 | { } /* end */ |
| 6685 | }; |
| 6686 | |
| 6687 | /* |
| 6688 | * 4ch mode |
| 6689 | */ |
| 6690 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 6691 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6692 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6693 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6694 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6695 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6696 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6697 | { } /* end */ |
| 6698 | }; |
| 6699 | |
| 6700 | /* |
| 6701 | * 6ch mode |
| 6702 | */ |
| 6703 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 6704 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6705 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6706 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6707 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6708 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6709 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6710 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6711 | { } /* end */ |
| 6712 | }; |
| 6713 | |
| 6714 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 6715 | { 2, alc883_3ST_ch2_clevo_init }, |
| 6716 | { 4, alc883_3ST_ch4_clevo_init }, |
| 6717 | { 6, alc883_3ST_ch6_clevo_init }, |
| 6718 | }; |
| 6719 | |
| 6720 | |
| 6721 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6722 | * 6ch mode |
| 6723 | */ |
| 6724 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6725 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6726 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6727 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6728 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6729 | { } /* end */ |
| 6730 | }; |
| 6731 | |
| 6732 | /* |
| 6733 | * 8ch mode |
| 6734 | */ |
| 6735 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6736 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6737 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6738 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6739 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6740 | { } /* end */ |
| 6741 | }; |
| 6742 | |
| 6743 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6744 | { 6, alc882_sixstack_ch6_init }, |
| 6745 | { 8, alc882_sixstack_ch8_init }, |
| 6746 | }; |
| 6747 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6748 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6749 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6750 | */ |
| 6751 | |
| 6752 | /* |
| 6753 | * 2ch mode |
| 6754 | */ |
| 6755 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6756 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6757 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6758 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6759 | { } /* end */ |
| 6760 | }; |
| 6761 | |
| 6762 | /* |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6763 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6764 | */ |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6765 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6766 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6767 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6768 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6769 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6770 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6771 | { } /* end */ |
| 6772 | }; |
| 6773 | |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6774 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6775 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6776 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6777 | }; |
| 6778 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6779 | /* |
| 6780 | * 2ch |
| 6781 | * Speakers/Woofer/HP = Front |
| 6782 | * LineIn = Input |
| 6783 | */ |
| 6784 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6785 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6786 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6787 | { } /* end */ |
| 6788 | }; |
| 6789 | |
| 6790 | /* |
| 6791 | * 6ch mode |
| 6792 | * Speakers/HP = Front |
| 6793 | * Woofer = LFE |
| 6794 | * LineIn = Surround |
| 6795 | */ |
| 6796 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6797 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6798 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6799 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6800 | { } /* end */ |
| 6801 | }; |
| 6802 | |
| 6803 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6804 | { 2, alc885_mb5_ch2_init }, |
| 6805 | { 6, alc885_mb5_ch6_init }, |
| 6806 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6807 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6808 | |
| 6809 | /* |
| 6810 | * 2ch mode |
| 6811 | */ |
| 6812 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 6813 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6814 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6815 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6816 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6817 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6818 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6819 | { } /* end */ |
| 6820 | }; |
| 6821 | |
| 6822 | /* |
| 6823 | * 4ch mode |
| 6824 | */ |
| 6825 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 6826 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6827 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6828 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6829 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6830 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6831 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6832 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6833 | { } /* end */ |
| 6834 | }; |
| 6835 | |
| 6836 | /* |
| 6837 | * 6ch mode |
| 6838 | */ |
| 6839 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 6840 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6841 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6842 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6843 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6844 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6845 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6846 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6847 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6848 | { } /* end */ |
| 6849 | }; |
| 6850 | |
| 6851 | /* |
| 6852 | * 8ch mode |
| 6853 | */ |
| 6854 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 6855 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6856 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6857 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6858 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6859 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6860 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6861 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6862 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6863 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6864 | { } /* end */ |
| 6865 | }; |
| 6866 | |
| 6867 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 6868 | { 2, alc883_4ST_ch2_init }, |
| 6869 | { 4, alc883_4ST_ch4_init }, |
| 6870 | { 6, alc883_4ST_ch6_init }, |
| 6871 | { 8, alc883_4ST_ch8_init }, |
| 6872 | }; |
| 6873 | |
| 6874 | |
| 6875 | /* |
| 6876 | * 2ch mode |
| 6877 | */ |
| 6878 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6879 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6880 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6881 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6882 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6883 | { } /* end */ |
| 6884 | }; |
| 6885 | |
| 6886 | /* |
| 6887 | * 4ch mode |
| 6888 | */ |
| 6889 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6890 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6891 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6892 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6893 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6894 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6895 | { } /* end */ |
| 6896 | }; |
| 6897 | |
| 6898 | /* |
| 6899 | * 6ch mode |
| 6900 | */ |
| 6901 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6902 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6903 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6904 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6905 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6906 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6907 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6908 | { } /* end */ |
| 6909 | }; |
| 6910 | |
| 6911 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6912 | { 2, alc883_3ST_ch2_intel_init }, |
| 6913 | { 4, alc883_3ST_ch4_intel_init }, |
| 6914 | { 6, alc883_3ST_ch6_intel_init }, |
| 6915 | }; |
| 6916 | |
| 6917 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6918 | * 2ch mode |
| 6919 | */ |
| 6920 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 6921 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6922 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6923 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6924 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6925 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6926 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6927 | { } /* end */ |
| 6928 | }; |
| 6929 | |
| 6930 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6931 | * 6ch mode |
| 6932 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6933 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6934 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6935 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6936 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6937 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6938 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6939 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6940 | { } /* end */ |
| 6941 | }; |
| 6942 | |
| 6943 | /* |
| 6944 | * 8ch mode |
| 6945 | */ |
| 6946 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6947 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6948 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6949 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6950 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6951 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6952 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6953 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6954 | { } /* end */ |
| 6955 | }; |
| 6956 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6957 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 6958 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6959 | { 6, alc889_ch6_intel_init }, |
| 6960 | { 8, alc889_ch8_intel_init }, |
| 6961 | }; |
| 6962 | |
| 6963 | /* |
| 6964 | * 6ch mode |
| 6965 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6966 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6967 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6968 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6969 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6970 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6971 | { } /* end */ |
| 6972 | }; |
| 6973 | |
| 6974 | /* |
| 6975 | * 8ch mode |
| 6976 | */ |
| 6977 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6978 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6979 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6980 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6981 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6982 | { } /* end */ |
| 6983 | }; |
| 6984 | |
| 6985 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6986 | { 6, alc883_sixstack_ch6_init }, |
| 6987 | { 8, alc883_sixstack_ch8_init }, |
| 6988 | }; |
| 6989 | |
| 6990 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6991 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6992 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6993 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6994 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6995 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6996 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6997 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6998 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6999 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7000 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7001 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7002 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7003 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7004 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7005 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7006 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7007 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7008 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7009 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7010 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7011 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7012 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7013 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7014 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7015 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7016 | { } /* end */ |
| 7017 | }; |
| 7018 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7019 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7020 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7021 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7022 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7023 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7024 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7025 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7026 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7027 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7028 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7029 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7030 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7031 | { } /* end */ |
| 7032 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7033 | |
| 7034 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7035 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7036 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7037 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7038 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7039 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7040 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7041 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7042 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7043 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7044 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7045 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7046 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7047 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7048 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7049 | { } /* end */ |
| 7050 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7051 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7052 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7053 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7054 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7055 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7056 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7057 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7058 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7059 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7060 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7061 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7062 | { } /* end */ |
| 7063 | }; |
| 7064 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7065 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7066 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7067 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7068 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7069 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7070 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7071 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7072 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7073 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7074 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7075 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7076 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7077 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7078 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7079 | { } /* end */ |
| 7080 | }; |
| 7081 | |
| 7082 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7083 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7084 | */ |
| 7085 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7086 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7087 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7088 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7089 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7090 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7091 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7092 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7093 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7094 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7095 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7096 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7097 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7098 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7099 | { } /* end */ |
| 7100 | }; |
| 7101 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7102 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7103 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7104 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7105 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7106 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7107 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7108 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7109 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7110 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7111 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7112 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7113 | { } /* end */ |
| 7114 | }; |
| 7115 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7116 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7117 | { |
| 7118 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7119 | .name = "Channel Mode", |
| 7120 | .info = alc_ch_mode_info, |
| 7121 | .get = alc_ch_mode_get, |
| 7122 | .put = alc_ch_mode_put, |
| 7123 | }, |
| 7124 | { } /* end */ |
| 7125 | }; |
| 7126 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7127 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7128 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7130 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7131 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7132 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7133 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7134 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7135 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7136 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7137 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7138 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7139 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7140 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7141 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7142 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7143 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7144 | |
Takashi Iwai | cb63812 | 2009-07-03 10:56:10 +0200 | [diff] [blame] | 7145 | /* mute analog input loopbacks */ |
| 7146 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7147 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7148 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7149 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7150 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7151 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7152 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7153 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7154 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7155 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7156 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7157 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7158 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7159 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7160 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7161 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7162 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7163 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7164 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7165 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7166 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7167 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7168 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7169 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7170 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7171 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7172 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7173 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7174 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7175 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7176 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7177 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7178 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7179 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7180 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7181 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7182 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7183 | |
| 7184 | /* FIXME: use matrix-type input source selection */ |
| 7185 | /* 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] | 7186 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7187 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7188 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7189 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7190 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7191 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7192 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7193 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7194 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7195 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7196 | /* ADC2: mute amp left and right */ |
| 7197 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7198 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7199 | /* ADC3: mute amp left and right */ |
| 7200 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7201 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7202 | |
| 7203 | { } |
| 7204 | }; |
| 7205 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7206 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7207 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7208 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7209 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7210 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7211 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7212 | /* ADC1: mute amp left and right */ |
| 7213 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7214 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7215 | { } |
| 7216 | }; |
| 7217 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7218 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7219 | /* change to EAPD mode */ |
| 7220 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7221 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7222 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7223 | }; |
| 7224 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7225 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7226 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7227 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7228 | { } |
| 7229 | }; |
| 7230 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7231 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7232 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7233 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7234 | {} |
| 7235 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7236 | |
| 7237 | static struct hda_verb alc885_init_verbs[] = { |
| 7238 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7239 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7240 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7241 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7242 | /* Rear mixer */ |
| 7243 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7244 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7245 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7246 | /* CLFE mixer */ |
| 7247 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7248 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7249 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7250 | /* Side mixer */ |
| 7251 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7252 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7253 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7254 | |
| 7255 | /* mute analog input loopbacks */ |
| 7256 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7257 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7258 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7259 | |
| 7260 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7261 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7262 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7263 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7264 | /* Front Pin: output 0 (0x0c) */ |
| 7265 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7266 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7267 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7268 | /* Rear Pin: output 1 (0x0d) */ |
| 7269 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7270 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7271 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7272 | /* CLFE Pin: output 2 (0x0e) */ |
| 7273 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7274 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7275 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7276 | /* Side Pin: output 3 (0x0f) */ |
| 7277 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7278 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7279 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7280 | /* Mic (rear) pin: input vref at 80% */ |
| 7281 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7282 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7283 | /* Front Mic pin: input vref at 80% */ |
| 7284 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7285 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7286 | /* Line In pin: input */ |
| 7287 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7288 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7289 | |
| 7290 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7291 | /* Input mixer1 */ |
| 7292 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7293 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7294 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7295 | /* Input mixer2 */ |
| 7296 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7297 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7298 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7299 | /* Input mixer3 */ |
| 7300 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7301 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7302 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7303 | /* ADC2: mute amp left and right */ |
| 7304 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7305 | /* ADC3: mute amp left and right */ |
| 7306 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7307 | |
| 7308 | { } |
| 7309 | }; |
| 7310 | |
| 7311 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7312 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7313 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7314 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7315 | { } |
| 7316 | }; |
| 7317 | |
| 7318 | |
| 7319 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7320 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7321 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7322 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7323 | { } |
| 7324 | }; |
| 7325 | |
| 7326 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7327 | #define alc883_init_verbs alc882_base_init_verbs |
| 7328 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7329 | /* Mac Pro test */ |
| 7330 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7331 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7332 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7333 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7334 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7335 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7336 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7337 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7338 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7339 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7340 | { } /* end */ |
| 7341 | }; |
| 7342 | |
| 7343 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7344 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7345 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7346 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7347 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7348 | /* Front Pin: output 0 (0x0c) */ |
| 7349 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7350 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7351 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7352 | /* Front Mic pin: input vref at 80% */ |
| 7353 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7354 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7355 | /* Speaker: output */ |
| 7356 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7357 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7358 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7359 | /* Headphone output (output 0 - 0x0c) */ |
| 7360 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7361 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7362 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7363 | |
| 7364 | /* FIXME: use matrix-type input source selection */ |
| 7365 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7366 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7367 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7368 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7369 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7370 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7371 | /* Input mixer2 */ |
| 7372 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7373 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7374 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7375 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7376 | /* Input mixer3 */ |
| 7377 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7378 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7379 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7380 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7381 | /* ADC1: mute amp left and right */ |
| 7382 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7383 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7384 | /* ADC2: mute amp left and right */ |
| 7385 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7386 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7387 | /* ADC3: mute amp left and right */ |
| 7388 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7389 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7390 | |
| 7391 | { } |
| 7392 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7393 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7394 | /* Macbook 5,1 */ |
| 7395 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7396 | /* DACs */ |
| 7397 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7398 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7399 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7400 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7401 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7402 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7403 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7404 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7405 | /* Surround mixer */ |
| 7406 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7407 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7408 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7409 | /* LFE mixer */ |
| 7410 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7411 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7412 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7413 | /* HP mixer */ |
| 7414 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7415 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7416 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7417 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7418 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7419 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7420 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7421 | /* LFE Pin (0x0e) */ |
| 7422 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7423 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7424 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7425 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7426 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7427 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7428 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7429 | /* Front Mic pin: input vref at 80% */ |
| 7430 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7431 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7432 | /* Line In pin */ |
| 7433 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7434 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7435 | |
| 7436 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7437 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7438 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7439 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7440 | { } |
| 7441 | }; |
| 7442 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7443 | /* Macbook Pro rev3 */ |
| 7444 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7445 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7446 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7447 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7448 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7449 | /* Rear mixer */ |
| 7450 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7451 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7452 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7453 | /* HP mixer */ |
| 7454 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7455 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7456 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7457 | /* Front Pin: output 0 (0x0c) */ |
| 7458 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7459 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7460 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7461 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7462 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7463 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7464 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7465 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7466 | /* Mic (rear) pin: input vref at 80% */ |
| 7467 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7468 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7469 | /* Front Mic pin: input vref at 80% */ |
| 7470 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7471 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7472 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7473 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7474 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7475 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7476 | |
| 7477 | /* FIXME: use matrix-type input source selection */ |
| 7478 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7479 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7480 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7481 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7482 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7483 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7484 | /* Input mixer2 */ |
| 7485 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7486 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7487 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7488 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7489 | /* Input mixer3 */ |
| 7490 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7491 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7492 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7493 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7494 | /* ADC1: mute amp left and right */ |
| 7495 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7496 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7497 | /* ADC2: mute amp left and right */ |
| 7498 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7499 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7500 | /* ADC3: mute amp left and right */ |
| 7501 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7502 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7503 | |
| 7504 | { } |
| 7505 | }; |
| 7506 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7507 | /* iMac 24 mixer. */ |
| 7508 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7509 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7510 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7511 | { } /* end */ |
| 7512 | }; |
| 7513 | |
| 7514 | /* iMac 24 init verbs. */ |
| 7515 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7516 | /* Internal speakers: output 0 (0x0c) */ |
| 7517 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7518 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7519 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7520 | /* Internal speakers: output 0 (0x0c) */ |
| 7521 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7522 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7523 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7524 | /* Headphone: output 0 (0x0c) */ |
| 7525 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7526 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7527 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7528 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7529 | /* Front Mic: input vref at 80% */ |
| 7530 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7531 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7532 | { } |
| 7533 | }; |
| 7534 | |
| 7535 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7536 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7537 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7538 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7539 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7540 | spec->autocfg.hp_pins[0] = 0x14; |
| 7541 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7542 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7543 | } |
| 7544 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7545 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7546 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7547 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7548 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7549 | spec->autocfg.hp_pins[0] = 0x15; |
| 7550 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7551 | } |
| 7552 | |
| 7553 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7554 | static struct hda_verb alc882_targa_verbs[] = { |
| 7555 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7556 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7557 | |
| 7558 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7559 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7560 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7561 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7562 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7563 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7564 | |
| 7565 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7566 | { } /* end */ |
| 7567 | }; |
| 7568 | |
| 7569 | /* toggle speaker-output according to the hp-jack state */ |
| 7570 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7571 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7572 | struct alc_spec *spec = codec->spec; |
| 7573 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7574 | 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] | 7575 | spec->jack_present ? 1 : 3); |
| 7576 | } |
| 7577 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7578 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7579 | { |
| 7580 | struct alc_spec *spec = codec->spec; |
| 7581 | |
| 7582 | spec->autocfg.hp_pins[0] = 0x14; |
| 7583 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7584 | } |
| 7585 | |
| 7586 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7587 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7588 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7589 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7590 | } |
| 7591 | |
| 7592 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7593 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7594 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7595 | |
| 7596 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7597 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7598 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7599 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7600 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7601 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7602 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7603 | |
| 7604 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7605 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7606 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7607 | { } /* end */ |
| 7608 | }; |
| 7609 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7610 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7611 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7612 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7613 | |
| 7614 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7615 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7616 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7617 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7618 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7619 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7620 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7621 | |
| 7622 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7623 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7624 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7625 | { } /* end */ |
| 7626 | }; |
| 7627 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7628 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7629 | { |
| 7630 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7631 | |
| 7632 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7633 | AC_VERB_GET_GPIO_DATA, 0); |
| 7634 | |
| 7635 | if (!muted) |
| 7636 | gpiostate |= (1 << pin); |
| 7637 | else |
| 7638 | gpiostate &= ~(1 << pin); |
| 7639 | |
| 7640 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7641 | AC_VERB_GET_GPIO_MASK, 0); |
| 7642 | gpiomask |= (1 << pin); |
| 7643 | |
| 7644 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7645 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7646 | gpiodir |= (1 << pin); |
| 7647 | |
| 7648 | |
| 7649 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7650 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7651 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7652 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7653 | |
| 7654 | msleep(1); |
| 7655 | |
| 7656 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7657 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7658 | } |
| 7659 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7660 | /* set up GPIO at initialization */ |
| 7661 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7662 | { |
| 7663 | alc882_gpio_mute(codec, 0, 0); |
| 7664 | alc882_gpio_mute(codec, 1, 0); |
| 7665 | } |
| 7666 | |
| 7667 | /* set up GPIO and update auto-muting at initialization */ |
| 7668 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7669 | { |
| 7670 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7671 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7672 | } |
| 7673 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7674 | /* |
| 7675 | * generic initialization of ADC, input mixers and output mixers |
| 7676 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7677 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7678 | /* |
| 7679 | * Unmute ADC0-2 and set the default input to mic-in |
| 7680 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7681 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7682 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7683 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7684 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7685 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7686 | /* 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] | 7687 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7688 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7689 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7690 | */ |
| 7691 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7692 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7693 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7694 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7695 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7696 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7697 | |
| 7698 | /* |
| 7699 | * Set up output mixers (0x0c - 0x0f) |
| 7700 | */ |
| 7701 | /* set vol=0 to output mixers */ |
| 7702 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7703 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7704 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7705 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7706 | /* set up input amps for analog loopback */ |
| 7707 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7708 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7709 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7710 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7711 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7712 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7713 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7714 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7715 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7716 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7717 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7718 | |
| 7719 | /* FIXME: use matrix-type input source selection */ |
| 7720 | /* 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] | 7721 | /* Input mixer2 */ |
| 7722 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7723 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7724 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7725 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7726 | /* Input mixer3 */ |
| 7727 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7728 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7729 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7730 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7731 | |
| 7732 | { } |
| 7733 | }; |
| 7734 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7735 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7736 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7737 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7738 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7739 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7740 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7741 | { } /* end */ |
| 7742 | }; |
| 7743 | |
| 7744 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7745 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7746 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7747 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7748 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7749 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7750 | { } /* end */ |
| 7751 | }; |
| 7752 | |
| 7753 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7754 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7755 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7756 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7757 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7758 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7759 | { } /* end */ |
| 7760 | }; |
| 7761 | |
| 7762 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7763 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7764 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7765 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7766 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7767 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7768 | { } /* end */ |
| 7769 | }; |
| 7770 | |
| 7771 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7772 | { 2, alc889A_mb31_ch2_init }, |
| 7773 | { 4, alc889A_mb31_ch4_init }, |
| 7774 | { 5, alc889A_mb31_ch5_init }, |
| 7775 | { 6, alc889A_mb31_ch6_init }, |
| 7776 | }; |
| 7777 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7778 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7779 | /* eanable EAPD on medion laptop */ |
| 7780 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7781 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7782 | { } |
| 7783 | }; |
| 7784 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7785 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7786 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7787 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7788 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7789 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7790 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7791 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7792 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7793 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7794 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7795 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7796 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7798 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7799 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7800 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7801 | { } /* end */ |
| 7802 | }; |
| 7803 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7804 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7805 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7806 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7807 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7808 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7809 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7810 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7811 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7812 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7813 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7814 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7815 | { } /* end */ |
| 7816 | }; |
| 7817 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7818 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7819 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7820 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7821 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7822 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7823 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7824 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7825 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7826 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7827 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7828 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7829 | { } /* end */ |
| 7830 | }; |
| 7831 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7832 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7833 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7834 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7835 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7836 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7837 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7838 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7839 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7840 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7841 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7842 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7843 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7844 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7845 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7846 | { } /* end */ |
| 7847 | }; |
| 7848 | |
| 7849 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7850 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7851 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7852 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7853 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7854 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7855 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7856 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7857 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7858 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7859 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7860 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7861 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7862 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7863 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7864 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7865 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7866 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7867 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7868 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7869 | { } /* end */ |
| 7870 | }; |
| 7871 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7872 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7873 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7874 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7875 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7876 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7877 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7878 | HDA_OUTPUT), |
| 7879 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7880 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7881 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7882 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7886 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7887 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7888 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7889 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7890 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7891 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7892 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7893 | { } /* end */ |
| 7894 | }; |
| 7895 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7896 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 7897 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7898 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7899 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7900 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7901 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7902 | HDA_OUTPUT), |
| 7903 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7904 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7905 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7906 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7907 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7908 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7909 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7910 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7911 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 7912 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 7913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 7914 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7915 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7916 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7917 | { } /* end */ |
| 7918 | }; |
| 7919 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7920 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7921 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7922 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7923 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7924 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7925 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7926 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7927 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7928 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7929 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7930 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7931 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7932 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7933 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7934 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7935 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7936 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7937 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7938 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7939 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7940 | { } /* end */ |
| 7941 | }; |
| 7942 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7943 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7944 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 7945 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7946 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 7947 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7948 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7949 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7950 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7951 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7952 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7953 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7954 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7955 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7956 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7957 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7958 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7959 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7960 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7961 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7962 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7963 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7964 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7965 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 7966 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7967 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 7968 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7969 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7970 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7971 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7972 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7973 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7974 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7975 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7976 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7977 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7978 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7979 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 7980 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 7981 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7982 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7983 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7984 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7985 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7986 | { } /* end */ |
| 7987 | }; |
| 7988 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7989 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7990 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7991 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7992 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7993 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7994 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7995 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7996 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7997 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7998 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7999 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8000 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8001 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8002 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8003 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8004 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8005 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8006 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8007 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8008 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8009 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8010 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8011 | { } /* end */ |
| 8012 | }; |
| 8013 | |
| 8014 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8015 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8016 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8017 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8018 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8019 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8022 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8023 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8024 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8025 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8026 | |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8027 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8028 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8029 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8030 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8031 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8032 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8033 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8034 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8035 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8036 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8037 | }; |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8038 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8039 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8040 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8041 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8042 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8043 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8044 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8045 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8046 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8047 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8048 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8049 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8050 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8051 | { } /* end */ |
| 8052 | }; |
| 8053 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8054 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8055 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8056 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8057 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8058 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8059 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8060 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8061 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8062 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8063 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8064 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8065 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8066 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8067 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8068 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8069 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8070 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8071 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8072 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8073 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8074 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8075 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8076 | { } /* end */ |
| 8077 | }; |
| 8078 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8079 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8080 | /* Output mixers */ |
| 8081 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8082 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8083 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8084 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8085 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8086 | HDA_OUTPUT), |
| 8087 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8088 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8089 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8090 | /* Output switches */ |
| 8091 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8092 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8093 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8094 | /* Boost mixers */ |
| 8095 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8096 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8097 | /* Input mixers */ |
| 8098 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8099 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8100 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8101 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8102 | { } /* end */ |
| 8103 | }; |
| 8104 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8105 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8106 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8107 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8108 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8109 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8110 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8111 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8112 | { } /* end */ |
| 8113 | }; |
| 8114 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8115 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8116 | .ops = &snd_hda_bind_vol, |
| 8117 | .values = { |
| 8118 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8119 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8120 | 0 |
| 8121 | }, |
| 8122 | }; |
| 8123 | |
| 8124 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8125 | .ops = &snd_hda_bind_sw, |
| 8126 | .values = { |
| 8127 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8128 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8129 | 0 |
| 8130 | }, |
| 8131 | }; |
| 8132 | |
| 8133 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8134 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8135 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8136 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8137 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8138 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8139 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8140 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8141 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8142 | { } /* end */ |
| 8143 | }; |
| 8144 | |
| 8145 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8146 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8147 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8148 | { |
| 8149 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8150 | /* .name = "Capture Source", */ |
| 8151 | .name = "Input Source", |
| 8152 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8153 | .info = alc_mux_enum_info, |
| 8154 | .get = alc_mux_enum_get, |
| 8155 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8156 | }, |
| 8157 | { } /* end */ |
| 8158 | }; |
| 8159 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8160 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8161 | { |
| 8162 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8163 | .name = "Channel Mode", |
| 8164 | .info = alc_ch_mode_info, |
| 8165 | .get = alc_ch_mode_get, |
| 8166 | .put = alc_ch_mode_put, |
| 8167 | }, |
| 8168 | { } /* end */ |
| 8169 | }; |
| 8170 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8171 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8172 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8173 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8174 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8175 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8176 | spec->autocfg.hp_pins[0] = 0x15; |
| 8177 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8178 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8179 | } |
| 8180 | |
| 8181 | /* auto-toggle front mic */ |
| 8182 | /* |
| 8183 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8184 | { |
| 8185 | unsigned int present; |
| 8186 | unsigned char bits; |
| 8187 | |
| 8188 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8189 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8190 | bits = present ? HDA_AMP_MUTE : 0; |
| 8191 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8192 | } |
| 8193 | */ |
| 8194 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8195 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8196 | /* HP */ |
| 8197 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8198 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8199 | /* Subwoofer */ |
| 8200 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8201 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8202 | |
| 8203 | /* enable unsolicited event */ |
| 8204 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8205 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8206 | |
| 8207 | { } /* end */ |
| 8208 | }; |
| 8209 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8210 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8211 | /* HP */ |
| 8212 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8213 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8214 | /* Int speaker */ |
| 8215 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8216 | |
| 8217 | /* enable unsolicited event */ |
| 8218 | /* |
| 8219 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8220 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8221 | */ |
| 8222 | |
| 8223 | { } /* end */ |
| 8224 | }; |
| 8225 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8226 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8227 | /* HP */ |
| 8228 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8229 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8230 | /* Int speaker */ |
| 8231 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8232 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8233 | |
| 8234 | /* enable unsolicited event */ |
| 8235 | {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] | 8236 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8237 | |
| 8238 | { } /* end */ |
| 8239 | }; |
| 8240 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8241 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8242 | /* HP */ |
| 8243 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8244 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8245 | /* Subwoofer */ |
| 8246 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8248 | |
| 8249 | /* enable unsolicited event */ |
| 8250 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8251 | |
| 8252 | { } /* end */ |
| 8253 | }; |
| 8254 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8255 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8256 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8257 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8258 | |
| 8259 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8260 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8261 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8262 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8263 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8264 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8265 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8266 | /* Connect Mic jack to CLFE */ |
| 8267 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8268 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8269 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8270 | /* Connect Line-in jack to Surround */ |
| 8271 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8272 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8273 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8274 | /* Connect HP out jack to Front */ |
| 8275 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8276 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8277 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8278 | |
| 8279 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8280 | |
| 8281 | { } /* end */ |
| 8282 | }; |
| 8283 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8284 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8285 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8286 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8287 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8288 | { } /* end */ |
| 8289 | }; |
| 8290 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8291 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8292 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8293 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8294 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8295 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8296 | { } /* end */ |
| 8297 | }; |
| 8298 | |
| 8299 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8300 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8301 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8302 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8303 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8304 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8305 | { } /* end */ |
| 8306 | }; |
| 8307 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8308 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8309 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8310 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8311 | |
| 8312 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8313 | |
| 8314 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8315 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8316 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8317 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8318 | { } /* end */ |
| 8319 | }; |
| 8320 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8321 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8322 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8323 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8324 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8325 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8326 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8327 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8328 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8329 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8330 | { } /* end */ |
| 8331 | }; |
| 8332 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8333 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8334 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8335 | { } |
| 8336 | }; |
| 8337 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8338 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8339 | /* HP */ |
| 8340 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8341 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8342 | |
| 8343 | /* enable unsolicited event */ |
| 8344 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8345 | |
| 8346 | { } /* end */ |
| 8347 | }; |
| 8348 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8349 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8350 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8351 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8352 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8353 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8354 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8355 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8356 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8357 | } |
| 8358 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8359 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8360 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8361 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8362 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8363 | {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] | 8364 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8365 | }; |
| 8366 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8367 | /* |
| 8368 | * 2ch mode |
| 8369 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8370 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8371 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8372 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8373 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8374 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8375 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8376 | }; |
| 8377 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8378 | /* |
| 8379 | * 4ch mode |
| 8380 | */ |
| 8381 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8382 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8383 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8384 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8385 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8386 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8387 | { } /* end */ |
| 8388 | }; |
| 8389 | |
| 8390 | /* |
| 8391 | * 6ch mode |
| 8392 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8393 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8394 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8395 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8396 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8397 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8398 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8399 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8400 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8401 | }; |
| 8402 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8403 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8404 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8405 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8406 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8407 | }; |
| 8408 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8409 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8410 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8411 | { |
| 8412 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8413 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8414 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8415 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8416 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8417 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8418 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8419 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8420 | } |
| 8421 | |
| 8422 | /* toggle RCA according to the front-jack state */ |
| 8423 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8424 | { |
| 8425 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8426 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8427 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8428 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8429 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8430 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8431 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8432 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8433 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8434 | unsigned int res) |
| 8435 | { |
| 8436 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8437 | alc888_lenovo_ms7195_front_automute(codec); |
| 8438 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8439 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8440 | } |
| 8441 | |
| 8442 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8443 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8444 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8445 | |
| 8446 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8447 | |
| 8448 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8449 | { } /* end */ |
| 8450 | }; |
| 8451 | |
| 8452 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8453 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8454 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8455 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8456 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8457 | spec->autocfg.hp_pins[0] = 0x14; |
| 8458 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8459 | } |
| 8460 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8461 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8462 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8463 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8464 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8465 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8466 | { |
| 8467 | unsigned int present; |
| 8468 | |
| 8469 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8470 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8471 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8472 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8473 | } |
| 8474 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8475 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8476 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8477 | struct alc_spec *spec = codec->spec; |
| 8478 | |
| 8479 | spec->autocfg.hp_pins[0] = 0x15; |
| 8480 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8481 | } |
| 8482 | |
| 8483 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 8484 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8485 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8486 | alc883_clevo_m720_mic_automute(codec); |
| 8487 | } |
| 8488 | |
| 8489 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8490 | unsigned int res) |
| 8491 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8492 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8493 | case ALC880_MIC_EVENT: |
| 8494 | alc883_clevo_m720_mic_automute(codec); |
| 8495 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8496 | default: |
| 8497 | alc_automute_amp_unsol_event(codec, res); |
| 8498 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8499 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8500 | } |
| 8501 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8502 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8503 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8504 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8505 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8506 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8507 | spec->autocfg.hp_pins[0] = 0x14; |
| 8508 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8509 | } |
| 8510 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8511 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8512 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8513 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8514 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8515 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8516 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8517 | } |
| 8518 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8519 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8520 | { |
| 8521 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8522 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8523 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8524 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8525 | & AC_PINSENSE_PRESENCE; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8526 | bits = present ? HDA_AMP_MUTE : 0; |
| 8527 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8528 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8529 | } |
| 8530 | |
| 8531 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8532 | { |
| 8533 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8534 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8535 | |
| 8536 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8537 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8538 | bits = present ? HDA_AMP_MUTE : 0; |
| 8539 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8540 | HDA_AMP_MUTE, bits); |
| 8541 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8542 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8543 | } |
| 8544 | |
| 8545 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8546 | unsigned int res) |
| 8547 | { |
| 8548 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8549 | alc883_lenovo_101e_all_automute(codec); |
| 8550 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8551 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8552 | } |
| 8553 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8554 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8555 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8556 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8557 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8558 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8559 | spec->autocfg.hp_pins[0] = 0x14; |
| 8560 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8561 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8562 | } |
| 8563 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8564 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8565 | /* HP Pin: output 0 (0x0c) */ |
| 8566 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8567 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8568 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8569 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8570 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8571 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8572 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8573 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8574 | /* eanable EAPD on medion laptop */ |
| 8575 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8576 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8577 | /* enable unsolicited event */ |
| 8578 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8579 | { } |
| 8580 | }; |
| 8581 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8582 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 8583 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8584 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8585 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8586 | { } /* end */ |
| 8587 | }; |
| 8588 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8589 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8590 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8591 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8592 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8593 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8594 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8595 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8596 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8597 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8598 | } |
| 8599 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8600 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8601 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8602 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8603 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8604 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8605 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8606 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8607 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8608 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8609 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8610 | } |
| 8611 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8612 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8613 | { |
| 8614 | struct alc_spec *spec = codec->spec; |
| 8615 | |
| 8616 | spec->autocfg.hp_pins[0] = 0x15; |
| 8617 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8618 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8619 | } |
| 8620 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8621 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8622 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8623 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8624 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8625 | /* enable unsolicited event */ |
| 8626 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8627 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8628 | { } /* end */ |
| 8629 | }; |
| 8630 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8631 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8632 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8633 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8634 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8635 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8636 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8637 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8638 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8639 | spec->ext_mic.pin = 0x18; |
| 8640 | spec->int_mic.pin = 0x19; |
| 8641 | spec->ext_mic.mux_idx = 0; |
| 8642 | spec->int_mic.mux_idx = 1; |
| 8643 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8644 | } |
| 8645 | |
| 8646 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8647 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8648 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8649 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8650 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8651 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8652 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8653 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8654 | /* enable unsolicited event */ |
| 8655 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8656 | { } /* end */ |
| 8657 | }; |
| 8658 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8659 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8660 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8661 | struct alc_spec *spec = codec->spec; |
| 8662 | |
| 8663 | spec->autocfg.hp_pins[0] = 0x14; |
| 8664 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8665 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8666 | } |
| 8667 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8668 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8669 | /* Init rear pin (used as headphone output) */ |
| 8670 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8671 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8672 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8673 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8674 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8675 | /* Init line 2 pin (used as headphone out by default) */ |
| 8676 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8677 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8678 | { } /* end */ |
| 8679 | }; |
| 8680 | |
| 8681 | /* Mute speakers according to the headphone jack state */ |
| 8682 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8683 | { |
| 8684 | unsigned int present; |
| 8685 | |
| 8686 | /* Mute only in 2ch or 4ch mode */ |
| 8687 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8688 | == 0x00) { |
| 8689 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8690 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 8691 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8692 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8693 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8694 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8695 | } |
| 8696 | } |
| 8697 | |
| 8698 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8699 | { |
| 8700 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8701 | alc889A_mb31_automute(codec); |
| 8702 | } |
| 8703 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8704 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8705 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8706 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8707 | #endif |
| 8708 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8709 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8710 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8711 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8712 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8713 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8714 | |
| 8715 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8716 | ALC1200_DIGOUT_NID, 0, |
| 8717 | }; |
| 8718 | |
| 8719 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8720 | ALC883_DIGOUT_NID, 0, |
| 8721 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8722 | |
| 8723 | /* |
| 8724 | * configuration and preset |
| 8725 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8726 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 8727 | [ALC882_3ST_DIG] = "3stack-dig", |
| 8728 | [ALC882_6ST_DIG] = "6stack-dig", |
| 8729 | [ALC882_ARIMA] = "arima", |
| 8730 | [ALC882_W2JC] = "w2jc", |
| 8731 | [ALC882_TARGA] = "targa", |
| 8732 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 8733 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 8734 | [ALC885_MACPRO] = "macpro", |
| 8735 | [ALC885_MB5] = "mb5", |
| 8736 | [ALC885_MBP3] = "mbp3", |
| 8737 | [ALC885_IMAC24] = "imac24", |
| 8738 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8739 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8740 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8741 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8742 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8743 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8744 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8745 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8746 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8747 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 8748 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8749 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8750 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8751 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8752 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8753 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8754 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8755 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8756 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8757 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8758 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8759 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8760 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8761 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8762 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8763 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8764 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8765 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8766 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8767 | [ALC889A_INTEL] = "intel-alc889a", |
| 8768 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8769 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8770 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8771 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8772 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8773 | }; |
| 8774 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8775 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 8776 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 8777 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8778 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8779 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8780 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8781 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8782 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8783 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8784 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8785 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8786 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8787 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8788 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 8789 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 8790 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 8791 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8792 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 8793 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8794 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 8795 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8796 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8797 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8798 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 8799 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8800 | /* default Acer -- disabled as it causes more problems. |
| 8801 | * model=auto should work fine now |
| 8802 | */ |
| 8803 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8804 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8805 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8806 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8807 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8808 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8809 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8810 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8811 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8812 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8813 | |
| 8814 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 8815 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 8816 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8817 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8818 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 8819 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 8820 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8821 | 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] | 8822 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8823 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8824 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8825 | |
| 8826 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8827 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8828 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8829 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8830 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8831 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8832 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8833 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8834 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 8835 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8836 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8837 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8838 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8839 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8840 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8841 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8842 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8843 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8844 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8845 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8846 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8847 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8848 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8849 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8850 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8851 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8852 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8853 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8854 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8855 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8856 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8857 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8858 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8859 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8860 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8861 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 8862 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8863 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8864 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8865 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8866 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8867 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8868 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8869 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8870 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8871 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8872 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8873 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8874 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8875 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8876 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8877 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8878 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8879 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8880 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8881 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8882 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8883 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8884 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8885 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8886 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8887 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8888 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8889 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8890 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8891 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 8892 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 8893 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8894 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8895 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8896 | {} |
| 8897 | }; |
| 8898 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8899 | /* codec SSID table for Intel Mac */ |
| 8900 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 8901 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 8902 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 8903 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 8904 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 8905 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 8906 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 8907 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 8908 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 8909 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 8910 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
| 8911 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
| 8912 | /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently |
| 8913 | * no perfect solution yet |
| 8914 | */ |
| 8915 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
| 8916 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8917 | }; |
| 8918 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8919 | static struct alc_config_preset alc882_presets[] = { |
| 8920 | [ALC882_3ST_DIG] = { |
| 8921 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8922 | .init_verbs = { alc882_base_init_verbs, |
| 8923 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8924 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8925 | .dac_nids = alc882_dac_nids, |
| 8926 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8927 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8928 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8929 | .channel_mode = alc882_ch_modes, |
| 8930 | .need_dac_fix = 1, |
| 8931 | .input_mux = &alc882_capture_source, |
| 8932 | }, |
| 8933 | [ALC882_6ST_DIG] = { |
| 8934 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8935 | .init_verbs = { alc882_base_init_verbs, |
| 8936 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8937 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8938 | .dac_nids = alc882_dac_nids, |
| 8939 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8940 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8941 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8942 | .channel_mode = alc882_sixstack_modes, |
| 8943 | .input_mux = &alc882_capture_source, |
| 8944 | }, |
| 8945 | [ALC882_ARIMA] = { |
| 8946 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8947 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8948 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8949 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8950 | .dac_nids = alc882_dac_nids, |
| 8951 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8952 | .channel_mode = alc882_sixstack_modes, |
| 8953 | .input_mux = &alc882_capture_source, |
| 8954 | }, |
| 8955 | [ALC882_W2JC] = { |
| 8956 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8957 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8958 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8959 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8960 | .dac_nids = alc882_dac_nids, |
| 8961 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8962 | .channel_mode = alc880_threestack_modes, |
| 8963 | .need_dac_fix = 1, |
| 8964 | .input_mux = &alc882_capture_source, |
| 8965 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8966 | }, |
| 8967 | [ALC885_MBP3] = { |
| 8968 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 8969 | .init_verbs = { alc885_mbp3_init_verbs, |
| 8970 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 8971 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8972 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 8973 | .hp_nid = 0x04, |
| 8974 | .channel_mode = alc885_mbp_4ch_modes, |
| 8975 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8976 | .input_mux = &alc882_capture_source, |
| 8977 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8978 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8979 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8980 | .setup = alc885_mbp3_setup, |
| 8981 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8982 | }, |
| 8983 | [ALC885_MB5] = { |
| 8984 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 8985 | .init_verbs = { alc885_mb5_init_verbs, |
| 8986 | alc880_gpio1_init_verbs }, |
| 8987 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8988 | .dac_nids = alc882_dac_nids, |
| 8989 | .channel_mode = alc885_mb5_6ch_modes, |
| 8990 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 8991 | .input_mux = &mb5_capture_source, |
| 8992 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8993 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8994 | }, |
| 8995 | [ALC885_MACPRO] = { |
| 8996 | .mixers = { alc882_macpro_mixer }, |
| 8997 | .init_verbs = { alc882_macpro_init_verbs }, |
| 8998 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8999 | .dac_nids = alc882_dac_nids, |
| 9000 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9001 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9002 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9003 | .channel_mode = alc882_ch_modes, |
| 9004 | .input_mux = &alc882_capture_source, |
| 9005 | .init_hook = alc885_macpro_init_hook, |
| 9006 | }, |
| 9007 | [ALC885_IMAC24] = { |
| 9008 | .mixers = { alc885_imac24_mixer }, |
| 9009 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9010 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9011 | .dac_nids = alc882_dac_nids, |
| 9012 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9013 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9014 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9015 | .channel_mode = alc882_ch_modes, |
| 9016 | .input_mux = &alc882_capture_source, |
| 9017 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9018 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9019 | .init_hook = alc885_imac24_init_hook, |
| 9020 | }, |
| 9021 | [ALC882_TARGA] = { |
| 9022 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9023 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9024 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9025 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9026 | .dac_nids = alc882_dac_nids, |
| 9027 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9028 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9029 | .adc_nids = alc882_adc_nids, |
| 9030 | .capsrc_nids = alc882_capsrc_nids, |
| 9031 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9032 | .channel_mode = alc882_3ST_6ch_modes, |
| 9033 | .need_dac_fix = 1, |
| 9034 | .input_mux = &alc882_capture_source, |
| 9035 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9036 | .setup = alc882_targa_setup, |
| 9037 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9038 | }, |
| 9039 | [ALC882_ASUS_A7J] = { |
| 9040 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9041 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9042 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9043 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9044 | .dac_nids = alc882_dac_nids, |
| 9045 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9046 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9047 | .adc_nids = alc882_adc_nids, |
| 9048 | .capsrc_nids = alc882_capsrc_nids, |
| 9049 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9050 | .channel_mode = alc882_3ST_6ch_modes, |
| 9051 | .need_dac_fix = 1, |
| 9052 | .input_mux = &alc882_capture_source, |
| 9053 | }, |
| 9054 | [ALC882_ASUS_A7M] = { |
| 9055 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9056 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9057 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9058 | alc882_asus_a7m_verbs }, |
| 9059 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9060 | .dac_nids = alc882_dac_nids, |
| 9061 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9062 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9063 | .channel_mode = alc880_threestack_modes, |
| 9064 | .need_dac_fix = 1, |
| 9065 | .input_mux = &alc882_capture_source, |
| 9066 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9067 | [ALC883_3ST_2ch_DIG] = { |
| 9068 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9069 | .init_verbs = { alc883_init_verbs }, |
| 9070 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9071 | .dac_nids = alc883_dac_nids, |
| 9072 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9073 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9074 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9075 | .channel_mode = alc883_3ST_2ch_modes, |
| 9076 | .input_mux = &alc883_capture_source, |
| 9077 | }, |
| 9078 | [ALC883_3ST_6ch_DIG] = { |
| 9079 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9080 | .init_verbs = { alc883_init_verbs }, |
| 9081 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9082 | .dac_nids = alc883_dac_nids, |
| 9083 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9084 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9085 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9086 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9087 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9088 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9089 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9090 | [ALC883_3ST_6ch] = { |
| 9091 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9092 | .init_verbs = { alc883_init_verbs }, |
| 9093 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9094 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9095 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9096 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9097 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9098 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9099 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9100 | [ALC883_3ST_6ch_INTEL] = { |
| 9101 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9102 | .init_verbs = { alc883_init_verbs }, |
| 9103 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9104 | .dac_nids = alc883_dac_nids, |
| 9105 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9106 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9107 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9108 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9109 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9110 | .need_dac_fix = 1, |
| 9111 | .input_mux = &alc883_3stack_6ch_intel, |
| 9112 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9113 | [ALC889A_INTEL] = { |
| 9114 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9115 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9116 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9117 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9118 | .dac_nids = alc883_dac_nids, |
| 9119 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9120 | .adc_nids = alc889_adc_nids, |
| 9121 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9122 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9123 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9124 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9125 | .channel_mode = alc889_8ch_intel_modes, |
| 9126 | .capsrc_nids = alc889_capsrc_nids, |
| 9127 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9128 | .setup = alc889_automute_setup, |
| 9129 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9130 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9131 | .need_dac_fix = 1, |
| 9132 | }, |
| 9133 | [ALC889_INTEL] = { |
| 9134 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9135 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9136 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9137 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9138 | .dac_nids = alc883_dac_nids, |
| 9139 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9140 | .adc_nids = alc889_adc_nids, |
| 9141 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9142 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9143 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9144 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9145 | .channel_mode = alc889_8ch_intel_modes, |
| 9146 | .capsrc_nids = alc889_capsrc_nids, |
| 9147 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9148 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9149 | .init_hook = alc889_intel_init_hook, |
| 9150 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9151 | .need_dac_fix = 1, |
| 9152 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9153 | [ALC883_6ST_DIG] = { |
| 9154 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9155 | .init_verbs = { alc883_init_verbs }, |
| 9156 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9157 | .dac_nids = alc883_dac_nids, |
| 9158 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9159 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9160 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9161 | .channel_mode = alc883_sixstack_modes, |
| 9162 | .input_mux = &alc883_capture_source, |
| 9163 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9164 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9165 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9166 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9167 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9168 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9169 | .dac_nids = alc883_dac_nids, |
| 9170 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9171 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9172 | .channel_mode = alc883_3ST_6ch_modes, |
| 9173 | .need_dac_fix = 1, |
| 9174 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9175 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9176 | .setup = alc882_targa_setup, |
| 9177 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9178 | }, |
| 9179 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9180 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9181 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9182 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9183 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9184 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9185 | .adc_nids = alc883_adc_nids_alt, |
| 9186 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9187 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9188 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9189 | .channel_mode = alc883_3ST_2ch_modes, |
| 9190 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9191 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9192 | .setup = alc882_targa_setup, |
| 9193 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9194 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9195 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9196 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 9197 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9198 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9199 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9200 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9201 | .dac_nids = alc883_dac_nids, |
| 9202 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9203 | .adc_nids = alc883_adc_nids_rev, |
| 9204 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9205 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9206 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9207 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9208 | .channel_mode = alc883_4ST_8ch_modes, |
| 9209 | .need_dac_fix = 1, |
| 9210 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9211 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9212 | .setup = alc882_targa_setup, |
| 9213 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9214 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9215 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9216 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9217 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9218 | * and the headphone jack. Turn this on and rely on the |
| 9219 | * standard mute methods whenever the user wants to turn |
| 9220 | * these outputs off. |
| 9221 | */ |
| 9222 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9223 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9224 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9225 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9226 | .channel_mode = alc883_3ST_2ch_modes, |
| 9227 | .input_mux = &alc883_capture_source, |
| 9228 | }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9229 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9230 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9231 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9232 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9233 | .dac_nids = alc883_dac_nids, |
| 9234 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9235 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9236 | .channel_mode = alc883_3ST_2ch_modes, |
| 9237 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9238 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9239 | .setup = alc883_acer_aspire_setup, |
| 9240 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9241 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9242 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9243 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9244 | alc883_chmode_mixer }, |
| 9245 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9246 | alc888_acer_aspire_4930g_verbs }, |
| 9247 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9248 | .dac_nids = alc883_dac_nids, |
| 9249 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9250 | .adc_nids = alc883_adc_nids_rev, |
| 9251 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9252 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9253 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9254 | .channel_mode = alc883_3ST_6ch_modes, |
| 9255 | .need_dac_fix = 1, |
| 9256 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9257 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9258 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9259 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9260 | .setup = alc888_acer_aspire_4930g_setup, |
| 9261 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9262 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9263 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9264 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9265 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9266 | alc888_acer_aspire_6530g_verbs }, |
| 9267 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9268 | .dac_nids = alc883_dac_nids, |
| 9269 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9270 | .adc_nids = alc883_adc_nids_rev, |
| 9271 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9272 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9273 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9274 | .channel_mode = alc883_3ST_2ch_modes, |
| 9275 | .num_mux_defs = |
| 9276 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9277 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9278 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9279 | .setup = alc888_acer_aspire_6530g_setup, |
| 9280 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9281 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9282 | [ALC888_ACER_ASPIRE_8930G] = { |
| 9283 | .mixers = { alc888_base_mixer, |
| 9284 | alc883_chmode_mixer }, |
| 9285 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9286 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9287 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9288 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9289 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9290 | .adc_nids = alc889_adc_nids, |
| 9291 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9292 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9293 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9294 | .channel_mode = alc883_3ST_6ch_modes, |
| 9295 | .need_dac_fix = 1, |
| 9296 | .const_channel_count = 6, |
| 9297 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9298 | ARRAY_SIZE(alc889_capture_sources), |
| 9299 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9300 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9301 | .setup = alc889_acer_aspire_8930g_setup, |
| 9302 | .init_hook = alc_automute_amp, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9303 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9304 | [ALC888_ACER_ASPIRE_7730G] = { |
| 9305 | .mixers = { alc883_3ST_6ch_mixer, |
| 9306 | alc883_chmode_mixer }, |
| 9307 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9308 | alc888_acer_aspire_7730G_verbs }, |
| 9309 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9310 | .dac_nids = alc883_dac_nids, |
| 9311 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9312 | .adc_nids = alc883_adc_nids_rev, |
| 9313 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9314 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9315 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9316 | .channel_mode = alc883_3ST_6ch_modes, |
| 9317 | .need_dac_fix = 1, |
| 9318 | .const_channel_count = 6, |
| 9319 | .input_mux = &alc883_capture_source, |
| 9320 | .unsol_event = alc_automute_amp_unsol_event, |
| 9321 | .setup = alc888_acer_aspire_6530g_setup, |
| 9322 | .init_hook = alc_automute_amp, |
| 9323 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9324 | [ALC883_MEDION] = { |
| 9325 | .mixers = { alc883_fivestack_mixer, |
| 9326 | alc883_chmode_mixer }, |
| 9327 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9328 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9329 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9330 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9331 | .adc_nids = alc883_adc_nids_alt, |
| 9332 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9333 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9334 | .channel_mode = alc883_sixstack_modes, |
| 9335 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9336 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9337 | [ALC883_MEDION_MD2] = { |
| 9338 | .mixers = { alc883_medion_md2_mixer}, |
| 9339 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9340 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9341 | .dac_nids = alc883_dac_nids, |
| 9342 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9343 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9344 | .channel_mode = alc883_3ST_2ch_modes, |
| 9345 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9346 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9347 | .setup = alc883_medion_md2_setup, |
| 9348 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9349 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9350 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9351 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9352 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9353 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9354 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9355 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9356 | .channel_mode = alc883_3ST_2ch_modes, |
| 9357 | .input_mux = &alc883_capture_source, |
| 9358 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9359 | [ALC883_CLEVO_M540R] = { |
| 9360 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9361 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 9362 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9363 | .dac_nids = alc883_dac_nids, |
| 9364 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9365 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9366 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 9367 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 9368 | .need_dac_fix = 1, |
| 9369 | .input_mux = &alc883_capture_source, |
| 9370 | /* This machine has the hardware HP auto-muting, thus |
| 9371 | * we need no software mute via unsol event |
| 9372 | */ |
| 9373 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9374 | [ALC883_CLEVO_M720] = { |
| 9375 | .mixers = { alc883_clevo_m720_mixer }, |
| 9376 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9377 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9378 | .dac_nids = alc883_dac_nids, |
| 9379 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9380 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9381 | .channel_mode = alc883_3ST_2ch_modes, |
| 9382 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9383 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9384 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9385 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9386 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9387 | [ALC883_LENOVO_101E_2ch] = { |
| 9388 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9389 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9390 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9391 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9392 | .adc_nids = alc883_adc_nids_alt, |
| 9393 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9394 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9395 | .channel_mode = alc883_3ST_2ch_modes, |
| 9396 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9397 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9398 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9399 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9400 | [ALC883_LENOVO_NB0763] = { |
| 9401 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9402 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9403 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9404 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9405 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9406 | .channel_mode = alc883_3ST_2ch_modes, |
| 9407 | .need_dac_fix = 1, |
| 9408 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9409 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9410 | .setup = alc883_medion_md2_setup, |
| 9411 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9412 | }, |
| 9413 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9414 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9415 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9416 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9417 | .dac_nids = alc883_dac_nids, |
| 9418 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9419 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9420 | .channel_mode = alc883_3ST_6ch_modes, |
| 9421 | .need_dac_fix = 1, |
| 9422 | .input_mux = &alc883_capture_source, |
| 9423 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9424 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9425 | }, |
| 9426 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9427 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9428 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9429 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9430 | .dac_nids = alc883_dac_nids, |
| 9431 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9432 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9433 | .channel_mode = alc883_3ST_2ch_modes, |
| 9434 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9435 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9436 | .setup = alc883_haier_w66_setup, |
| 9437 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9438 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9439 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9440 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9441 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9442 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9443 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9444 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9445 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9446 | .need_dac_fix = 1, |
| 9447 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9448 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9449 | .setup = alc888_3st_hp_setup, |
| 9450 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9451 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9452 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9453 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9454 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9455 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9456 | .dac_nids = alc883_dac_nids, |
| 9457 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9458 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9459 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9460 | .channel_mode = alc883_sixstack_modes, |
| 9461 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9462 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9463 | .setup = alc888_6st_dell_setup, |
| 9464 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9465 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9466 | [ALC883_MITAC] = { |
| 9467 | .mixers = { alc883_mitac_mixer }, |
| 9468 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9469 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9470 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9471 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9472 | .channel_mode = alc883_3ST_2ch_modes, |
| 9473 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9474 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9475 | .setup = alc883_mitac_setup, |
| 9476 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9477 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9478 | [ALC883_FUJITSU_PI2515] = { |
| 9479 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9480 | .init_verbs = { alc883_init_verbs, |
| 9481 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9482 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9483 | .dac_nids = alc883_dac_nids, |
| 9484 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9485 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9486 | .channel_mode = alc883_3ST_2ch_modes, |
| 9487 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9488 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9489 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 9490 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9491 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9492 | [ALC888_FUJITSU_XA3530] = { |
| 9493 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9494 | .init_verbs = { alc883_init_verbs, |
| 9495 | alc888_fujitsu_xa3530_verbs }, |
| 9496 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9497 | .dac_nids = alc883_dac_nids, |
| 9498 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9499 | .adc_nids = alc883_adc_nids_rev, |
| 9500 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9501 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9502 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9503 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9504 | .num_mux_defs = |
| 9505 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9506 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9507 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9508 | .setup = alc888_fujitsu_xa3530_setup, |
| 9509 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9510 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9511 | [ALC888_LENOVO_SKY] = { |
| 9512 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9513 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9514 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9515 | .dac_nids = alc883_dac_nids, |
| 9516 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9517 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9518 | .channel_mode = alc883_sixstack_modes, |
| 9519 | .need_dac_fix = 1, |
| 9520 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9521 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9522 | .setup = alc888_lenovo_sky_setup, |
| 9523 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9524 | }, |
| 9525 | [ALC888_ASUS_M90V] = { |
| 9526 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9527 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9528 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9529 | .dac_nids = alc883_dac_nids, |
| 9530 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9531 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9532 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9533 | .channel_mode = alc883_3ST_6ch_modes, |
| 9534 | .need_dac_fix = 1, |
| 9535 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9536 | .unsol_event = alc_sku_unsol_event, |
| 9537 | .setup = alc883_mode2_setup, |
| 9538 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9539 | }, |
| 9540 | [ALC888_ASUS_EEE1601] = { |
| 9541 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9542 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9543 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9544 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9545 | .dac_nids = alc883_dac_nids, |
| 9546 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9547 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9548 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9549 | .channel_mode = alc883_3ST_2ch_modes, |
| 9550 | .need_dac_fix = 1, |
| 9551 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9552 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9553 | .init_hook = alc883_eee1601_inithook, |
| 9554 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9555 | [ALC1200_ASUS_P5Q] = { |
| 9556 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9557 | .init_verbs = { alc883_init_verbs }, |
| 9558 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9559 | .dac_nids = alc883_dac_nids, |
| 9560 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9561 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9562 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9563 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9564 | .channel_mode = alc883_sixstack_modes, |
| 9565 | .input_mux = &alc883_capture_source, |
| 9566 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9567 | [ALC889A_MB31] = { |
| 9568 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9569 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9570 | alc880_gpio1_init_verbs }, |
| 9571 | .adc_nids = alc883_adc_nids, |
| 9572 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9573 | .dac_nids = alc883_dac_nids, |
| 9574 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9575 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9576 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9577 | .input_mux = &alc889A_mb31_capture_source, |
| 9578 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9579 | .unsol_event = alc889A_mb31_unsol_event, |
| 9580 | .init_hook = alc889A_mb31_automute, |
| 9581 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9582 | [ALC883_SONY_VAIO_TT] = { |
| 9583 | .mixers = { alc883_vaiott_mixer }, |
| 9584 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9585 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9586 | .dac_nids = alc883_dac_nids, |
| 9587 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9588 | .channel_mode = alc883_3ST_2ch_modes, |
| 9589 | .input_mux = &alc883_capture_source, |
| 9590 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9591 | .setup = alc883_vaiott_setup, |
| 9592 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9593 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9594 | }; |
| 9595 | |
| 9596 | |
| 9597 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9598 | * Pin config fixes |
| 9599 | */ |
| 9600 | enum { |
| 9601 | PINFIX_ABIT_AW9D_MAX |
| 9602 | }; |
| 9603 | |
| 9604 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9605 | { 0x15, 0x01080104 }, /* side */ |
| 9606 | { 0x16, 0x01011012 }, /* rear */ |
| 9607 | { 0x17, 0x01016011 }, /* clfe */ |
| 9608 | { } |
| 9609 | }; |
| 9610 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 9611 | static const struct alc_fixup alc882_fixups[] = { |
| 9612 | [PINFIX_ABIT_AW9D_MAX] = { |
| 9613 | .pins = alc882_abit_aw9d_pinfix |
| 9614 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9615 | }; |
| 9616 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 9617 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9618 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9619 | {} |
| 9620 | }; |
| 9621 | |
| 9622 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9623 | * BIOS auto configuration |
| 9624 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9625 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 9626 | const struct auto_pin_cfg *cfg) |
| 9627 | { |
| 9628 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 9629 | } |
| 9630 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9631 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9632 | hda_nid_t nid, int pin_type, |
| 9633 | int dac_idx) |
| 9634 | { |
| 9635 | /* set as output */ |
| 9636 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9637 | int idx; |
| 9638 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9639 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9640 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9641 | idx = 4; |
| 9642 | else |
| 9643 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9644 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9645 | |
| 9646 | } |
| 9647 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9648 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9649 | { |
| 9650 | struct alc_spec *spec = codec->spec; |
| 9651 | int i; |
| 9652 | |
| 9653 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9654 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9655 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9656 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9657 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9658 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9659 | } |
| 9660 | } |
| 9661 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9662 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9663 | { |
| 9664 | struct alc_spec *spec = codec->spec; |
| 9665 | hda_nid_t pin; |
| 9666 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9667 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9668 | if (pin) /* connect to front */ |
| 9669 | /* use dac 0 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9670 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9671 | pin = spec->autocfg.speaker_pins[0]; |
| 9672 | if (pin) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9673 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9674 | } |
| 9675 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9676 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9677 | { |
| 9678 | struct alc_spec *spec = codec->spec; |
| 9679 | int i; |
| 9680 | |
| 9681 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9682 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9683 | if (!nid) |
| 9684 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 9685 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9686 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 9687 | snd_hda_codec_write(codec, nid, 0, |
| 9688 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9689 | AMP_OUT_MUTE); |
| 9690 | } |
| 9691 | } |
| 9692 | |
| 9693 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 9694 | { |
| 9695 | struct alc_spec *spec = codec->spec; |
| 9696 | int c; |
| 9697 | |
| 9698 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 9699 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 9700 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 9701 | unsigned int mux_idx; |
| 9702 | const struct hda_input_mux *imux; |
| 9703 | int conns, mute, idx, item; |
| 9704 | |
| 9705 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 9706 | ARRAY_SIZE(conn_list)); |
| 9707 | if (conns < 0) |
| 9708 | continue; |
| 9709 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 9710 | imux = &spec->input_mux[mux_idx]; |
| 9711 | for (idx = 0; idx < conns; idx++) { |
| 9712 | /* if the current connection is the selected one, |
| 9713 | * unmute it as default - otherwise mute it |
| 9714 | */ |
| 9715 | mute = AMP_IN_MUTE(idx); |
| 9716 | for (item = 0; item < imux->num_items; item++) { |
| 9717 | if (imux->items[item].index == idx) { |
| 9718 | if (spec->cur_mux[c] == item) |
| 9719 | mute = AMP_IN_UNMUTE(idx); |
| 9720 | break; |
| 9721 | } |
| 9722 | } |
| 9723 | /* check if we have a selector or mixer |
| 9724 | * we could check for the widget type instead, but |
| 9725 | * just check for Amp-In presence (in case of mixer |
| 9726 | * without amp-in there is something wrong, this |
| 9727 | * function shouldn't be used or capsrc nid is wrong) |
| 9728 | */ |
| 9729 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9730 | snd_hda_codec_write(codec, nid, 0, |
| 9731 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9732 | mute); |
| 9733 | else if (mute != AMP_IN_MUTE(idx)) |
| 9734 | snd_hda_codec_write(codec, nid, 0, |
| 9735 | AC_VERB_SET_CONNECT_SEL, |
| 9736 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9737 | } |
| 9738 | } |
| 9739 | } |
| 9740 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9741 | /* add mic boosts if needed */ |
| 9742 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9743 | { |
| 9744 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9745 | int err; |
| 9746 | hda_nid_t nid; |
| 9747 | |
| 9748 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 9749 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9750 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9751 | "Mic Boost", |
| 9752 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9753 | if (err < 0) |
| 9754 | return err; |
| 9755 | } |
| 9756 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 9757 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9758 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9759 | "Front Mic Boost", |
| 9760 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9761 | if (err < 0) |
| 9762 | return err; |
| 9763 | } |
| 9764 | return 0; |
| 9765 | } |
| 9766 | |
| 9767 | /* almost identical with ALC880 parser... */ |
| 9768 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 9769 | { |
| 9770 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9771 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 9772 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9773 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9774 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9775 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9776 | if (err < 0) |
| 9777 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9778 | if (!spec->autocfg.line_outs) |
| 9779 | return 0; /* can't find valid BIOS pin config */ |
| 9780 | |
| 9781 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 9782 | if (err < 0) |
| 9783 | return err; |
| 9784 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9785 | if (err < 0) |
| 9786 | return err; |
| 9787 | err = alc880_auto_create_extra_out(spec, |
| 9788 | spec->autocfg.speaker_pins[0], |
| 9789 | "Speaker"); |
| 9790 | if (err < 0) |
| 9791 | return err; |
| 9792 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 9793 | "Headphone"); |
| 9794 | if (err < 0) |
| 9795 | return err; |
| 9796 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 9797 | if (err < 0) |
| 9798 | return err; |
| 9799 | |
| 9800 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9801 | |
| 9802 | /* check multiple SPDIF-out (for recent codecs) */ |
| 9803 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 9804 | hda_nid_t dig_nid; |
| 9805 | err = snd_hda_get_connections(codec, |
| 9806 | spec->autocfg.dig_out_pins[i], |
| 9807 | &dig_nid, 1); |
| 9808 | if (err < 0) |
| 9809 | continue; |
| 9810 | if (!i) |
| 9811 | spec->multiout.dig_out_nid = dig_nid; |
| 9812 | else { |
| 9813 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 9814 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 9815 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 9816 | break; |
| 9817 | } |
| 9818 | } |
| 9819 | if (spec->autocfg.dig_in_pin) |
| 9820 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 9821 | |
| 9822 | if (spec->kctls.list) |
| 9823 | add_mixer(spec, spec->kctls.list); |
| 9824 | |
| 9825 | add_verb(spec, alc883_auto_init_verbs); |
| 9826 | /* if ADC 0x07 is available, initialize it, too */ |
| 9827 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 9828 | add_verb(spec, alc882_adc1_init_verbs); |
| 9829 | |
| 9830 | spec->num_mux_defs = 1; |
| 9831 | spec->input_mux = &spec->private_imux[0]; |
| 9832 | |
| 9833 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9834 | |
| 9835 | err = alc_auto_add_mic_boost(codec); |
| 9836 | if (err < 0) |
| 9837 | return err; |
| 9838 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9839 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9840 | } |
| 9841 | |
| 9842 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9843 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9844 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9845 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9846 | alc882_auto_init_multi_out(codec); |
| 9847 | alc882_auto_init_hp_out(codec); |
| 9848 | alc882_auto_init_analog_input(codec); |
| 9849 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9850 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9851 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9852 | } |
| 9853 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9854 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9855 | { |
| 9856 | struct alc_spec *spec; |
| 9857 | int err, board_config; |
| 9858 | |
| 9859 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9860 | if (spec == NULL) |
| 9861 | return -ENOMEM; |
| 9862 | |
| 9863 | codec->spec = spec; |
| 9864 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9865 | switch (codec->vendor_id) { |
| 9866 | case 0x10ec0882: |
| 9867 | case 0x10ec0885: |
| 9868 | break; |
| 9869 | default: |
| 9870 | /* ALC883 and variants */ |
| 9871 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9872 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9873 | } |
| 9874 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9875 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 9876 | alc882_models, |
| 9877 | alc882_cfg_tbl); |
| 9878 | |
| 9879 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 9880 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 9881 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 9882 | |
| 9883 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 9884 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9885 | codec->chip_name); |
| 9886 | board_config = ALC882_AUTO; |
| 9887 | } |
| 9888 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 9889 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9890 | |
| 9891 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9892 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9893 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9894 | if (err < 0) { |
| 9895 | alc_free(codec); |
| 9896 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9897 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9898 | printk(KERN_INFO |
| 9899 | "hda_codec: Cannot set up configuration " |
| 9900 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9901 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9902 | } |
| 9903 | } |
| 9904 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9905 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9906 | if (err < 0) { |
| 9907 | alc_free(codec); |
| 9908 | return err; |
| 9909 | } |
| 9910 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9911 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 9912 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9913 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9914 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 9915 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 9916 | /* FIXME: setup DAC5 */ |
| 9917 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 9918 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 9919 | |
| 9920 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 9921 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 9922 | |
| 9923 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9924 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9925 | |
| 9926 | if (!spec->adc_nids && spec->input_mux) { |
| 9927 | int i; |
| 9928 | spec->num_adc_nids = 0; |
| 9929 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
| 9930 | hda_nid_t cap; |
| 9931 | hda_nid_t nid = alc882_adc_nids[i]; |
| 9932 | unsigned int wcap = get_wcaps(codec, nid); |
| 9933 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 9934 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9935 | if (wcap != AC_WID_AUD_IN) |
| 9936 | continue; |
| 9937 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 9938 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 9939 | if (err < 0) |
| 9940 | continue; |
| 9941 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 9942 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9943 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9944 | spec->adc_nids = spec->private_adc_nids; |
| 9945 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9946 | } |
| 9947 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 9948 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9949 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9950 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9951 | spec->vmaster_nid = 0x0c; |
| 9952 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9953 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9954 | if (board_config == ALC882_AUTO) |
| 9955 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9956 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9957 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9958 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9959 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9960 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9961 | |
| 9962 | return 0; |
| 9963 | } |
| 9964 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9965 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9966 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9967 | * ALC262 support |
| 9968 | */ |
| 9969 | |
| 9970 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9971 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9972 | |
| 9973 | #define alc262_dac_nids alc260_dac_nids |
| 9974 | #define alc262_adc_nids alc882_adc_nids |
| 9975 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9976 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9977 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9978 | |
| 9979 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9980 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9981 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9982 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9983 | /* ADC0 */ |
| 9984 | 0x09 |
| 9985 | }; |
| 9986 | |
| 9987 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9988 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9989 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9990 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9991 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9992 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9993 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9994 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9995 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9996 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9997 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9998 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9999 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10000 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10001 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10002 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10003 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10004 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10005 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10006 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10007 | }; |
| 10008 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10009 | /* update HP, line and mono-out pins according to the master switch */ |
| 10010 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10011 | { |
| 10012 | struct alc_spec *spec = codec->spec; |
| 10013 | int val = spec->master_sw; |
| 10014 | |
| 10015 | /* HP & line-out */ |
| 10016 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10017 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10018 | val ? PIN_HP : 0); |
| 10019 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10020 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10021 | val ? PIN_HP : 0); |
| 10022 | /* mono (speaker) depending on the HP jack sense */ |
| 10023 | val = val && !spec->jack_present; |
| 10024 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10025 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10026 | val ? PIN_OUT : 0); |
| 10027 | } |
| 10028 | |
| 10029 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10030 | { |
| 10031 | struct alc_spec *spec = codec->spec; |
| 10032 | unsigned int presence; |
| 10033 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 10034 | AC_VERB_GET_PIN_SENSE, 0); |
| 10035 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 10036 | alc262_hp_master_update(codec); |
| 10037 | } |
| 10038 | |
| 10039 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10040 | { |
| 10041 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10042 | return; |
| 10043 | alc262_hp_bpc_automute(codec); |
| 10044 | } |
| 10045 | |
| 10046 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10047 | { |
| 10048 | struct alc_spec *spec = codec->spec; |
| 10049 | unsigned int presence; |
| 10050 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 10051 | AC_VERB_GET_PIN_SENSE, 0); |
| 10052 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 10053 | alc262_hp_master_update(codec); |
| 10054 | } |
| 10055 | |
| 10056 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10057 | unsigned int res) |
| 10058 | { |
| 10059 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10060 | return; |
| 10061 | alc262_hp_wildwest_automute(codec); |
| 10062 | } |
| 10063 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10064 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10065 | |
| 10066 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10067 | struct snd_ctl_elem_value *ucontrol) |
| 10068 | { |
| 10069 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10070 | struct alc_spec *spec = codec->spec; |
| 10071 | int val = !!*ucontrol->value.integer.value; |
| 10072 | |
| 10073 | if (val == spec->master_sw) |
| 10074 | return 0; |
| 10075 | spec->master_sw = val; |
| 10076 | alc262_hp_master_update(codec); |
| 10077 | return 1; |
| 10078 | } |
| 10079 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10080 | #define ALC262_HP_MASTER_SWITCH \ |
| 10081 | { \ |
| 10082 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10083 | .name = "Master Playback Switch", \ |
| 10084 | .info = snd_ctl_boolean_mono_info, \ |
| 10085 | .get = alc262_hp_master_sw_get, \ |
| 10086 | .put = alc262_hp_master_sw_put, \ |
| 10087 | } |
| 10088 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10089 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10090 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10091 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10092 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10093 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10094 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10095 | HDA_OUTPUT), |
| 10096 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10097 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10098 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10099 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10100 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10101 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10102 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10103 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10104 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10105 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10106 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10107 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10108 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10109 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10110 | { } /* end */ |
| 10111 | }; |
| 10112 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10113 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10114 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10115 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10116 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10117 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10118 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10119 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10120 | HDA_OUTPUT), |
| 10121 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10122 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10123 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10124 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10125 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10126 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10127 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10128 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10129 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10130 | { } /* end */ |
| 10131 | }; |
| 10132 | |
| 10133 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10134 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10135 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10136 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10137 | { } /* end */ |
| 10138 | }; |
| 10139 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10140 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10141 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10142 | { |
| 10143 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10144 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10145 | spec->autocfg.hp_pins[0] = 0x15; |
| 10146 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10147 | } |
| 10148 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10149 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10150 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10151 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10152 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10153 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10154 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10155 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10156 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10157 | { } /* end */ |
| 10158 | }; |
| 10159 | |
| 10160 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10161 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10162 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10163 | |
| 10164 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10165 | { } |
| 10166 | }; |
| 10167 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10168 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10169 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10170 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10171 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10172 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10173 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10174 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10175 | { } /* end */ |
| 10176 | }; |
| 10177 | |
| 10178 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10179 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10180 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10181 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10182 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10183 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10184 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10185 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10186 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10187 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10188 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10189 | {} |
| 10190 | }; |
| 10191 | |
| 10192 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10193 | .num_items = 1, |
| 10194 | .items = { |
| 10195 | { "Line", 0x1 }, |
| 10196 | }, |
| 10197 | }; |
| 10198 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10199 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10200 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10201 | { |
| 10202 | struct alc_spec *spec = codec->spec; |
| 10203 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10204 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10205 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10206 | unsigned int mute; |
| 10207 | |
| 10208 | /* HP */ |
| 10209 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10210 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10211 | HDA_AMP_MUTE, mute); |
| 10212 | /* mute internal speaker per jack sense */ |
| 10213 | if (spec->jack_present) |
| 10214 | mute = HDA_AMP_MUTE; |
| 10215 | if (line_nid) |
| 10216 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10217 | HDA_AMP_MUTE, mute); |
| 10218 | if (speaker_nid && speaker_nid != line_nid) |
| 10219 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10220 | HDA_AMP_MUTE, mute); |
| 10221 | } |
| 10222 | |
| 10223 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10224 | |
| 10225 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10226 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10227 | { |
| 10228 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10229 | struct alc_spec *spec = codec->spec; |
| 10230 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10231 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10232 | if (val == spec->master_sw) |
| 10233 | return 0; |
| 10234 | spec->master_sw = val; |
| 10235 | alc262_hippo_master_update(codec); |
| 10236 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10237 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10238 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10239 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10240 | { \ |
| 10241 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10242 | .name = "Master Playback Switch", \ |
| 10243 | .info = snd_ctl_boolean_mono_info, \ |
| 10244 | .get = alc262_hippo_master_sw_get, \ |
| 10245 | .put = alc262_hippo_master_sw_put, \ |
| 10246 | } |
| 10247 | |
| 10248 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10249 | ALC262_HIPPO_MASTER_SWITCH, |
| 10250 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10251 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10252 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10253 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10254 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10255 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10256 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10257 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10258 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10259 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10260 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10261 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10262 | { } /* end */ |
| 10263 | }; |
| 10264 | |
| 10265 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10266 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10267 | ALC262_HIPPO_MASTER_SWITCH, |
| 10268 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10269 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10270 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10271 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10272 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10273 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10274 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10275 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10276 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10277 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10278 | { } /* end */ |
| 10279 | }; |
| 10280 | |
| 10281 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10282 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10283 | { |
| 10284 | struct alc_spec *spec = codec->spec; |
| 10285 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10286 | unsigned int present; |
| 10287 | |
| 10288 | /* need to execute and sync at first */ |
| 10289 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10290 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 10291 | AC_VERB_GET_PIN_SENSE, 0); |
| 10292 | spec->jack_present = (present & 0x80000000) != 0; |
| 10293 | alc262_hippo_master_update(codec); |
| 10294 | } |
| 10295 | |
| 10296 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10297 | { |
| 10298 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10299 | return; |
| 10300 | alc262_hippo_automute(codec); |
| 10301 | } |
| 10302 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10303 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10304 | { |
| 10305 | struct alc_spec *spec = codec->spec; |
| 10306 | |
| 10307 | spec->autocfg.hp_pins[0] = 0x15; |
| 10308 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10309 | } |
| 10310 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10311 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10312 | { |
| 10313 | struct alc_spec *spec = codec->spec; |
| 10314 | |
| 10315 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10316 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10317 | } |
| 10318 | |
| 10319 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10320 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10321 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10322 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10323 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10324 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10325 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10326 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10327 | { } /* end */ |
| 10328 | }; |
| 10329 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10330 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10331 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10332 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10333 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10334 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10335 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10336 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10337 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10338 | { } /* end */ |
| 10339 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10340 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10341 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10342 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10343 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10344 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10345 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10346 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10347 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10348 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10349 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10350 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10351 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10352 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10353 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10354 | { } /* end */ |
| 10355 | }; |
| 10356 | |
| 10357 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10358 | /* Headphone automute */ |
| 10359 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10360 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10361 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10362 | |
| 10363 | /* P11 AUX_IN, white 4-pin connector */ |
| 10364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10365 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10366 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10367 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10368 | |
| 10369 | {} |
| 10370 | }; |
| 10371 | |
| 10372 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10373 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10374 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10375 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10376 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10377 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10378 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10379 | } |
| 10380 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10381 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10382 | #define alc262_capture_mixer alc882_capture_mixer |
| 10383 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10384 | |
| 10385 | /* |
| 10386 | * generic initialization of ADC, input mixers and output mixers |
| 10387 | */ |
| 10388 | static struct hda_verb alc262_init_verbs[] = { |
| 10389 | /* |
| 10390 | * Unmute ADC0-2 and set the default input to mic-in |
| 10391 | */ |
| 10392 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10393 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10394 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10395 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10396 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10397 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10398 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10399 | /* 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] | 10400 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10401 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10402 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10403 | */ |
| 10404 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10405 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10406 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10407 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10408 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10409 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10410 | |
| 10411 | /* |
| 10412 | * Set up output mixers (0x0c - 0x0e) |
| 10413 | */ |
| 10414 | /* set vol=0 to output mixers */ |
| 10415 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10416 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10417 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10418 | /* set up input amps for analog loopback */ |
| 10419 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10420 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10421 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10422 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10423 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10424 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10425 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10426 | |
| 10427 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10428 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10429 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10430 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10431 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10432 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10433 | |
| 10434 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10435 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10436 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10437 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10438 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10439 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10440 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10441 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10442 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10443 | /* FIXME: use matrix-type input source selection */ |
| 10444 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10445 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10446 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10447 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10448 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10449 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10450 | /* Input mixer2 */ |
| 10451 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10452 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10453 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10454 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10455 | /* Input mixer3 */ |
| 10456 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10457 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10459 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10460 | |
| 10461 | { } |
| 10462 | }; |
| 10463 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10464 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10465 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10466 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10467 | { } |
| 10468 | }; |
| 10469 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10470 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10471 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10472 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10473 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10474 | |
| 10475 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10476 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10477 | {} |
| 10478 | }; |
| 10479 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10480 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10481 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10482 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10483 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10484 | |
| 10485 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10486 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10487 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10488 | }; |
| 10489 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10490 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10491 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10492 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10493 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10494 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10495 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10496 | { } /* end */ |
| 10497 | }; |
| 10498 | |
| 10499 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10500 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10501 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10502 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10503 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10504 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10505 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10506 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10507 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10508 | {} |
| 10509 | }; |
| 10510 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10511 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10512 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10513 | struct alc_spec *spec = codec->spec; |
| 10514 | |
| 10515 | spec->autocfg.hp_pins[0] = 0x15; |
| 10516 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10517 | spec->ext_mic.pin = 0x18; |
| 10518 | spec->ext_mic.mux_idx = 0; |
| 10519 | spec->int_mic.pin = 0x12; |
| 10520 | spec->int_mic.mux_idx = 9; |
| 10521 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10522 | } |
| 10523 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10524 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10525 | * nec model |
| 10526 | * 0x15 = headphone |
| 10527 | * 0x16 = internal speaker |
| 10528 | * 0x18 = external mic |
| 10529 | */ |
| 10530 | |
| 10531 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10532 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10533 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10534 | |
| 10535 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10536 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10537 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10538 | |
| 10539 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10540 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10541 | { } /* end */ |
| 10542 | }; |
| 10543 | |
| 10544 | static struct hda_verb alc262_nec_verbs[] = { |
| 10545 | /* Unmute Speaker */ |
| 10546 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10547 | |
| 10548 | /* Headphone */ |
| 10549 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10550 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10551 | |
| 10552 | /* External mic to headphone */ |
| 10553 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10554 | /* External mic to speaker */ |
| 10555 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10556 | {} |
| 10557 | }; |
| 10558 | |
| 10559 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10560 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10561 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10562 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10563 | */ |
| 10564 | |
| 10565 | #define ALC_HP_EVENT 0x37 |
| 10566 | |
| 10567 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10568 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10569 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10570 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10571 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10572 | {} |
| 10573 | }; |
| 10574 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10575 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10576 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10577 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10578 | {} |
| 10579 | }; |
| 10580 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10581 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10582 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10583 | .items = { |
| 10584 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10585 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10586 | { "CD", 0x4 }, |
| 10587 | }, |
| 10588 | }; |
| 10589 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10590 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10591 | .num_items = 5, |
| 10592 | .items = { |
| 10593 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10594 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10595 | { "Line", 0x2 }, |
| 10596 | { "CD", 0x4 }, |
| 10597 | { "AUX IN", 0x6 }, |
| 10598 | }, |
| 10599 | }; |
| 10600 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10601 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10602 | .num_items = 4, |
| 10603 | .items = { |
| 10604 | { "Mic", 0x0 }, |
| 10605 | { "Front Mic", 0x2 }, |
| 10606 | { "Line", 0x1 }, |
| 10607 | { "CD", 0x4 }, |
| 10608 | }, |
| 10609 | }; |
| 10610 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10611 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10612 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10613 | { |
| 10614 | struct alc_spec *spec = codec->spec; |
| 10615 | unsigned int mute; |
| 10616 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10617 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10618 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10619 | /* need to execute and sync at first */ |
| 10620 | 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] | 10621 | /* check laptop HP jack */ |
| 10622 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10623 | AC_VERB_GET_PIN_SENSE, 0); |
| 10624 | /* need to execute and sync at first */ |
| 10625 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10626 | /* check docking HP jack */ |
| 10627 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10628 | AC_VERB_GET_PIN_SENSE, 0); |
| 10629 | if (present & AC_PINSENSE_PRESENCE) |
| 10630 | spec->jack_present = 1; |
| 10631 | else |
| 10632 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10633 | spec->sense_updated = 1; |
| 10634 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10635 | /* unmute internal speaker only if both HPs are unplugged and |
| 10636 | * master switch is on |
| 10637 | */ |
| 10638 | if (spec->jack_present) |
| 10639 | mute = HDA_AMP_MUTE; |
| 10640 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10641 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10642 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10643 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10644 | } |
| 10645 | |
| 10646 | /* unsolicited event for HP jack sensing */ |
| 10647 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10648 | unsigned int res) |
| 10649 | { |
| 10650 | if ((res >> 26) != ALC_HP_EVENT) |
| 10651 | return; |
| 10652 | alc262_fujitsu_automute(codec, 1); |
| 10653 | } |
| 10654 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10655 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10656 | { |
| 10657 | alc262_fujitsu_automute(codec, 1); |
| 10658 | } |
| 10659 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10660 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10661 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10662 | .ops = &snd_hda_bind_vol, |
| 10663 | .values = { |
| 10664 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10665 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10666 | 0 |
| 10667 | }, |
| 10668 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10669 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10670 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10671 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10672 | { |
| 10673 | struct alc_spec *spec = codec->spec; |
| 10674 | unsigned int mute; |
| 10675 | |
| 10676 | if (force || !spec->sense_updated) { |
| 10677 | unsigned int present_int_hp; |
| 10678 | /* need to execute and sync at first */ |
| 10679 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10680 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10681 | AC_VERB_GET_PIN_SENSE, 0); |
| 10682 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10683 | spec->sense_updated = 1; |
| 10684 | } |
| 10685 | if (spec->jack_present) { |
| 10686 | /* mute internal speaker */ |
| 10687 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10688 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10689 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10690 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10691 | } else { |
| 10692 | /* unmute internal speaker if necessary */ |
| 10693 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10694 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10695 | HDA_AMP_MUTE, mute); |
| 10696 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10697 | HDA_AMP_MUTE, mute); |
| 10698 | } |
| 10699 | } |
| 10700 | |
| 10701 | /* unsolicited event for HP jack sensing */ |
| 10702 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10703 | unsigned int res) |
| 10704 | { |
| 10705 | if ((res >> 26) != ALC_HP_EVENT) |
| 10706 | return; |
| 10707 | alc262_lenovo_3000_automute(codec, 1); |
| 10708 | } |
| 10709 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10710 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 10711 | int dir, int idx, long *valp) |
| 10712 | { |
| 10713 | int i, change = 0; |
| 10714 | |
| 10715 | for (i = 0; i < 2; i++, valp++) |
| 10716 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 10717 | HDA_AMP_MUTE, |
| 10718 | *valp ? 0 : HDA_AMP_MUTE); |
| 10719 | return change; |
| 10720 | } |
| 10721 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10722 | /* bind hp and internal speaker mute (with plug check) */ |
| 10723 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10724 | struct snd_ctl_elem_value *ucontrol) |
| 10725 | { |
| 10726 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10727 | long *valp = ucontrol->value.integer.value; |
| 10728 | int change; |
| 10729 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10730 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 10731 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10732 | if (change) |
| 10733 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10734 | return change; |
| 10735 | } |
| 10736 | |
| 10737 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10738 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10739 | { |
| 10740 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10741 | .name = "Master Playback Switch", |
| 10742 | .info = snd_hda_mixer_amp_switch_info, |
| 10743 | .get = snd_hda_mixer_amp_switch_get, |
| 10744 | .put = alc262_fujitsu_master_sw_put, |
| 10745 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10746 | }, |
| 10747 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10748 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10749 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10750 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10751 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10752 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10753 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10754 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10755 | { } /* end */ |
| 10756 | }; |
| 10757 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10758 | /* bind hp and internal speaker mute (with plug check) */ |
| 10759 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10760 | struct snd_ctl_elem_value *ucontrol) |
| 10761 | { |
| 10762 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10763 | long *valp = ucontrol->value.integer.value; |
| 10764 | int change; |
| 10765 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10766 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10767 | if (change) |
| 10768 | alc262_lenovo_3000_automute(codec, 0); |
| 10769 | return change; |
| 10770 | } |
| 10771 | |
| 10772 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10773 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10774 | { |
| 10775 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10776 | .name = "Master Playback Switch", |
| 10777 | .info = snd_hda_mixer_amp_switch_info, |
| 10778 | .get = snd_hda_mixer_amp_switch_get, |
| 10779 | .put = alc262_lenovo_3000_master_sw_put, |
| 10780 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10781 | }, |
| 10782 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10783 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10784 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10785 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10786 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10787 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10788 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10789 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10790 | { } /* end */ |
| 10791 | }; |
| 10792 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10793 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10794 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10795 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10798 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10799 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10800 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10801 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10802 | { } /* end */ |
| 10803 | }; |
| 10804 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10805 | /* additional init verbs for Benq laptops */ |
| 10806 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10807 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10808 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10809 | {} |
| 10810 | }; |
| 10811 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10812 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10813 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10814 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10815 | |
| 10816 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10817 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10818 | {} |
| 10819 | }; |
| 10820 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10821 | /* Samsung Q1 Ultra Vista model setup */ |
| 10822 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10823 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10824 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10825 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10826 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10827 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10828 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10829 | { } /* end */ |
| 10830 | }; |
| 10831 | |
| 10832 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10833 | /* output mixer */ |
| 10834 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10835 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10836 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10837 | /* speaker */ |
| 10838 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10839 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10840 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10841 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10842 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10843 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10844 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10845 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10846 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10847 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10848 | /* internal mic */ |
| 10849 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10850 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10851 | /* ADC, choose mic */ |
| 10852 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10853 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10854 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10855 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10856 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10857 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10858 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10859 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10860 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10861 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10862 | {} |
| 10863 | }; |
| 10864 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10865 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10866 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10867 | { |
| 10868 | struct alc_spec *spec = codec->spec; |
| 10869 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10870 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10871 | mute = 0; |
| 10872 | /* auto-mute only when HP is used as HP */ |
| 10873 | if (!spec->cur_mux[0]) { |
| 10874 | unsigned int present; |
| 10875 | /* need to execute and sync at first */ |
| 10876 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10877 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10878 | AC_VERB_GET_PIN_SENSE, 0); |
| 10879 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10880 | if (spec->jack_present) |
| 10881 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10882 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10883 | /* mute/unmute internal speaker */ |
| 10884 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10885 | HDA_AMP_MUTE, mute); |
| 10886 | /* mute/unmute HP */ |
| 10887 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10888 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10889 | } |
| 10890 | |
| 10891 | /* unsolicited event for HP jack sensing */ |
| 10892 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10893 | unsigned int res) |
| 10894 | { |
| 10895 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10896 | return; |
| 10897 | alc262_ultra_automute(codec); |
| 10898 | } |
| 10899 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10900 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10901 | .num_items = 2, |
| 10902 | .items = { |
| 10903 | { "Mic", 0x1 }, |
| 10904 | { "Headphone", 0x7 }, |
| 10905 | }, |
| 10906 | }; |
| 10907 | |
| 10908 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10909 | struct snd_ctl_elem_value *ucontrol) |
| 10910 | { |
| 10911 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10912 | struct alc_spec *spec = codec->spec; |
| 10913 | int ret; |
| 10914 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10915 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10916 | if (!ret) |
| 10917 | return 0; |
| 10918 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10919 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10920 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10921 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10922 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10923 | return ret; |
| 10924 | } |
| 10925 | |
| 10926 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10927 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10928 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10929 | { |
| 10930 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10931 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10932 | .info = alc_mux_enum_info, |
| 10933 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10934 | .put = alc262_ultra_mux_enum_put, |
| 10935 | }, |
| 10936 | { } /* end */ |
| 10937 | }; |
| 10938 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 10939 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 10940 | * and thus it's bound with a different mixer. |
| 10941 | * This function returns which mixer amp should be used. |
| 10942 | */ |
| 10943 | static int alc262_check_volbit(hda_nid_t nid) |
| 10944 | { |
| 10945 | if (!nid) |
| 10946 | return 0; |
| 10947 | else if (nid == 0x16) |
| 10948 | return 2; |
| 10949 | else |
| 10950 | return 1; |
| 10951 | } |
| 10952 | |
| 10953 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 10954 | const char *pfx, int *vbits) |
| 10955 | { |
| 10956 | char name[32]; |
| 10957 | unsigned long val; |
| 10958 | int vbit; |
| 10959 | |
| 10960 | vbit = alc262_check_volbit(nid); |
| 10961 | if (!vbit) |
| 10962 | return 0; |
| 10963 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 10964 | return 0; |
| 10965 | *vbits |= vbit; |
| 10966 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 10967 | if (vbit == 2) |
| 10968 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 10969 | else |
| 10970 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
| 10971 | return add_control(spec, ALC_CTL_WIDGET_VOL, name, val); |
| 10972 | } |
| 10973 | |
| 10974 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 10975 | const char *pfx) |
| 10976 | { |
| 10977 | char name[32]; |
| 10978 | unsigned long val; |
| 10979 | |
| 10980 | if (!nid) |
| 10981 | return 0; |
| 10982 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 10983 | if (nid == 0x16) |
| 10984 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 10985 | else |
| 10986 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 10987 | return add_control(spec, ALC_CTL_WIDGET_MUTE, name, val); |
| 10988 | } |
| 10989 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10990 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10991 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10992 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10993 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 10994 | const char *pfx; |
| 10995 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10996 | int err; |
| 10997 | |
| 10998 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10999 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11000 | spec->multiout.dac_nids[0] = 2; |
| 11001 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11002 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11003 | pfx = "Master"; |
| 11004 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11005 | pfx = "Speaker"; |
| 11006 | else |
| 11007 | pfx = "Front"; |
| 11008 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11009 | if (err < 0) |
| 11010 | return err; |
| 11011 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11012 | if (err < 0) |
| 11013 | return err; |
| 11014 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11015 | if (err < 0) |
| 11016 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11017 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11018 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11019 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11020 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11021 | if (vbits == 1 || vbits == 2) |
| 11022 | pfx = "Master"; /* only one mixer is used */ |
| 11023 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11024 | pfx = "Speaker"; |
| 11025 | else |
| 11026 | pfx = "Front"; |
| 11027 | vbits = 0; |
| 11028 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11029 | if (err < 0) |
| 11030 | return err; |
| 11031 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11032 | &vbits); |
| 11033 | if (err < 0) |
| 11034 | return err; |
| 11035 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11036 | &vbits); |
| 11037 | if (err < 0) |
| 11038 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11039 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11040 | } |
| 11041 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11042 | #define alc262_auto_create_input_ctls \ |
| 11043 | alc880_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11044 | |
| 11045 | /* |
| 11046 | * generic initialization of ADC, input mixers and output mixers |
| 11047 | */ |
| 11048 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11049 | /* |
| 11050 | * Unmute ADC0-2 and set the default input to mic-in |
| 11051 | */ |
| 11052 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11053 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11054 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11055 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11056 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11057 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11058 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11059 | /* 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] | 11060 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11061 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11062 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11063 | */ |
| 11064 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11065 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11066 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11067 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11068 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11069 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11070 | |
| 11071 | /* |
| 11072 | * Set up output mixers (0x0c - 0x0f) |
| 11073 | */ |
| 11074 | /* set vol=0 to output mixers */ |
| 11075 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11076 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11077 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11078 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11079 | /* set up input amps for analog loopback */ |
| 11080 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11081 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11082 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11083 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11084 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11085 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11086 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11087 | |
| 11088 | /* FIXME: use matrix-type input source selection */ |
| 11089 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11090 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11091 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11092 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11093 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11094 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11095 | /* Input mixer2 */ |
| 11096 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11097 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11098 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11099 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11100 | /* Input mixer3 */ |
| 11101 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11102 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11103 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11104 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11105 | |
| 11106 | { } |
| 11107 | }; |
| 11108 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11109 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11110 | /* |
| 11111 | * Unmute ADC0-2 and set the default input to mic-in |
| 11112 | */ |
| 11113 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11114 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11115 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11116 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11117 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11118 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11119 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11120 | /* 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] | 11121 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11122 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11123 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11124 | */ |
| 11125 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11126 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11127 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11128 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11129 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11130 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11133 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11134 | /* |
| 11135 | * Set up output mixers (0x0c - 0x0e) |
| 11136 | */ |
| 11137 | /* set vol=0 to output mixers */ |
| 11138 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11139 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11140 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11141 | |
| 11142 | /* set up input amps for analog loopback */ |
| 11143 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11144 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11145 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11146 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11147 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11148 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11149 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11150 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11151 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11152 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11153 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11154 | |
| 11155 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11156 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11157 | |
| 11158 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11159 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11160 | |
| 11161 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11162 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11163 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11164 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11165 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11166 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11167 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11168 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11169 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11170 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11171 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11172 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11173 | |
| 11174 | |
| 11175 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11176 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11177 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11178 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11179 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11180 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11181 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11182 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11183 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11184 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11185 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11186 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11187 | /* Input mixer2 */ |
| 11188 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11189 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11190 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11191 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11192 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11193 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11194 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11195 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11196 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11197 | /* Input mixer3 */ |
| 11198 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11199 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11200 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11201 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11202 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11203 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11204 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11205 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11206 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11207 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11208 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11209 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11210 | { } |
| 11211 | }; |
| 11212 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11213 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11214 | /* |
| 11215 | * Unmute ADC0-2 and set the default input to mic-in |
| 11216 | */ |
| 11217 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11218 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11219 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11220 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11221 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11222 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11223 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11224 | /* 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] | 11225 | * mixer widget |
| 11226 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11227 | * panel mic (mic 2) |
| 11228 | */ |
| 11229 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11230 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11231 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11232 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11233 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11234 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11235 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11236 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11237 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11238 | /* |
| 11239 | * Set up output mixers (0x0c - 0x0e) |
| 11240 | */ |
| 11241 | /* set vol=0 to output mixers */ |
| 11242 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11243 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11244 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11245 | |
| 11246 | /* set up input amps for analog loopback */ |
| 11247 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11248 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11249 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11250 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11251 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11252 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11253 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11254 | |
| 11255 | |
| 11256 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11257 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11258 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11259 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11260 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11261 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11262 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11263 | |
| 11264 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11265 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11266 | |
| 11267 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11268 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11269 | |
| 11270 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11271 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11272 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11273 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11274 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11275 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11276 | |
| 11277 | /* FIXME: use matrix-type input source selection */ |
| 11278 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11279 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11280 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11281 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11282 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11283 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11284 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11285 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11286 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11287 | /* Input mixer2 */ |
| 11288 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11289 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11290 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11291 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11292 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11293 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11294 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11295 | /* Input mixer3 */ |
| 11296 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11297 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11298 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11299 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11300 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11301 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11302 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11303 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11304 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11305 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11306 | { } |
| 11307 | }; |
| 11308 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11309 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11310 | |
| 11311 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11312 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11313 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11314 | |
| 11315 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11316 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11317 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11318 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11319 | |
| 11320 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11321 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11322 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11323 | {} |
| 11324 | }; |
| 11325 | |
| 11326 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11327 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11328 | #define alc262_loopbacks alc880_loopbacks |
| 11329 | #endif |
| 11330 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11331 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11332 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11333 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11334 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11335 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11336 | |
| 11337 | /* |
| 11338 | * BIOS auto configuration |
| 11339 | */ |
| 11340 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11341 | { |
| 11342 | struct alc_spec *spec = codec->spec; |
| 11343 | int err; |
| 11344 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11345 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11346 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11347 | alc262_ignore); |
| 11348 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11349 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11350 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11351 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11352 | spec->multiout.max_channels = 2; |
| 11353 | spec->no_analog = 1; |
| 11354 | goto dig_only; |
| 11355 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11356 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11357 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11358 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11359 | if (err < 0) |
| 11360 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11361 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11362 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11363 | return err; |
| 11364 | |
| 11365 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11366 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11367 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11368 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11369 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11370 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11371 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11372 | if (spec->autocfg.dig_in_pin) |
| 11373 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11374 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11375 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11376 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11377 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11378 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11379 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11380 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11381 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11382 | err = alc_auto_add_mic_boost(codec); |
| 11383 | if (err < 0) |
| 11384 | return err; |
| 11385 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11386 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11387 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11388 | return 1; |
| 11389 | } |
| 11390 | |
| 11391 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11392 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11393 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11394 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11395 | |
| 11396 | |
| 11397 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11398 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11399 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11400 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11401 | alc262_auto_init_multi_out(codec); |
| 11402 | alc262_auto_init_hp_out(codec); |
| 11403 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11404 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11405 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11406 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11407 | } |
| 11408 | |
| 11409 | /* |
| 11410 | * configuration and preset |
| 11411 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11412 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11413 | [ALC262_BASIC] = "basic", |
| 11414 | [ALC262_HIPPO] = "hippo", |
| 11415 | [ALC262_HIPPO_1] = "hippo_1", |
| 11416 | [ALC262_FUJITSU] = "fujitsu", |
| 11417 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11418 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11419 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11420 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11421 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11422 | [ALC262_BENQ_T31] = "benq-t31", |
| 11423 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11424 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11425 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11426 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11427 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11428 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11429 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11430 | [ALC262_AUTO] = "auto", |
| 11431 | }; |
| 11432 | |
| 11433 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11434 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11435 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11436 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11437 | ALC262_HP_BPC), |
| 11438 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11439 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11440 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11441 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11442 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11443 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11444 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11445 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11446 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11447 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11448 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11449 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11450 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11451 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11452 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11453 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11454 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11455 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11456 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11457 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11458 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11459 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11460 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11461 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11462 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11463 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11464 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11465 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11466 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11467 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11468 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11469 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11470 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11471 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11472 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11473 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11474 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11475 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11476 | {} |
| 11477 | }; |
| 11478 | |
| 11479 | static struct alc_config_preset alc262_presets[] = { |
| 11480 | [ALC262_BASIC] = { |
| 11481 | .mixers = { alc262_base_mixer }, |
| 11482 | .init_verbs = { alc262_init_verbs }, |
| 11483 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11484 | .dac_nids = alc262_dac_nids, |
| 11485 | .hp_nid = 0x03, |
| 11486 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11487 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11488 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11489 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11490 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11491 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11492 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11493 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11494 | .dac_nids = alc262_dac_nids, |
| 11495 | .hp_nid = 0x03, |
| 11496 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11497 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11498 | .channel_mode = alc262_modes, |
| 11499 | .input_mux = &alc262_capture_source, |
| 11500 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11501 | .setup = alc262_hippo_setup, |
| 11502 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11503 | }, |
| 11504 | [ALC262_HIPPO_1] = { |
| 11505 | .mixers = { alc262_hippo1_mixer }, |
| 11506 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11507 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11508 | .dac_nids = alc262_dac_nids, |
| 11509 | .hp_nid = 0x02, |
| 11510 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11511 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11512 | .channel_mode = alc262_modes, |
| 11513 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11514 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11515 | .setup = alc262_hippo1_setup, |
| 11516 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11517 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11518 | [ALC262_FUJITSU] = { |
| 11519 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11520 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11521 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11522 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11523 | .dac_nids = alc262_dac_nids, |
| 11524 | .hp_nid = 0x03, |
| 11525 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11526 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11527 | .channel_mode = alc262_modes, |
| 11528 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11529 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11530 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11531 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11532 | [ALC262_HP_BPC] = { |
| 11533 | .mixers = { alc262_HP_BPC_mixer }, |
| 11534 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11535 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11536 | .dac_nids = alc262_dac_nids, |
| 11537 | .hp_nid = 0x03, |
| 11538 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11539 | .channel_mode = alc262_modes, |
| 11540 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11541 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11542 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11543 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11544 | [ALC262_HP_BPC_D7000_WF] = { |
| 11545 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11546 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11547 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11548 | .dac_nids = alc262_dac_nids, |
| 11549 | .hp_nid = 0x03, |
| 11550 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11551 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11552 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11553 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11554 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11555 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11556 | [ALC262_HP_BPC_D7000_WL] = { |
| 11557 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11558 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11559 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11560 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11561 | .dac_nids = alc262_dac_nids, |
| 11562 | .hp_nid = 0x03, |
| 11563 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11564 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11565 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11566 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11567 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11568 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11569 | [ALC262_HP_TC_T5735] = { |
| 11570 | .mixers = { alc262_hp_t5735_mixer }, |
| 11571 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11572 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11573 | .dac_nids = alc262_dac_nids, |
| 11574 | .hp_nid = 0x03, |
| 11575 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11576 | .channel_mode = alc262_modes, |
| 11577 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11578 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11579 | .setup = alc262_hp_t5735_setup, |
| 11580 | .init_hook = alc_automute_amp, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11581 | }, |
| 11582 | [ALC262_HP_RP5700] = { |
| 11583 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11584 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11585 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11586 | .dac_nids = alc262_dac_nids, |
| 11587 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11588 | .channel_mode = alc262_modes, |
| 11589 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11590 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11591 | [ALC262_BENQ_ED8] = { |
| 11592 | .mixers = { alc262_base_mixer }, |
| 11593 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11594 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11595 | .dac_nids = alc262_dac_nids, |
| 11596 | .hp_nid = 0x03, |
| 11597 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11598 | .channel_mode = alc262_modes, |
| 11599 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11600 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11601 | [ALC262_SONY_ASSAMD] = { |
| 11602 | .mixers = { alc262_sony_mixer }, |
| 11603 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11604 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11605 | .dac_nids = alc262_dac_nids, |
| 11606 | .hp_nid = 0x02, |
| 11607 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11608 | .channel_mode = alc262_modes, |
| 11609 | .input_mux = &alc262_capture_source, |
| 11610 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11611 | .setup = alc262_hippo_setup, |
| 11612 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11613 | }, |
| 11614 | [ALC262_BENQ_T31] = { |
| 11615 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11616 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 11617 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11618 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11619 | .dac_nids = alc262_dac_nids, |
| 11620 | .hp_nid = 0x03, |
| 11621 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11622 | .channel_mode = alc262_modes, |
| 11623 | .input_mux = &alc262_capture_source, |
| 11624 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11625 | .setup = alc262_hippo_setup, |
| 11626 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11627 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11628 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11629 | .mixers = { alc262_ultra_mixer }, |
| 11630 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11631 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11632 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11633 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11634 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11635 | .channel_mode = alc262_modes, |
| 11636 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11637 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11638 | .capsrc_nids = alc262_capsrc_nids, |
| 11639 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11640 | .unsol_event = alc262_ultra_unsol_event, |
| 11641 | .init_hook = alc262_ultra_automute, |
| 11642 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11643 | [ALC262_LENOVO_3000] = { |
| 11644 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11645 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11646 | alc262_lenovo_3000_unsol_verbs }, |
| 11647 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11648 | .dac_nids = alc262_dac_nids, |
| 11649 | .hp_nid = 0x03, |
| 11650 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11651 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11652 | .channel_mode = alc262_modes, |
| 11653 | .input_mux = &alc262_fujitsu_capture_source, |
| 11654 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11655 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11656 | [ALC262_NEC] = { |
| 11657 | .mixers = { alc262_nec_mixer }, |
| 11658 | .init_verbs = { alc262_nec_verbs }, |
| 11659 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11660 | .dac_nids = alc262_dac_nids, |
| 11661 | .hp_nid = 0x03, |
| 11662 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11663 | .channel_mode = alc262_modes, |
| 11664 | .input_mux = &alc262_capture_source, |
| 11665 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11666 | [ALC262_TOSHIBA_S06] = { |
| 11667 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11668 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11669 | alc262_eapd_verbs }, |
| 11670 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11671 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11672 | .dac_nids = alc262_dac_nids, |
| 11673 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11674 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11675 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11676 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11677 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11678 | .unsol_event = alc_sku_unsol_event, |
| 11679 | .setup = alc262_toshiba_s06_setup, |
| 11680 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11681 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11682 | [ALC262_TOSHIBA_RX1] = { |
| 11683 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11684 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11685 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11686 | .dac_nids = alc262_dac_nids, |
| 11687 | .hp_nid = 0x03, |
| 11688 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11689 | .channel_mode = alc262_modes, |
| 11690 | .input_mux = &alc262_capture_source, |
| 11691 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11692 | .setup = alc262_hippo_setup, |
| 11693 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11694 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11695 | [ALC262_TYAN] = { |
| 11696 | .mixers = { alc262_tyan_mixer }, |
| 11697 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11698 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11699 | .dac_nids = alc262_dac_nids, |
| 11700 | .hp_nid = 0x02, |
| 11701 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11702 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11703 | .channel_mode = alc262_modes, |
| 11704 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11705 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11706 | .setup = alc262_tyan_setup, |
| 11707 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11708 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11709 | }; |
| 11710 | |
| 11711 | static int patch_alc262(struct hda_codec *codec) |
| 11712 | { |
| 11713 | struct alc_spec *spec; |
| 11714 | int board_config; |
| 11715 | int err; |
| 11716 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11717 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11718 | if (spec == NULL) |
| 11719 | return -ENOMEM; |
| 11720 | |
| 11721 | codec->spec = spec; |
| 11722 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11723 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11724 | * under-run |
| 11725 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11726 | { |
| 11727 | int tmp; |
| 11728 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11729 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11730 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11731 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11732 | } |
| 11733 | #endif |
| 11734 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11735 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11736 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11737 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11738 | alc262_models, |
| 11739 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11740 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11741 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11742 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 11743 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11744 | board_config = ALC262_AUTO; |
| 11745 | } |
| 11746 | |
| 11747 | if (board_config == ALC262_AUTO) { |
| 11748 | /* automatic parse from the BIOS config */ |
| 11749 | err = alc262_parse_auto_config(codec); |
| 11750 | if (err < 0) { |
| 11751 | alc_free(codec); |
| 11752 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11753 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11754 | printk(KERN_INFO |
| 11755 | "hda_codec: Cannot set up configuration " |
| 11756 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11757 | board_config = ALC262_BASIC; |
| 11758 | } |
| 11759 | } |
| 11760 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11761 | if (!spec->no_analog) { |
| 11762 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11763 | if (err < 0) { |
| 11764 | alc_free(codec); |
| 11765 | return err; |
| 11766 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11767 | } |
| 11768 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11769 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11770 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11771 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11772 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11773 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11774 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11775 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11776 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11777 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11778 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11779 | int i; |
| 11780 | /* check whether the digital-mic has to be supported */ |
| 11781 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11782 | if (spec->input_mux->items[i].index >= 9) |
| 11783 | break; |
| 11784 | } |
| 11785 | if (i < spec->input_mux->num_items) { |
| 11786 | /* use only ADC0 */ |
| 11787 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11788 | spec->num_adc_nids = 1; |
| 11789 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11790 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11791 | /* all analog inputs */ |
| 11792 | /* check whether NID 0x07 is valid */ |
| 11793 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11794 | |
| 11795 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11796 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11797 | if (wcap != AC_WID_AUD_IN) { |
| 11798 | spec->adc_nids = alc262_adc_nids_alt; |
| 11799 | spec->num_adc_nids = |
| 11800 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11801 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11802 | } else { |
| 11803 | spec->adc_nids = alc262_adc_nids; |
| 11804 | spec->num_adc_nids = |
| 11805 | ARRAY_SIZE(alc262_adc_nids); |
| 11806 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11807 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11808 | } |
| 11809 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11810 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11811 | set_capture_mixer(codec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11812 | if (!spec->no_analog) |
| 11813 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11814 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11815 | spec->vmaster_nid = 0x0c; |
| 11816 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11817 | codec->patch_ops = alc_patch_ops; |
| 11818 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11819 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11820 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11821 | if (!spec->loopback.amplist) |
| 11822 | spec->loopback.amplist = alc262_loopbacks; |
| 11823 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11824 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11825 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11826 | return 0; |
| 11827 | } |
| 11828 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11829 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11830 | * ALC268 channel source setting (2 channel) |
| 11831 | */ |
| 11832 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11833 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11834 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11835 | static hda_nid_t alc268_dac_nids[2] = { |
| 11836 | /* front, hp */ |
| 11837 | 0x02, 0x03 |
| 11838 | }; |
| 11839 | |
| 11840 | static hda_nid_t alc268_adc_nids[2] = { |
| 11841 | /* ADC0-1 */ |
| 11842 | 0x08, 0x07 |
| 11843 | }; |
| 11844 | |
| 11845 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11846 | /* ADC0 */ |
| 11847 | 0x08 |
| 11848 | }; |
| 11849 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11850 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11851 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11852 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11853 | /* output mixer control */ |
| 11854 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11855 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11856 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11857 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11858 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11859 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11860 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11861 | { } |
| 11862 | }; |
| 11863 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11864 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11865 | /* output mixer control */ |
| 11866 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11867 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11868 | ALC262_HIPPO_MASTER_SWITCH, |
| 11869 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11870 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11871 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11872 | { } |
| 11873 | }; |
| 11874 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11875 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11876 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11877 | .ops = &snd_hda_bind_sw, |
| 11878 | .values = { |
| 11879 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11880 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11881 | 0 |
| 11882 | }, |
| 11883 | }; |
| 11884 | |
| 11885 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11886 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11887 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11888 | { } |
| 11889 | }; |
| 11890 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11891 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11892 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11893 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11894 | { } |
| 11895 | }; |
| 11896 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11897 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11898 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11899 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11900 | { } /* end */ |
| 11901 | }; |
| 11902 | |
| 11903 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11904 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11905 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11906 | .ops = &snd_hda_bind_vol, |
| 11907 | .values = { |
| 11908 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11909 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11910 | 0 |
| 11911 | }, |
| 11912 | }; |
| 11913 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11914 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11915 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11916 | { |
| 11917 | struct alc_spec *spec = codec->spec; |
| 11918 | unsigned int mute; |
| 11919 | |
| 11920 | if (force || !spec->sense_updated) { |
| 11921 | unsigned int present; |
| 11922 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11923 | AC_VERB_GET_PIN_SENSE, 0); |
| 11924 | spec->jack_present = (present & 0x80000000) != 0; |
| 11925 | spec->sense_updated = 1; |
| 11926 | } |
| 11927 | if (spec->jack_present) |
| 11928 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11929 | else /* unmute internal speaker if necessary */ |
| 11930 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11931 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11932 | HDA_AMP_MUTE, mute); |
| 11933 | } |
| 11934 | |
| 11935 | |
| 11936 | /* bind hp and internal speaker mute (with plug check) */ |
| 11937 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11938 | struct snd_ctl_elem_value *ucontrol) |
| 11939 | { |
| 11940 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11941 | long *valp = ucontrol->value.integer.value; |
| 11942 | int change; |
| 11943 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11944 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11945 | if (change) |
| 11946 | alc268_acer_automute(codec, 0); |
| 11947 | return change; |
| 11948 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11949 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11950 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11951 | /* output mixer control */ |
| 11952 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11953 | { |
| 11954 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11955 | .name = "Master Playback Switch", |
| 11956 | .info = snd_hda_mixer_amp_switch_info, |
| 11957 | .get = snd_hda_mixer_amp_switch_get, |
| 11958 | .put = alc268_acer_master_sw_put, |
| 11959 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11960 | }, |
| 11961 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11962 | { } |
| 11963 | }; |
| 11964 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11965 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11966 | /* output mixer control */ |
| 11967 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11968 | { |
| 11969 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11970 | .name = "Master Playback Switch", |
| 11971 | .info = snd_hda_mixer_amp_switch_info, |
| 11972 | .get = snd_hda_mixer_amp_switch_get, |
| 11973 | .put = alc268_acer_master_sw_put, |
| 11974 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11975 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11976 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11977 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11978 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11979 | { } |
| 11980 | }; |
| 11981 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11982 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11983 | /* output mixer control */ |
| 11984 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11985 | { |
| 11986 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11987 | .name = "Master Playback Switch", |
| 11988 | .info = snd_hda_mixer_amp_switch_info, |
| 11989 | .get = snd_hda_mixer_amp_switch_get, |
| 11990 | .put = alc268_acer_master_sw_put, |
| 11991 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11992 | }, |
| 11993 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11994 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11995 | { } |
| 11996 | }; |
| 11997 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11998 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11999 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12000 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12001 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12002 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12003 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12004 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12005 | { } |
| 12006 | }; |
| 12007 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12008 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12009 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12010 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12011 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12012 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12013 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12014 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12015 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12016 | { } |
| 12017 | }; |
| 12018 | |
| 12019 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12020 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12021 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12022 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12023 | |
| 12024 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12025 | unsigned int res) |
| 12026 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12027 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12028 | return; |
| 12029 | alc268_acer_automute(codec, 1); |
| 12030 | } |
| 12031 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12032 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12033 | { |
| 12034 | alc268_acer_automute(codec, 1); |
| 12035 | } |
| 12036 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12037 | /* toggle speaker-output according to the hp-jack state */ |
| 12038 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12039 | { |
| 12040 | unsigned int present; |
| 12041 | unsigned char bits; |
| 12042 | |
| 12043 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12044 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12045 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12046 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 12047 | AMP_IN_MUTE(0), bits); |
| 12048 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 12049 | AMP_IN_MUTE(0), bits); |
| 12050 | } |
| 12051 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12052 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12053 | unsigned int res) |
| 12054 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12055 | switch (res >> 26) { |
| 12056 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12057 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12058 | break; |
| 12059 | case ALC880_MIC_EVENT: |
| 12060 | alc_mic_automute(codec); |
| 12061 | break; |
| 12062 | } |
| 12063 | } |
| 12064 | |
| 12065 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12066 | { |
| 12067 | struct alc_spec *spec = codec->spec; |
| 12068 | spec->ext_mic.pin = 0x18; |
| 12069 | spec->ext_mic.mux_idx = 0; |
| 12070 | spec->int_mic.pin = 0x12; |
| 12071 | spec->int_mic.mux_idx = 6; |
| 12072 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12073 | } |
| 12074 | |
| 12075 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12076 | { |
| 12077 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12078 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12079 | } |
| 12080 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12081 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12082 | /* output mixer control */ |
| 12083 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12084 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12085 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12086 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12087 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12088 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12089 | { } |
| 12090 | }; |
| 12091 | |
| 12092 | static struct hda_verb alc268_dell_verbs[] = { |
| 12093 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12094 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12095 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12096 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12097 | { } |
| 12098 | }; |
| 12099 | |
| 12100 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12101 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12102 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12103 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12104 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12105 | spec->autocfg.hp_pins[0] = 0x15; |
| 12106 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12107 | spec->ext_mic.pin = 0x18; |
| 12108 | spec->ext_mic.mux_idx = 0; |
| 12109 | spec->int_mic.pin = 0x19; |
| 12110 | spec->int_mic.mux_idx = 1; |
| 12111 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12112 | } |
| 12113 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12114 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12115 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12116 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12117 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12118 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12119 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12120 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12121 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12122 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12123 | { } |
| 12124 | }; |
| 12125 | |
| 12126 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12127 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12128 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12129 | { } |
| 12130 | }; |
| 12131 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12132 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12133 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12134 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12135 | spec->autocfg.hp_pins[0] = 0x15; |
| 12136 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12137 | spec->ext_mic.pin = 0x18; |
| 12138 | spec->ext_mic.mux_idx = 0; |
| 12139 | spec->int_mic.pin = 0x19; |
| 12140 | spec->int_mic.mux_idx = 1; |
| 12141 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12142 | } |
| 12143 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12144 | /* |
| 12145 | * generic initialization of ADC, input mixers and output mixers |
| 12146 | */ |
| 12147 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12148 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12149 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12150 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12151 | |
| 12152 | /* |
| 12153 | * Set up output mixers (0x0c - 0x0e) |
| 12154 | */ |
| 12155 | /* set vol=0 to output mixers */ |
| 12156 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12157 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12158 | |
| 12159 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12160 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12161 | |
| 12162 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12163 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12164 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12165 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12166 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12167 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12168 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12169 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12170 | |
| 12171 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12172 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12173 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12174 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12175 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12176 | |
| 12177 | /* set PCBEEP vol = 0, mute connections */ |
| 12178 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12179 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12180 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12181 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12182 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12183 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12184 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12185 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12186 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12187 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12188 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12189 | { } |
| 12190 | }; |
| 12191 | |
| 12192 | /* |
| 12193 | * generic initialization of ADC, input mixers and output mixers |
| 12194 | */ |
| 12195 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12196 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12197 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12198 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12199 | |
| 12200 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12201 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12202 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12203 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12204 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12205 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12206 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12207 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12208 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12209 | |
| 12210 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12211 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12212 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12213 | /* set PCBEEP vol = 0, mute connections */ |
| 12214 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12215 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12216 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12217 | |
| 12218 | { } |
| 12219 | }; |
| 12220 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12221 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12222 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12223 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12224 | { } /* end */ |
| 12225 | }; |
| 12226 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12227 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12228 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12229 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12230 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12231 | { } /* end */ |
| 12232 | }; |
| 12233 | |
| 12234 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12235 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12236 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12237 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12238 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12239 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12240 | { } /* end */ |
| 12241 | }; |
| 12242 | |
| 12243 | static struct hda_input_mux alc268_capture_source = { |
| 12244 | .num_items = 4, |
| 12245 | .items = { |
| 12246 | { "Mic", 0x0 }, |
| 12247 | { "Front Mic", 0x1 }, |
| 12248 | { "Line", 0x2 }, |
| 12249 | { "CD", 0x3 }, |
| 12250 | }, |
| 12251 | }; |
| 12252 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12253 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12254 | .num_items = 3, |
| 12255 | .items = { |
| 12256 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12257 | { "Internal Mic", 0x1 }, |
| 12258 | { "Line", 0x2 }, |
| 12259 | }, |
| 12260 | }; |
| 12261 | |
| 12262 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12263 | .num_items = 3, |
| 12264 | .items = { |
| 12265 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12266 | { "Internal Mic", 0x6 }, |
| 12267 | { "Line", 0x2 }, |
| 12268 | }, |
| 12269 | }; |
| 12270 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12271 | #ifdef CONFIG_SND_DEBUG |
| 12272 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12273 | /* Volume widgets */ |
| 12274 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12275 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12276 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12277 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12278 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12279 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12280 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12281 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12282 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12283 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12284 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12285 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12286 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12287 | /* The below appears problematic on some hardwares */ |
| 12288 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12289 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12290 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12291 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12292 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12293 | |
| 12294 | /* Modes for retasking pin widgets */ |
| 12295 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12296 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12297 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12298 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12299 | |
| 12300 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12301 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12302 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12303 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12304 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12305 | |
| 12306 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12307 | * The ALC268 does not have an SPDIF input. |
| 12308 | */ |
| 12309 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12310 | |
| 12311 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12312 | * this output to turn on an external amplifier. |
| 12313 | */ |
| 12314 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12315 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12316 | |
| 12317 | { } /* end */ |
| 12318 | }; |
| 12319 | #endif |
| 12320 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12321 | /* create input playback/capture controls for the given pin */ |
| 12322 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12323 | const char *ctlname, int idx) |
| 12324 | { |
| 12325 | char name[32]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12326 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12327 | int err; |
| 12328 | |
| 12329 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12330 | switch (nid) { |
| 12331 | case 0x14: |
| 12332 | case 0x16: |
| 12333 | dac = 0x02; |
| 12334 | break; |
| 12335 | case 0x15: |
| 12336 | dac = 0x03; |
| 12337 | break; |
| 12338 | default: |
| 12339 | return 0; |
| 12340 | } |
| 12341 | if (spec->multiout.dac_nids[0] != dac && |
| 12342 | spec->multiout.dac_nids[1] != dac) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12343 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12344 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12345 | HDA_OUTPUT)); |
| 12346 | if (err < 0) |
| 12347 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12348 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12349 | } |
| 12350 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12351 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12352 | if (nid != 0x16) |
| 12353 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12354 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12355 | else /* mono */ |
| 12356 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12357 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12358 | if (err < 0) |
| 12359 | return err; |
| 12360 | return 0; |
| 12361 | } |
| 12362 | |
| 12363 | /* add playback controls from the parsed DAC table */ |
| 12364 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12365 | const struct auto_pin_cfg *cfg) |
| 12366 | { |
| 12367 | hda_nid_t nid; |
| 12368 | int err; |
| 12369 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12370 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12371 | |
| 12372 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12373 | if (nid) { |
| 12374 | const char *name; |
| 12375 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12376 | name = "Speaker"; |
| 12377 | else |
| 12378 | name = "Front"; |
| 12379 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12380 | if (err < 0) |
| 12381 | return err; |
| 12382 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12383 | |
| 12384 | nid = cfg->speaker_pins[0]; |
| 12385 | if (nid == 0x1d) { |
| 12386 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12387 | "Speaker Playback Volume", |
| 12388 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12389 | if (err < 0) |
| 12390 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12391 | } else { |
| 12392 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12393 | if (err < 0) |
| 12394 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12395 | } |
| 12396 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12397 | if (nid) { |
| 12398 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12399 | if (err < 0) |
| 12400 | return err; |
| 12401 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12402 | |
| 12403 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12404 | if (nid == 0x16) { |
| 12405 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12406 | "Mono Playback Switch", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12407 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12408 | if (err < 0) |
| 12409 | return err; |
| 12410 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12411 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12412 | } |
| 12413 | |
| 12414 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12415 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12416 | const struct auto_pin_cfg *cfg) |
| 12417 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12418 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12419 | } |
| 12420 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12421 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12422 | hda_nid_t nid, int pin_type) |
| 12423 | { |
| 12424 | int idx; |
| 12425 | |
| 12426 | alc_set_pin_output(codec, nid, pin_type); |
| 12427 | if (nid == 0x14 || nid == 0x16) |
| 12428 | idx = 0; |
| 12429 | else |
| 12430 | idx = 1; |
| 12431 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 12432 | } |
| 12433 | |
| 12434 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 12435 | { |
| 12436 | struct alc_spec *spec = codec->spec; |
| 12437 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 12438 | if (nid) { |
| 12439 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 12440 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 12441 | } |
| 12442 | } |
| 12443 | |
| 12444 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 12445 | { |
| 12446 | struct alc_spec *spec = codec->spec; |
| 12447 | hda_nid_t pin; |
| 12448 | |
| 12449 | pin = spec->autocfg.hp_pins[0]; |
| 12450 | if (pin) |
| 12451 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 12452 | pin = spec->autocfg.speaker_pins[0]; |
| 12453 | if (pin) |
| 12454 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 12455 | } |
| 12456 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12457 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12458 | { |
| 12459 | struct alc_spec *spec = codec->spec; |
| 12460 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12461 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12462 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12463 | unsigned int dac_vol1, dac_vol2; |
| 12464 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12465 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12466 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12467 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12468 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12469 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12470 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12471 | AMP_IN_UNMUTE(1)); |
| 12472 | snd_hda_codec_write(codec, 0x10, 0, |
| 12473 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12474 | AMP_IN_UNMUTE(1)); |
| 12475 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12476 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12477 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12478 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12479 | snd_hda_codec_write(codec, 0x10, 0, |
| 12480 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12481 | } |
| 12482 | |
| 12483 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12484 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12485 | dac_vol2 = AMP_OUT_ZERO; |
| 12486 | else if (line_nid == 0x15) |
| 12487 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12488 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12489 | dac_vol2 = AMP_OUT_ZERO; |
| 12490 | else if (hp_nid == 0x15) |
| 12491 | dac_vol1 = AMP_OUT_ZERO; |
| 12492 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12493 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12494 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12495 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12496 | |
| 12497 | snd_hda_codec_write(codec, 0x02, 0, |
| 12498 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12499 | snd_hda_codec_write(codec, 0x03, 0, |
| 12500 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12501 | } |
| 12502 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12503 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12504 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12505 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12506 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12507 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12508 | |
| 12509 | /* |
| 12510 | * BIOS auto configuration |
| 12511 | */ |
| 12512 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12513 | { |
| 12514 | struct alc_spec *spec = codec->spec; |
| 12515 | int err; |
| 12516 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12517 | |
| 12518 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12519 | alc268_ignore); |
| 12520 | if (err < 0) |
| 12521 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12522 | if (!spec->autocfg.line_outs) { |
| 12523 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12524 | spec->multiout.max_channels = 2; |
| 12525 | spec->no_analog = 1; |
| 12526 | goto dig_only; |
| 12527 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12528 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12529 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12530 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12531 | if (err < 0) |
| 12532 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12533 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12534 | if (err < 0) |
| 12535 | return err; |
| 12536 | |
| 12537 | spec->multiout.max_channels = 2; |
| 12538 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12539 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12540 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12541 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12542 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12543 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12544 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12545 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12546 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12547 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12548 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12549 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12550 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12551 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12552 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12553 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12554 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12555 | err = alc_auto_add_mic_boost(codec); |
| 12556 | if (err < 0) |
| 12557 | return err; |
| 12558 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12559 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12560 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12561 | return 1; |
| 12562 | } |
| 12563 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12564 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12565 | |
| 12566 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12567 | static void alc268_auto_init(struct hda_codec *codec) |
| 12568 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12569 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12570 | alc268_auto_init_multi_out(codec); |
| 12571 | alc268_auto_init_hp_out(codec); |
| 12572 | alc268_auto_init_mono_speaker_out(codec); |
| 12573 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12574 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12575 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12576 | } |
| 12577 | |
| 12578 | /* |
| 12579 | * configuration and preset |
| 12580 | */ |
| 12581 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12582 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12583 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12584 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12585 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12586 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12587 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12588 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12589 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12590 | #ifdef CONFIG_SND_DEBUG |
| 12591 | [ALC268_TEST] = "test", |
| 12592 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12593 | [ALC268_AUTO] = "auto", |
| 12594 | }; |
| 12595 | |
| 12596 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12597 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12598 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12599 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12600 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12601 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12602 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12603 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12604 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12605 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 12606 | /* almost compatible with toshiba but with optional digital outs; |
| 12607 | * auto-probing seems working fine |
| 12608 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12609 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 12610 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12611 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12612 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12613 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12614 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12615 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12616 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12617 | {} |
| 12618 | }; |
| 12619 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12620 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 12621 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 12622 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 12623 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 12624 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12625 | ALC268_TOSHIBA), |
| 12626 | {} |
| 12627 | }; |
| 12628 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12629 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12630 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12631 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 12632 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12633 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12634 | alc267_quanta_il1_verbs }, |
| 12635 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12636 | .dac_nids = alc268_dac_nids, |
| 12637 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12638 | .adc_nids = alc268_adc_nids_alt, |
| 12639 | .hp_nid = 0x03, |
| 12640 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12641 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12642 | .unsol_event = alc_sku_unsol_event, |
| 12643 | .setup = alc267_quanta_il1_setup, |
| 12644 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12645 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12646 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12647 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12648 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12649 | .init_verbs = { alc268_base_init_verbs }, |
| 12650 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12651 | .dac_nids = alc268_dac_nids, |
| 12652 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12653 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12654 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12655 | .hp_nid = 0x03, |
| 12656 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12657 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12658 | .channel_mode = alc268_modes, |
| 12659 | .input_mux = &alc268_capture_source, |
| 12660 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12661 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12662 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12663 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12664 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12665 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12666 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12667 | .dac_nids = alc268_dac_nids, |
| 12668 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12669 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12670 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12671 | .hp_nid = 0x03, |
| 12672 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12673 | .channel_mode = alc268_modes, |
| 12674 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12675 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12676 | .setup = alc268_toshiba_setup, |
| 12677 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12678 | }, |
| 12679 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 12680 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12681 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12682 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12683 | alc268_acer_verbs }, |
| 12684 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12685 | .dac_nids = alc268_dac_nids, |
| 12686 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12687 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12688 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12689 | .hp_nid = 0x02, |
| 12690 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12691 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12692 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12693 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12694 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12695 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12696 | [ALC268_ACER_DMIC] = { |
| 12697 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12698 | alc268_beep_mixer }, |
| 12699 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12700 | alc268_acer_verbs }, |
| 12701 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12702 | .dac_nids = alc268_dac_nids, |
| 12703 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12704 | .adc_nids = alc268_adc_nids_alt, |
| 12705 | .capsrc_nids = alc268_capsrc_nids, |
| 12706 | .hp_nid = 0x02, |
| 12707 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12708 | .channel_mode = alc268_modes, |
| 12709 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12710 | .unsol_event = alc268_acer_unsol_event, |
| 12711 | .init_hook = alc268_acer_init_hook, |
| 12712 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12713 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12714 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12715 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12716 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12717 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12718 | alc268_acer_aspire_one_verbs }, |
| 12719 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12720 | .dac_nids = alc268_dac_nids, |
| 12721 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12722 | .adc_nids = alc268_adc_nids_alt, |
| 12723 | .capsrc_nids = alc268_capsrc_nids, |
| 12724 | .hp_nid = 0x03, |
| 12725 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12726 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12727 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12728 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12729 | .init_hook = alc268_acer_lc_init_hook, |
| 12730 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12731 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12732 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 12733 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12734 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12735 | alc268_dell_verbs }, |
| 12736 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12737 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12738 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12739 | .adc_nids = alc268_adc_nids_alt, |
| 12740 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12741 | .hp_nid = 0x02, |
| 12742 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12743 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12744 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12745 | .setup = alc268_dell_setup, |
| 12746 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12747 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12748 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12749 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12750 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12751 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12752 | alc268_toshiba_verbs }, |
| 12753 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12754 | .dac_nids = alc268_dac_nids, |
| 12755 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12756 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12757 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12758 | .hp_nid = 0x03, |
| 12759 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12760 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12761 | .channel_mode = alc268_modes, |
| 12762 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12763 | .setup = alc268_toshiba_setup, |
| 12764 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12765 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12766 | #ifdef CONFIG_SND_DEBUG |
| 12767 | [ALC268_TEST] = { |
| 12768 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12769 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12770 | alc268_volume_init_verbs }, |
| 12771 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12772 | .dac_nids = alc268_dac_nids, |
| 12773 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12774 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12775 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12776 | .hp_nid = 0x03, |
| 12777 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12778 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12779 | .channel_mode = alc268_modes, |
| 12780 | .input_mux = &alc268_capture_source, |
| 12781 | }, |
| 12782 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12783 | }; |
| 12784 | |
| 12785 | static int patch_alc268(struct hda_codec *codec) |
| 12786 | { |
| 12787 | struct alc_spec *spec; |
| 12788 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12789 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12790 | |
| 12791 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12792 | if (spec == NULL) |
| 12793 | return -ENOMEM; |
| 12794 | |
| 12795 | codec->spec = spec; |
| 12796 | |
| 12797 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12798 | alc268_models, |
| 12799 | alc268_cfg_tbl); |
| 12800 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12801 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 12802 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 12803 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
| 12804 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12805 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12806 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12807 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12808 | board_config = ALC268_AUTO; |
| 12809 | } |
| 12810 | |
| 12811 | if (board_config == ALC268_AUTO) { |
| 12812 | /* automatic parse from the BIOS config */ |
| 12813 | err = alc268_parse_auto_config(codec); |
| 12814 | if (err < 0) { |
| 12815 | alc_free(codec); |
| 12816 | return err; |
| 12817 | } else if (!err) { |
| 12818 | printk(KERN_INFO |
| 12819 | "hda_codec: Cannot set up configuration " |
| 12820 | "from BIOS. Using base mode...\n"); |
| 12821 | board_config = ALC268_3ST; |
| 12822 | } |
| 12823 | } |
| 12824 | |
| 12825 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12826 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12827 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12828 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12829 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12830 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12831 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12832 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12833 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12834 | has_beep = 0; |
| 12835 | for (i = 0; i < spec->num_mixers; i++) { |
| 12836 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12837 | has_beep = 1; |
| 12838 | break; |
| 12839 | } |
| 12840 | } |
| 12841 | |
| 12842 | if (has_beep) { |
| 12843 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12844 | if (err < 0) { |
| 12845 | alc_free(codec); |
| 12846 | return err; |
| 12847 | } |
| 12848 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12849 | /* override the amp caps for beep generator */ |
| 12850 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12851 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12852 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12853 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12854 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12855 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12856 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12857 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12858 | /* check whether NID 0x07 is valid */ |
| 12859 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12860 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12861 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12862 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12863 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12864 | if (spec->auto_mic || |
| 12865 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12866 | spec->adc_nids = alc268_adc_nids_alt; |
| 12867 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12868 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 12869 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 12870 | else |
| 12871 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12872 | } else { |
| 12873 | spec->adc_nids = alc268_adc_nids; |
| 12874 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12875 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12876 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12877 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12878 | /* set default input source */ |
| 12879 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12880 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12881 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12882 | i < spec->num_mux_defs ? |
| 12883 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12884 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12885 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12886 | |
| 12887 | spec->vmaster_nid = 0x02; |
| 12888 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12889 | codec->patch_ops = alc_patch_ops; |
| 12890 | if (board_config == ALC268_AUTO) |
| 12891 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12892 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12893 | codec->proc_widget_hook = print_realtek_coef; |
| 12894 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12895 | return 0; |
| 12896 | } |
| 12897 | |
| 12898 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12899 | * ALC269 channel source setting (2 channel) |
| 12900 | */ |
| 12901 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12902 | |
| 12903 | #define alc269_dac_nids alc260_dac_nids |
| 12904 | |
| 12905 | static hda_nid_t alc269_adc_nids[1] = { |
| 12906 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12907 | 0x08, |
| 12908 | }; |
| 12909 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12910 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12911 | 0x23, |
| 12912 | }; |
| 12913 | |
| 12914 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12915 | * not a mux! |
| 12916 | */ |
| 12917 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12918 | #define alc269_modes alc260_modes |
| 12919 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12920 | |
| 12921 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12922 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12923 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12924 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12925 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12926 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12927 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12928 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12929 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12930 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12931 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12932 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12933 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12934 | { } /* end */ |
| 12935 | }; |
| 12936 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12937 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12938 | /* output mixer control */ |
| 12939 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12940 | { |
| 12941 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12942 | .name = "Master Playback Switch", |
| 12943 | .info = snd_hda_mixer_amp_switch_info, |
| 12944 | .get = snd_hda_mixer_amp_switch_get, |
| 12945 | .put = alc268_acer_master_sw_put, |
| 12946 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12947 | }, |
| 12948 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12949 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12950 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12951 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12952 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12953 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12954 | { } |
| 12955 | }; |
| 12956 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12957 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12958 | /* output mixer control */ |
| 12959 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12960 | { |
| 12961 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12962 | .name = "Master Playback Switch", |
| 12963 | .info = snd_hda_mixer_amp_switch_info, |
| 12964 | .get = snd_hda_mixer_amp_switch_get, |
| 12965 | .put = alc268_acer_master_sw_put, |
| 12966 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12967 | }, |
| 12968 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12969 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12970 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12971 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12972 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12973 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12974 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12975 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12976 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12977 | { } |
| 12978 | }; |
| 12979 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12980 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12981 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12982 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12983 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12984 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12985 | { } /* end */ |
| 12986 | }; |
| 12987 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12988 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12989 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12990 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12991 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12992 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12993 | { } /* end */ |
| 12994 | }; |
| 12995 | |
| 12996 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12997 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12998 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12999 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13000 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13001 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13002 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13003 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13004 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13005 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13006 | { } |
| 13007 | }; |
| 13008 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13009 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13010 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13011 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13012 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13013 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13014 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13015 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13016 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13017 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13018 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13019 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13020 | { } |
| 13021 | }; |
| 13022 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13023 | /* toggle speaker-output according to the hp-jack state */ |
| 13024 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13025 | { |
| 13026 | unsigned int present; |
| 13027 | unsigned char bits; |
| 13028 | |
| 13029 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13030 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13031 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13032 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13033 | AMP_IN_MUTE(0), bits); |
| 13034 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13035 | AMP_IN_MUTE(0), bits); |
| 13036 | |
| 13037 | snd_hda_codec_write(codec, 0x20, 0, |
| 13038 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13039 | snd_hda_codec_write(codec, 0x20, 0, |
| 13040 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13041 | |
| 13042 | snd_hda_codec_write(codec, 0x20, 0, |
| 13043 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13044 | snd_hda_codec_write(codec, 0x20, 0, |
| 13045 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13046 | } |
| 13047 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13048 | /* toggle speaker-output according to the hp-jacks state */ |
| 13049 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13050 | { |
| 13051 | unsigned int present; |
| 13052 | unsigned char bits; |
| 13053 | |
| 13054 | /* Check laptop headphone socket */ |
| 13055 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13056 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13057 | |
| 13058 | /* Check port replicator headphone socket */ |
| 13059 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 13060 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13061 | |
| 13062 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13063 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13064 | AMP_IN_MUTE(0), bits); |
| 13065 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13066 | AMP_IN_MUTE(0), bits); |
| 13067 | |
| 13068 | snd_hda_codec_write(codec, 0x20, 0, |
| 13069 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13070 | snd_hda_codec_write(codec, 0x20, 0, |
| 13071 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13072 | |
| 13073 | snd_hda_codec_write(codec, 0x20, 0, |
| 13074 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13075 | snd_hda_codec_write(codec, 0x20, 0, |
| 13076 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13077 | } |
| 13078 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13079 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13080 | { |
| 13081 | unsigned int present_laptop; |
| 13082 | unsigned int present_dock; |
| 13083 | |
| 13084 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 13085 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13086 | |
| 13087 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 13088 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13089 | |
| 13090 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13091 | if (present_dock) |
| 13092 | snd_hda_codec_write(codec, 0x23, 0, |
| 13093 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13094 | if (present_laptop) |
| 13095 | snd_hda_codec_write(codec, 0x23, 0, |
| 13096 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13097 | if (!present_dock && !present_laptop) |
| 13098 | snd_hda_codec_write(codec, 0x23, 0, |
| 13099 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13100 | } |
| 13101 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13102 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13103 | unsigned int res) |
| 13104 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13105 | switch (res >> 26) { |
| 13106 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13107 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13108 | break; |
| 13109 | case ALC880_MIC_EVENT: |
| 13110 | alc_mic_automute(codec); |
| 13111 | break; |
| 13112 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13113 | } |
| 13114 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13115 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13116 | unsigned int res) |
| 13117 | { |
| 13118 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13119 | alc269_lifebook_speaker_automute(codec); |
| 13120 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13121 | alc269_lifebook_mic_autoswitch(codec); |
| 13122 | } |
| 13123 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13124 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13125 | { |
| 13126 | struct alc_spec *spec = codec->spec; |
| 13127 | spec->ext_mic.pin = 0x18; |
| 13128 | spec->ext_mic.mux_idx = 0; |
| 13129 | spec->int_mic.pin = 0x19; |
| 13130 | spec->int_mic.mux_idx = 1; |
| 13131 | spec->auto_mic = 1; |
| 13132 | } |
| 13133 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13134 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13135 | { |
| 13136 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13137 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13138 | } |
| 13139 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13140 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13141 | { |
| 13142 | alc269_lifebook_speaker_automute(codec); |
| 13143 | alc269_lifebook_mic_autoswitch(codec); |
| 13144 | } |
| 13145 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13146 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 13147 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13148 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13149 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13150 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13151 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13152 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13153 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13154 | {} |
| 13155 | }; |
| 13156 | |
| 13157 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 13158 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13159 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13160 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13161 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13162 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13163 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13164 | {} |
| 13165 | }; |
| 13166 | |
| 13167 | /* toggle speaker-output according to the hp-jack state */ |
| 13168 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13169 | { |
| 13170 | unsigned int present; |
| 13171 | unsigned char bits; |
| 13172 | |
| 13173 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13174 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13175 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13176 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13177 | AMP_IN_MUTE(0), bits); |
| 13178 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13179 | AMP_IN_MUTE(0), bits); |
| 13180 | } |
| 13181 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13182 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13183 | static void alc269_eeepc_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13184 | unsigned int res) |
| 13185 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13186 | switch (res >> 26) { |
| 13187 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13188 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13189 | break; |
| 13190 | case ALC880_MIC_EVENT: |
| 13191 | alc_mic_automute(codec); |
| 13192 | break; |
| 13193 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13194 | } |
| 13195 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13196 | static void alc269_eeepc_dmic_setup(struct hda_codec *codec) |
| 13197 | { |
| 13198 | struct alc_spec *spec = codec->spec; |
| 13199 | spec->ext_mic.pin = 0x18; |
| 13200 | spec->ext_mic.mux_idx = 0; |
| 13201 | spec->int_mic.pin = 0x12; |
| 13202 | spec->int_mic.mux_idx = 5; |
| 13203 | spec->auto_mic = 1; |
| 13204 | } |
| 13205 | |
| 13206 | static void alc269_eeepc_amic_setup(struct hda_codec *codec) |
| 13207 | { |
| 13208 | struct alc_spec *spec = codec->spec; |
| 13209 | spec->ext_mic.pin = 0x18; |
| 13210 | spec->ext_mic.mux_idx = 0; |
| 13211 | spec->int_mic.pin = 0x19; |
| 13212 | spec->int_mic.mux_idx = 1; |
| 13213 | spec->auto_mic = 1; |
| 13214 | } |
| 13215 | |
| 13216 | static void alc269_eeepc_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13217 | { |
| 13218 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13219 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13220 | } |
| 13221 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13222 | /* |
| 13223 | * generic initialization of ADC, input mixers and output mixers |
| 13224 | */ |
| 13225 | static struct hda_verb alc269_init_verbs[] = { |
| 13226 | /* |
| 13227 | * Unmute ADC0 and set the default input to mic-in |
| 13228 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13229 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13230 | |
| 13231 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 13232 | * analog-loopback mixer widget |
| 13233 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 13234 | * front panel mic (mic 2) |
| 13235 | */ |
| 13236 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 13237 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13238 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13239 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13240 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13241 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13242 | |
| 13243 | /* |
| 13244 | * Set up output mixers (0x0c - 0x0e) |
| 13245 | */ |
| 13246 | /* set vol=0 to output mixers */ |
| 13247 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13248 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13249 | |
| 13250 | /* set up input amps for analog loopback */ |
| 13251 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13253 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13254 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13255 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13256 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13257 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13258 | |
| 13259 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13260 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13261 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13262 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13263 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13264 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13265 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13266 | |
| 13267 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13268 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13269 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13270 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13271 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13272 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13273 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13274 | |
| 13275 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13276 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13277 | |
| 13278 | /* FIXME: use matrix-type input source selection */ |
| 13279 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13280 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13281 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13282 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13283 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13284 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13285 | |
| 13286 | /* set EAPD */ |
| 13287 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13288 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13289 | { } |
| 13290 | }; |
| 13291 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 13292 | #define alc269_auto_create_multi_out_ctls \ |
| 13293 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13294 | #define alc269_auto_create_input_ctls \ |
| 13295 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13296 | |
| 13297 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13298 | #define alc269_loopbacks alc880_loopbacks |
| 13299 | #endif |
| 13300 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13301 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13302 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13303 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13304 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13305 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13306 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13307 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13308 | .substreams = 1, |
| 13309 | .channels_min = 2, |
| 13310 | .channels_max = 8, |
| 13311 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13312 | /* NID is set in alc_build_pcms */ |
| 13313 | .ops = { |
| 13314 | .open = alc880_playback_pcm_open, |
| 13315 | .prepare = alc880_playback_pcm_prepare, |
| 13316 | .cleanup = alc880_playback_pcm_cleanup |
| 13317 | }, |
| 13318 | }; |
| 13319 | |
| 13320 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13321 | .substreams = 1, |
| 13322 | .channels_min = 2, |
| 13323 | .channels_max = 2, |
| 13324 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13325 | /* NID is set in alc_build_pcms */ |
| 13326 | }; |
| 13327 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13328 | /* |
| 13329 | * BIOS auto configuration |
| 13330 | */ |
| 13331 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13332 | { |
| 13333 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13334 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13335 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13336 | |
| 13337 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13338 | alc269_ignore); |
| 13339 | if (err < 0) |
| 13340 | return err; |
| 13341 | |
| 13342 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13343 | if (err < 0) |
| 13344 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13345 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13346 | if (err < 0) |
| 13347 | return err; |
| 13348 | |
| 13349 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13350 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13351 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13352 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13353 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13354 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13355 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13356 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13357 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13358 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13359 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13360 | /* set default input source */ |
| 13361 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13362 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13363 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13364 | |
| 13365 | err = alc_auto_add_mic_boost(codec); |
| 13366 | if (err < 0) |
| 13367 | return err; |
| 13368 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13369 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13370 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13371 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13372 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13373 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13374 | return 1; |
| 13375 | } |
| 13376 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13377 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 13378 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13379 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13380 | |
| 13381 | |
| 13382 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13383 | static void alc269_auto_init(struct hda_codec *codec) |
| 13384 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13385 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13386 | alc269_auto_init_multi_out(codec); |
| 13387 | alc269_auto_init_hp_out(codec); |
| 13388 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13389 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13390 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13391 | } |
| 13392 | |
| 13393 | /* |
| 13394 | * configuration and preset |
| 13395 | */ |
| 13396 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13397 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13398 | [ALC269_QUANTA_FL1] = "quanta", |
| 13399 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13400 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13401 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 13402 | [ALC269_LIFEBOOK] = "lifebook", |
| 13403 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13404 | }; |
| 13405 | |
| 13406 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13407 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13408 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13409 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13410 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13411 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13412 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13413 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13414 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13415 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13416 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13417 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13418 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13419 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13420 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13421 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13422 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13423 | {} |
| 13424 | }; |
| 13425 | |
| 13426 | static struct alc_config_preset alc269_presets[] = { |
| 13427 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13428 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13429 | .init_verbs = { alc269_init_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 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13437 | [ALC269_QUANTA_FL1] = { |
| 13438 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13439 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13440 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13441 | .dac_nids = alc269_dac_nids, |
| 13442 | .hp_nid = 0x03, |
| 13443 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13444 | .channel_mode = alc269_modes, |
| 13445 | .input_mux = &alc269_capture_source, |
| 13446 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13447 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13448 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13449 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13450 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13451 | .mixers = { alc269_eeepc_mixer }, |
| 13452 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13453 | .init_verbs = { alc269_init_verbs, |
| 13454 | alc269_eeepc_amic_init_verbs }, |
| 13455 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13456 | .dac_nids = alc269_dac_nids, |
| 13457 | .hp_nid = 0x03, |
| 13458 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13459 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13460 | .unsol_event = alc269_eeepc_unsol_event, |
| 13461 | .setup = alc269_eeepc_amic_setup, |
| 13462 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13463 | }, |
| 13464 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13465 | .mixers = { alc269_eeepc_mixer }, |
| 13466 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13467 | .init_verbs = { alc269_init_verbs, |
| 13468 | alc269_eeepc_dmic_init_verbs }, |
| 13469 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13470 | .dac_nids = alc269_dac_nids, |
| 13471 | .hp_nid = 0x03, |
| 13472 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13473 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13474 | .unsol_event = alc269_eeepc_unsol_event, |
| 13475 | .setup = alc269_eeepc_dmic_setup, |
| 13476 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13477 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13478 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13479 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13480 | .cap_mixer = alc269_epc_capture_mixer, |
| 13481 | .init_verbs = { alc269_init_verbs, |
| 13482 | alc269_eeepc_dmic_init_verbs }, |
| 13483 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13484 | .dac_nids = alc269_dac_nids, |
| 13485 | .hp_nid = 0x03, |
| 13486 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13487 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13488 | .unsol_event = alc269_eeepc_unsol_event, |
| 13489 | .setup = alc269_eeepc_dmic_setup, |
| 13490 | .init_hook = alc269_eeepc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13491 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13492 | [ALC269_LIFEBOOK] = { |
| 13493 | .mixers = { alc269_lifebook_mixer }, |
| 13494 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13495 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13496 | .dac_nids = alc269_dac_nids, |
| 13497 | .hp_nid = 0x03, |
| 13498 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13499 | .channel_mode = alc269_modes, |
| 13500 | .input_mux = &alc269_capture_source, |
| 13501 | .unsol_event = alc269_lifebook_unsol_event, |
| 13502 | .init_hook = alc269_lifebook_init_hook, |
| 13503 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13504 | }; |
| 13505 | |
| 13506 | static int patch_alc269(struct hda_codec *codec) |
| 13507 | { |
| 13508 | struct alc_spec *spec; |
| 13509 | int board_config; |
| 13510 | int err; |
| 13511 | |
| 13512 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13513 | if (spec == NULL) |
| 13514 | return -ENOMEM; |
| 13515 | |
| 13516 | codec->spec = spec; |
| 13517 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13518 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13519 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13520 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13521 | alc269_models, |
| 13522 | alc269_cfg_tbl); |
| 13523 | |
| 13524 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13525 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13526 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13527 | board_config = ALC269_AUTO; |
| 13528 | } |
| 13529 | |
| 13530 | if (board_config == ALC269_AUTO) { |
| 13531 | /* automatic parse from the BIOS config */ |
| 13532 | err = alc269_parse_auto_config(codec); |
| 13533 | if (err < 0) { |
| 13534 | alc_free(codec); |
| 13535 | return err; |
| 13536 | } else if (!err) { |
| 13537 | printk(KERN_INFO |
| 13538 | "hda_codec: Cannot set up configuration " |
| 13539 | "from BIOS. Using base mode...\n"); |
| 13540 | board_config = ALC269_BASIC; |
| 13541 | } |
| 13542 | } |
| 13543 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13544 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13545 | if (err < 0) { |
| 13546 | alc_free(codec); |
| 13547 | return err; |
| 13548 | } |
| 13549 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13550 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13551 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13552 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13553 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13554 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13555 | * fix the sample rate of analog I/O to 44.1kHz |
| 13556 | */ |
| 13557 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13558 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13559 | } else { |
| 13560 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13561 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13562 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13563 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13564 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13565 | |
| 13566 | spec->adc_nids = alc269_adc_nids; |
| 13567 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13568 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13569 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13570 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13571 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13572 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 13573 | spec->vmaster_nid = 0x02; |
| 13574 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13575 | codec->patch_ops = alc_patch_ops; |
| 13576 | if (board_config == ALC269_AUTO) |
| 13577 | spec->init_hook = alc269_auto_init; |
| 13578 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13579 | if (!spec->loopback.amplist) |
| 13580 | spec->loopback.amplist = alc269_loopbacks; |
| 13581 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13582 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13583 | |
| 13584 | return 0; |
| 13585 | } |
| 13586 | |
| 13587 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13588 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13589 | */ |
| 13590 | |
| 13591 | /* |
| 13592 | * set the path ways for 2 channel output |
| 13593 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13594 | */ |
| 13595 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13596 | /* set pin widget 1Ah (line in) for input */ |
| 13597 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13598 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13599 | * the vref |
| 13600 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13601 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13602 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13603 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13604 | #if 0 |
| 13605 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13606 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13607 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13608 | { } /* end */ |
| 13609 | }; |
| 13610 | /* |
| 13611 | * 6ch mode |
| 13612 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13613 | */ |
| 13614 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13615 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13616 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13617 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13618 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13619 | |
| 13620 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13621 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13622 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13623 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13624 | #if 0 |
| 13625 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13626 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13627 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13628 | { } /* end */ |
| 13629 | }; |
| 13630 | |
| 13631 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13632 | { 2, alc861_threestack_ch2_init }, |
| 13633 | { 6, alc861_threestack_ch6_init }, |
| 13634 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13635 | /* Set mic1 as input and unmute the mixer */ |
| 13636 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13637 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13638 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13639 | { } /* end */ |
| 13640 | }; |
| 13641 | /* Set mic1 as output and mute mixer */ |
| 13642 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13643 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13644 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13645 | { } /* end */ |
| 13646 | }; |
| 13647 | |
| 13648 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13649 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13650 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13651 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13652 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13653 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13654 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13655 | /* set pin widget 1Ah (line in) for input */ |
| 13656 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13657 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13658 | * the vref |
| 13659 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13660 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13661 | |
| 13662 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13663 | #if 0 |
| 13664 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13665 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13666 | #endif |
| 13667 | { } /* end */ |
| 13668 | }; |
| 13669 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13670 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13671 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13672 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13673 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13674 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13675 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13676 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13677 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13678 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13679 | |
| 13680 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13681 | #if 0 |
| 13682 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13683 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13684 | #endif |
| 13685 | { } /* end */ |
| 13686 | }; |
| 13687 | |
| 13688 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13689 | { 2, alc861_asus_ch2_init }, |
| 13690 | { 6, alc861_asus_ch6_init }, |
| 13691 | }; |
| 13692 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13693 | /* patch-ALC861 */ |
| 13694 | |
| 13695 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13696 | /* output mixer control */ |
| 13697 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13698 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13699 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13700 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13701 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13702 | |
| 13703 | /*Input mixer control */ |
| 13704 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13705 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13706 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13707 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13708 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13709 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13710 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13711 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13712 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13713 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13714 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13715 | { } /* end */ |
| 13716 | }; |
| 13717 | |
| 13718 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13719 | /* output mixer control */ |
| 13720 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13721 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13722 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13723 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13724 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13725 | |
| 13726 | /* Input mixer control */ |
| 13727 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13728 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13729 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13730 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13731 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13732 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13733 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13734 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13735 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13736 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13737 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13738 | { |
| 13739 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13740 | .name = "Channel Mode", |
| 13741 | .info = alc_ch_mode_info, |
| 13742 | .get = alc_ch_mode_get, |
| 13743 | .put = alc_ch_mode_put, |
| 13744 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13745 | }, |
| 13746 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13747 | }; |
| 13748 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13749 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13750 | /* output mixer control */ |
| 13751 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13752 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13753 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13754 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13755 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13756 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13757 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13758 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13759 | /* output mixer control */ |
| 13760 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13761 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13762 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13763 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13764 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13765 | |
| 13766 | /* Input mixer control */ |
| 13767 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13768 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13769 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13770 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13771 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13772 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13773 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13774 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13775 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13776 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13777 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13778 | { |
| 13779 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13780 | .name = "Channel Mode", |
| 13781 | .info = alc_ch_mode_info, |
| 13782 | .get = alc_ch_mode_get, |
| 13783 | .put = alc_ch_mode_put, |
| 13784 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13785 | }, |
| 13786 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13787 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13788 | |
| 13789 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13790 | /* output mixer control */ |
| 13791 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13792 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13793 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13794 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13795 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13796 | |
| 13797 | /* Input mixer control */ |
| 13798 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13799 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13800 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13801 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13802 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13803 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13804 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13805 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13806 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13807 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13808 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13809 | { |
| 13810 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13811 | .name = "Channel Mode", |
| 13812 | .info = alc_ch_mode_info, |
| 13813 | .get = alc_ch_mode_get, |
| 13814 | .put = alc_ch_mode_put, |
| 13815 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13816 | }, |
| 13817 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13818 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13819 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13820 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13821 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13822 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13823 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13824 | { } |
| 13825 | }; |
| 13826 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13827 | /* |
| 13828 | * generic initialization of ADC, input mixers and output mixers |
| 13829 | */ |
| 13830 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13831 | /* |
| 13832 | * Unmute ADC0 and set the default input to mic-in |
| 13833 | */ |
| 13834 | /* port-A for surround (rear panel) */ |
| 13835 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13836 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 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, 0x40 }, |
| 13852 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13853 | /* port-H for side (rear panel) */ |
| 13854 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13855 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13856 | /* CD-in */ |
| 13857 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13858 | /* route front mic to ADC1*/ |
| 13859 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13860 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13861 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13862 | /* Unmute DAC0~3 & spdif out*/ |
| 13863 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13864 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13865 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13866 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13867 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13868 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13869 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13870 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13871 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13872 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13873 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13874 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13875 | /* Unmute Stereo Mixer 15 */ |
| 13876 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13877 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13878 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13879 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13880 | |
| 13881 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13882 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13883 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13884 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13885 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13886 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13887 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13888 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13889 | /* hp used DAC 3 (Front) */ |
| 13890 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13891 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13892 | |
| 13893 | { } |
| 13894 | }; |
| 13895 | |
| 13896 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13897 | /* |
| 13898 | * Unmute ADC0 and set the default input to mic-in |
| 13899 | */ |
| 13900 | /* port-A for surround (rear panel) */ |
| 13901 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13902 | /* port-B for mic-in (rear panel) with vref */ |
| 13903 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13904 | /* port-C for line-in (rear panel) */ |
| 13905 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13906 | /* port-D for Front */ |
| 13907 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13908 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13909 | /* port-E for HP out (front panel) */ |
| 13910 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13911 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13912 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13913 | /* port-F for mic-in (front panel) with vref */ |
| 13914 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13915 | /* port-G for CLFE (rear panel) */ |
| 13916 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13917 | /* port-H for side (rear panel) */ |
| 13918 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13919 | /* CD-in */ |
| 13920 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13921 | /* route front mic to ADC1*/ |
| 13922 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13923 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13924 | /* Unmute DAC0~3 & spdif out*/ |
| 13925 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13926 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13927 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13928 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13929 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13930 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13931 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13932 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13933 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13934 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13935 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13936 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13937 | /* Unmute Stereo Mixer 15 */ |
| 13938 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13939 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13940 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13941 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13942 | |
| 13943 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13944 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13945 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13946 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13947 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13948 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13949 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13950 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13951 | /* hp used DAC 3 (Front) */ |
| 13952 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13953 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13954 | { } |
| 13955 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13956 | |
| 13957 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13958 | /* |
| 13959 | * Unmute ADC0 and set the default input to mic-in |
| 13960 | */ |
| 13961 | /* port-A for surround (rear panel) */ |
| 13962 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13963 | /* port-B for mic-in (rear panel) with vref */ |
| 13964 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13965 | /* port-C for line-in (rear panel) */ |
| 13966 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13967 | /* port-D for Front */ |
| 13968 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13969 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13970 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13971 | /* this has to be set to VREF80 */ |
| 13972 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13973 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13974 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13975 | /* port-F for mic-in (front panel) with vref */ |
| 13976 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13977 | /* port-G for CLFE (rear panel) */ |
| 13978 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13979 | /* port-H for side (rear panel) */ |
| 13980 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13981 | /* CD-in */ |
| 13982 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13983 | /* route front mic to ADC1*/ |
| 13984 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13985 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13986 | /* Unmute DAC0~3 & spdif out*/ |
| 13987 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13988 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13989 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13990 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13991 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13992 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 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 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +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 */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +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)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14015 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14016 | { } |
| 14017 | }; |
| 14018 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14019 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 14020 | /* |
| 14021 | * Unmute ADC0 and set the default input to mic-in |
| 14022 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14023 | /* port-A for surround (rear panel) |
| 14024 | * according to codec#0 this is the HP jack |
| 14025 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14026 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 14027 | /* route front PCM to HP */ |
| 14028 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14029 | /* port-B for mic-in (rear panel) with vref */ |
| 14030 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14031 | /* port-C for line-in (rear panel) */ |
| 14032 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14033 | /* port-D for Front */ |
| 14034 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14035 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14036 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14037 | /* this has to be set to VREF80 */ |
| 14038 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14039 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14040 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14041 | /* port-F for mic-in (front panel) with vref */ |
| 14042 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14043 | /* port-G for CLFE (rear panel) */ |
| 14044 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14045 | /* port-H for side (rear panel) */ |
| 14046 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14047 | /* CD-in */ |
| 14048 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14049 | /* route front mic to ADC1*/ |
| 14050 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14051 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14052 | /* Unmute DAC0~3 & spdif out*/ |
| 14053 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14054 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14055 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14056 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14057 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14058 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14059 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14060 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14061 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14062 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14063 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14064 | /* Unmute Stereo Mixer 15 */ |
| 14065 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14066 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14068 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14069 | |
| 14070 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14071 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14072 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14073 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14074 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14075 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14076 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14077 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14078 | /* hp used DAC 3 (Front) */ |
| 14079 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14080 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14081 | { } |
| 14082 | }; |
| 14083 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14084 | /* additional init verbs for ASUS laptops */ |
| 14085 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14086 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14087 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14088 | { } |
| 14089 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14090 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14091 | /* |
| 14092 | * generic initialization of ADC, input mixers and output mixers |
| 14093 | */ |
| 14094 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14095 | /* |
| 14096 | * Unmute ADC0 and set the default input to mic-in |
| 14097 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14098 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14099 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14100 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14101 | /* Unmute DAC0~3 & spdif out*/ |
| 14102 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14103 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14104 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14105 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14106 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14107 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14108 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14109 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14110 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14111 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14112 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14113 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14114 | /* Unmute Stereo Mixer 15 */ |
| 14115 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14116 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14117 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14118 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14119 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14120 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14121 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14122 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14123 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14124 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14125 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14126 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14127 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14128 | |
| 14129 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14130 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14131 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14132 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14133 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14134 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14135 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14136 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14137 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14138 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14139 | |
| 14140 | { } |
| 14141 | }; |
| 14142 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14143 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14144 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14145 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14146 | { } |
| 14147 | }; |
| 14148 | |
| 14149 | /* toggle speaker-output according to the hp-jack state */ |
| 14150 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14151 | { |
| 14152 | unsigned int present; |
| 14153 | |
| 14154 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 14155 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14156 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14157 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14158 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14159 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14160 | } |
| 14161 | |
| 14162 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14163 | unsigned int res) |
| 14164 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14165 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14166 | alc861_toshiba_automute(codec); |
| 14167 | } |
| 14168 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14169 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14170 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14171 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14172 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14173 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14174 | |
| 14175 | |
| 14176 | #define ALC861_DIGOUT_NID 0x07 |
| 14177 | |
| 14178 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14179 | { 8, NULL } |
| 14180 | }; |
| 14181 | |
| 14182 | static hda_nid_t alc861_dac_nids[4] = { |
| 14183 | /* front, surround, clfe, side */ |
| 14184 | 0x03, 0x06, 0x05, 0x04 |
| 14185 | }; |
| 14186 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14187 | static hda_nid_t alc660_dac_nids[3] = { |
| 14188 | /* front, clfe, surround */ |
| 14189 | 0x03, 0x05, 0x06 |
| 14190 | }; |
| 14191 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14192 | static hda_nid_t alc861_adc_nids[1] = { |
| 14193 | /* ADC0-2 */ |
| 14194 | 0x08, |
| 14195 | }; |
| 14196 | |
| 14197 | static struct hda_input_mux alc861_capture_source = { |
| 14198 | .num_items = 5, |
| 14199 | .items = { |
| 14200 | { "Mic", 0x0 }, |
| 14201 | { "Front Mic", 0x3 }, |
| 14202 | { "Line", 0x1 }, |
| 14203 | { "CD", 0x4 }, |
| 14204 | { "Mixer", 0x5 }, |
| 14205 | }, |
| 14206 | }; |
| 14207 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14208 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 14209 | { |
| 14210 | struct alc_spec *spec = codec->spec; |
| 14211 | hda_nid_t mix, srcs[5]; |
| 14212 | int i, j, num; |
| 14213 | |
| 14214 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 14215 | return 0; |
| 14216 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14217 | if (num < 0) |
| 14218 | return 0; |
| 14219 | for (i = 0; i < num; i++) { |
| 14220 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14221 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14222 | if (type != AC_WID_AUD_OUT) |
| 14223 | continue; |
| 14224 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 14225 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 14226 | break; |
| 14227 | if (j >= spec->multiout.num_dacs) |
| 14228 | return srcs[i]; |
| 14229 | } |
| 14230 | return 0; |
| 14231 | } |
| 14232 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14233 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14234 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14235 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14236 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14237 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14238 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14239 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14240 | |
| 14241 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14242 | for (i = 0; i < cfg->line_outs; i++) { |
| 14243 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14244 | dac = alc861_look_for_dac(codec, nid); |
| 14245 | if (!dac) |
| 14246 | continue; |
| 14247 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14248 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14249 | return 0; |
| 14250 | } |
| 14251 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14252 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 14253 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14254 | { |
| 14255 | char name[32]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14256 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 14257 | return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name, |
| 14258 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 14259 | } |
| 14260 | |
| 14261 | /* add playback controls from the parsed DAC table */ |
| 14262 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 14263 | const struct auto_pin_cfg *cfg) |
| 14264 | { |
| 14265 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14266 | static const char *chname[4] = { |
| 14267 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14268 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14269 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14270 | int i, err; |
| 14271 | |
| 14272 | if (cfg->line_outs == 1) { |
| 14273 | const char *pfx = NULL; |
| 14274 | if (!cfg->hp_outs) |
| 14275 | pfx = "Master"; |
| 14276 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 14277 | pfx = "Speaker"; |
| 14278 | if (pfx) { |
| 14279 | nid = spec->multiout.dac_nids[0]; |
| 14280 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 14281 | } |
| 14282 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14283 | |
| 14284 | for (i = 0; i < cfg->line_outs; i++) { |
| 14285 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14286 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14287 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14288 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14289 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14290 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14291 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14292 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14293 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14294 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14295 | return err; |
| 14296 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14297 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14298 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14299 | return err; |
| 14300 | } |
| 14301 | } |
| 14302 | return 0; |
| 14303 | } |
| 14304 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14305 | 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] | 14306 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14307 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14308 | int err; |
| 14309 | hda_nid_t nid; |
| 14310 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14311 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14312 | return 0; |
| 14313 | |
| 14314 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14315 | nid = alc861_look_for_dac(codec, pin); |
| 14316 | if (nid) { |
| 14317 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 14318 | if (err < 0) |
| 14319 | return err; |
| 14320 | spec->multiout.hp_nid = nid; |
| 14321 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14322 | } |
| 14323 | return 0; |
| 14324 | } |
| 14325 | |
| 14326 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14327 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14328 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14329 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14330 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14331 | } |
| 14332 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14333 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14334 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14335 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14336 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14337 | hda_nid_t mix, srcs[5]; |
| 14338 | int i, num; |
| 14339 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14340 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14341 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14342 | 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] | 14343 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14344 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 14345 | return; |
| 14346 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14347 | if (num < 0) |
| 14348 | return; |
| 14349 | for (i = 0; i < num; i++) { |
| 14350 | unsigned int mute; |
| 14351 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 14352 | mute = AMP_IN_UNMUTE(i); |
| 14353 | else |
| 14354 | mute = AMP_IN_MUTE(i); |
| 14355 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14356 | mute); |
| 14357 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14358 | } |
| 14359 | |
| 14360 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14361 | { |
| 14362 | struct alc_spec *spec = codec->spec; |
| 14363 | int i; |
| 14364 | |
| 14365 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14366 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14367 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14368 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14369 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14370 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14371 | } |
| 14372 | } |
| 14373 | |
| 14374 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14375 | { |
| 14376 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14377 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 14378 | if (spec->autocfg.hp_outs) |
| 14379 | alc861_auto_set_output_and_unmute(codec, |
| 14380 | spec->autocfg.hp_pins[0], |
| 14381 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14382 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 14383 | if (spec->autocfg.speaker_outs) |
| 14384 | alc861_auto_set_output_and_unmute(codec, |
| 14385 | spec->autocfg.speaker_pins[0], |
| 14386 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14387 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14388 | } |
| 14389 | |
| 14390 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14391 | { |
| 14392 | struct alc_spec *spec = codec->spec; |
| 14393 | int i; |
| 14394 | |
| 14395 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14396 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14397 | if (nid >= 0x0c && nid <= 0x11) |
| 14398 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14399 | } |
| 14400 | } |
| 14401 | |
| 14402 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14403 | /* return 1 if successful, 0 if the proper config is not found, |
| 14404 | * or a negative error code |
| 14405 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14406 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14407 | { |
| 14408 | struct alc_spec *spec = codec->spec; |
| 14409 | int err; |
| 14410 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14411 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14412 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14413 | alc861_ignore); |
| 14414 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14415 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14416 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14417 | return 0; /* can't find valid BIOS pin config */ |
| 14418 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14419 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14420 | if (err < 0) |
| 14421 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14422 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14423 | if (err < 0) |
| 14424 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14425 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14426 | if (err < 0) |
| 14427 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14428 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14429 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14430 | return err; |
| 14431 | |
| 14432 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14433 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14434 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14435 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14436 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14437 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14438 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14439 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14440 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14441 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14442 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14443 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14444 | |
| 14445 | spec->adc_nids = alc861_adc_nids; |
| 14446 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14447 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14448 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14449 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14450 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14451 | return 1; |
| 14452 | } |
| 14453 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14454 | /* additional initialization for auto-configuration model */ |
| 14455 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14456 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14457 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14458 | alc861_auto_init_multi_out(codec); |
| 14459 | alc861_auto_init_hp_out(codec); |
| 14460 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14461 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14462 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14463 | } |
| 14464 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14465 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14466 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14467 | { 0x15, HDA_INPUT, 0 }, |
| 14468 | { 0x15, HDA_INPUT, 1 }, |
| 14469 | { 0x15, HDA_INPUT, 2 }, |
| 14470 | { 0x15, HDA_INPUT, 3 }, |
| 14471 | { } /* end */ |
| 14472 | }; |
| 14473 | #endif |
| 14474 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14475 | |
| 14476 | /* |
| 14477 | * configuration and preset |
| 14478 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14479 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14480 | [ALC861_3ST] = "3stack", |
| 14481 | [ALC660_3ST] = "3stack-660", |
| 14482 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14483 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14484 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14485 | [ALC861_TOSHIBA] = "toshiba", |
| 14486 | [ALC861_ASUS] = "asus", |
| 14487 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14488 | [ALC861_AUTO] = "auto", |
| 14489 | }; |
| 14490 | |
| 14491 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14492 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14493 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14494 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14495 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14496 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14497 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14498 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14499 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14500 | * Any other models that need this preset? |
| 14501 | */ |
| 14502 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14503 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14504 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14505 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14506 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14507 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14508 | /* FIXME: the below seems conflict */ |
| 14509 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14510 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14511 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14512 | {} |
| 14513 | }; |
| 14514 | |
| 14515 | static struct alc_config_preset alc861_presets[] = { |
| 14516 | [ALC861_3ST] = { |
| 14517 | .mixers = { alc861_3ST_mixer }, |
| 14518 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14519 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14520 | .dac_nids = alc861_dac_nids, |
| 14521 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14522 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14523 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14524 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14525 | .adc_nids = alc861_adc_nids, |
| 14526 | .input_mux = &alc861_capture_source, |
| 14527 | }, |
| 14528 | [ALC861_3ST_DIG] = { |
| 14529 | .mixers = { alc861_base_mixer }, |
| 14530 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14531 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14532 | .dac_nids = alc861_dac_nids, |
| 14533 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14534 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14535 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14536 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14537 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14538 | .adc_nids = alc861_adc_nids, |
| 14539 | .input_mux = &alc861_capture_source, |
| 14540 | }, |
| 14541 | [ALC861_6ST_DIG] = { |
| 14542 | .mixers = { alc861_base_mixer }, |
| 14543 | .init_verbs = { alc861_base_init_verbs }, |
| 14544 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14545 | .dac_nids = alc861_dac_nids, |
| 14546 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14547 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14548 | .channel_mode = alc861_8ch_modes, |
| 14549 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14550 | .adc_nids = alc861_adc_nids, |
| 14551 | .input_mux = &alc861_capture_source, |
| 14552 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14553 | [ALC660_3ST] = { |
| 14554 | .mixers = { alc861_3ST_mixer }, |
| 14555 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14556 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14557 | .dac_nids = alc660_dac_nids, |
| 14558 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14559 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14560 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14561 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14562 | .adc_nids = alc861_adc_nids, |
| 14563 | .input_mux = &alc861_capture_source, |
| 14564 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14565 | [ALC861_UNIWILL_M31] = { |
| 14566 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14567 | .init_verbs = { alc861_uniwill_m31_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_uniwill_m31_modes), |
| 14572 | .channel_mode = alc861_uniwill_m31_modes, |
| 14573 | .need_dac_fix = 1, |
| 14574 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14575 | .adc_nids = alc861_adc_nids, |
| 14576 | .input_mux = &alc861_capture_source, |
| 14577 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14578 | [ALC861_TOSHIBA] = { |
| 14579 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14580 | .init_verbs = { alc861_base_init_verbs, |
| 14581 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14582 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14583 | .dac_nids = alc861_dac_nids, |
| 14584 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14585 | .channel_mode = alc883_3ST_2ch_modes, |
| 14586 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14587 | .adc_nids = alc861_adc_nids, |
| 14588 | .input_mux = &alc861_capture_source, |
| 14589 | .unsol_event = alc861_toshiba_unsol_event, |
| 14590 | .init_hook = alc861_toshiba_automute, |
| 14591 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14592 | [ALC861_ASUS] = { |
| 14593 | .mixers = { alc861_asus_mixer }, |
| 14594 | .init_verbs = { alc861_asus_init_verbs }, |
| 14595 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14596 | .dac_nids = alc861_dac_nids, |
| 14597 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14598 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14599 | .channel_mode = alc861_asus_modes, |
| 14600 | .need_dac_fix = 1, |
| 14601 | .hp_nid = 0x06, |
| 14602 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14603 | .adc_nids = alc861_adc_nids, |
| 14604 | .input_mux = &alc861_capture_source, |
| 14605 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14606 | [ALC861_ASUS_LAPTOP] = { |
| 14607 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14608 | .init_verbs = { alc861_asus_init_verbs, |
| 14609 | alc861_asus_laptop_init_verbs }, |
| 14610 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14611 | .dac_nids = alc861_dac_nids, |
| 14612 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14613 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14614 | .channel_mode = alc883_3ST_2ch_modes, |
| 14615 | .need_dac_fix = 1, |
| 14616 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14617 | .adc_nids = alc861_adc_nids, |
| 14618 | .input_mux = &alc861_capture_source, |
| 14619 | }, |
| 14620 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14621 | |
| 14622 | |
| 14623 | static int patch_alc861(struct hda_codec *codec) |
| 14624 | { |
| 14625 | struct alc_spec *spec; |
| 14626 | int board_config; |
| 14627 | int err; |
| 14628 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14629 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14630 | if (spec == NULL) |
| 14631 | return -ENOMEM; |
| 14632 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14633 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14634 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14635 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14636 | alc861_models, |
| 14637 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14638 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14639 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14640 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14641 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14642 | board_config = ALC861_AUTO; |
| 14643 | } |
| 14644 | |
| 14645 | if (board_config == ALC861_AUTO) { |
| 14646 | /* automatic parse from the BIOS config */ |
| 14647 | err = alc861_parse_auto_config(codec); |
| 14648 | if (err < 0) { |
| 14649 | alc_free(codec); |
| 14650 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14651 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14652 | printk(KERN_INFO |
| 14653 | "hda_codec: Cannot set up configuration " |
| 14654 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14655 | board_config = ALC861_3ST_DIG; |
| 14656 | } |
| 14657 | } |
| 14658 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14659 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14660 | if (err < 0) { |
| 14661 | alc_free(codec); |
| 14662 | return err; |
| 14663 | } |
| 14664 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14665 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14666 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14667 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14668 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14669 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14670 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14671 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14672 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14673 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14674 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14675 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14676 | spec->vmaster_nid = 0x03; |
| 14677 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14678 | codec->patch_ops = alc_patch_ops; |
| 14679 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14680 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14681 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14682 | if (!spec->loopback.amplist) |
| 14683 | spec->loopback.amplist = alc861_loopbacks; |
| 14684 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14685 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14686 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14687 | return 0; |
| 14688 | } |
| 14689 | |
| 14690 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14691 | * ALC861-VD support |
| 14692 | * |
| 14693 | * Based on ALC882 |
| 14694 | * |
| 14695 | * In addition, an independent DAC |
| 14696 | */ |
| 14697 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14698 | |
| 14699 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14700 | /* front, surr, clfe, side surr */ |
| 14701 | 0x02, 0x03, 0x04, 0x05 |
| 14702 | }; |
| 14703 | |
| 14704 | /* dac_nids for ALC660vd are in a different order - according to |
| 14705 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14706 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14707 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14708 | * - and it is the same as in 861vd. |
| 14709 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14710 | */ |
| 14711 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14712 | /* front, rear, clfe, rear_surr */ |
| 14713 | 0x02, 0x04, 0x03 |
| 14714 | }; |
| 14715 | |
| 14716 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14717 | /* ADC0 */ |
| 14718 | 0x09, |
| 14719 | }; |
| 14720 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14721 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14722 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14723 | /* input MUX */ |
| 14724 | /* FIXME: should be a matrix-type input source selection */ |
| 14725 | static struct hda_input_mux alc861vd_capture_source = { |
| 14726 | .num_items = 4, |
| 14727 | .items = { |
| 14728 | { "Mic", 0x0 }, |
| 14729 | { "Front Mic", 0x1 }, |
| 14730 | { "Line", 0x2 }, |
| 14731 | { "CD", 0x4 }, |
| 14732 | }, |
| 14733 | }; |
| 14734 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14735 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14736 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14737 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14738 | { "Ext Mic", 0x0 }, |
| 14739 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14740 | }, |
| 14741 | }; |
| 14742 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14743 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14744 | .num_items = 2, |
| 14745 | .items = { |
| 14746 | { "Front Mic", 0x0 }, |
| 14747 | { "ATAPI Mic", 0x1 }, |
| 14748 | }, |
| 14749 | }; |
| 14750 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14751 | /* |
| 14752 | * 2ch mode |
| 14753 | */ |
| 14754 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14755 | { 2, NULL } |
| 14756 | }; |
| 14757 | |
| 14758 | /* |
| 14759 | * 6ch mode |
| 14760 | */ |
| 14761 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14762 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14763 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14764 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14765 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14766 | { } /* end */ |
| 14767 | }; |
| 14768 | |
| 14769 | /* |
| 14770 | * 8ch mode |
| 14771 | */ |
| 14772 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14773 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14774 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14775 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14776 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14777 | { } /* end */ |
| 14778 | }; |
| 14779 | |
| 14780 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14781 | { 6, alc861vd_6stack_ch6_init }, |
| 14782 | { 8, alc861vd_6stack_ch8_init }, |
| 14783 | }; |
| 14784 | |
| 14785 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14786 | { |
| 14787 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14788 | .name = "Channel Mode", |
| 14789 | .info = alc_ch_mode_info, |
| 14790 | .get = alc_ch_mode_get, |
| 14791 | .put = alc_ch_mode_put, |
| 14792 | }, |
| 14793 | { } /* end */ |
| 14794 | }; |
| 14795 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14796 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14797 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14798 | */ |
| 14799 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14800 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14801 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14802 | |
| 14803 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14804 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14805 | |
| 14806 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14807 | HDA_OUTPUT), |
| 14808 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14809 | HDA_OUTPUT), |
| 14810 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14811 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14812 | |
| 14813 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14814 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14815 | |
| 14816 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14817 | |
| 14818 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14821 | |
| 14822 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14823 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14824 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14825 | |
| 14826 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14827 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14828 | |
| 14829 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14830 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14831 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14832 | { } /* end */ |
| 14833 | }; |
| 14834 | |
| 14835 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14836 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14837 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14838 | |
| 14839 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14840 | |
| 14841 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14842 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14843 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14844 | |
| 14845 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14846 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14847 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14848 | |
| 14849 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14850 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14851 | |
| 14852 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14853 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14854 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14855 | { } /* end */ |
| 14856 | }; |
| 14857 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14858 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14859 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14860 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14861 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14862 | |
| 14863 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14864 | |
| 14865 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14866 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14867 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14868 | |
| 14869 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14870 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14871 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14872 | |
| 14873 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14874 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14875 | |
| 14876 | { } /* end */ |
| 14877 | }; |
| 14878 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14879 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14880 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14881 | */ |
| 14882 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14883 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14884 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14885 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14886 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14887 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14888 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14889 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14890 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14891 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14892 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14893 | { } /* end */ |
| 14894 | }; |
| 14895 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14896 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14897 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14898 | */ |
| 14899 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14900 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14901 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14902 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14903 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14904 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14905 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14906 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14907 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14908 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14909 | { } /* end */ |
| 14910 | }; |
| 14911 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14912 | /* |
| 14913 | * generic initialization of ADC, input mixers and output mixers |
| 14914 | */ |
| 14915 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14916 | /* |
| 14917 | * Unmute ADC0 and set the default input to mic-in |
| 14918 | */ |
| 14919 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14920 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14921 | |
| 14922 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14923 | * the analog-loopback mixer widget |
| 14924 | */ |
| 14925 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14927 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14928 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14929 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14930 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14931 | |
| 14932 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14933 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14934 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14935 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14936 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14937 | |
| 14938 | /* |
| 14939 | * Set up output mixers (0x02 - 0x05) |
| 14940 | */ |
| 14941 | /* set vol=0 to output mixers */ |
| 14942 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14943 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14944 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14945 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14946 | |
| 14947 | /* set up input amps for analog loopback */ |
| 14948 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14949 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14950 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14951 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14952 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14953 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14954 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14955 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14956 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14957 | |
| 14958 | { } |
| 14959 | }; |
| 14960 | |
| 14961 | /* |
| 14962 | * 3-stack pin configuration: |
| 14963 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14964 | */ |
| 14965 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14966 | /* |
| 14967 | * Set pin mode and muting |
| 14968 | */ |
| 14969 | /* set front pin widgets 0x14 for output */ |
| 14970 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14971 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14972 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14973 | |
| 14974 | /* Mic (rear) pin: input vref at 80% */ |
| 14975 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14976 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14977 | /* Front Mic pin: input vref at 80% */ |
| 14978 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14979 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14980 | /* Line In pin: input */ |
| 14981 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14982 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14983 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14984 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14985 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14986 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14987 | /* CD pin widget for input */ |
| 14988 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14989 | |
| 14990 | { } |
| 14991 | }; |
| 14992 | |
| 14993 | /* |
| 14994 | * 6-stack pin configuration: |
| 14995 | */ |
| 14996 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14997 | /* |
| 14998 | * Set pin mode and muting |
| 14999 | */ |
| 15000 | /* set front pin widgets 0x14 for output */ |
| 15001 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15002 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15003 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15004 | |
| 15005 | /* Rear Pin: output 1 (0x0d) */ |
| 15006 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15007 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15008 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 15009 | /* CLFE Pin: output 2 (0x0e) */ |
| 15010 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15011 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15012 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 15013 | /* Side Pin: output 3 (0x0f) */ |
| 15014 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15015 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15016 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 15017 | |
| 15018 | /* Mic (rear) pin: input vref at 80% */ |
| 15019 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15020 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15021 | /* Front Mic pin: input vref at 80% */ |
| 15022 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15023 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15024 | /* Line In pin: input */ |
| 15025 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15026 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15027 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15028 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15029 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15030 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15031 | /* CD pin widget for input */ |
| 15032 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15033 | |
| 15034 | { } |
| 15035 | }; |
| 15036 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15037 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 15038 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15039 | { } |
| 15040 | }; |
| 15041 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15042 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 15043 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15044 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15045 | { } |
| 15046 | }; |
| 15047 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15048 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 15049 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15050 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15051 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 15052 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15053 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15054 | {} |
| 15055 | }; |
| 15056 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15057 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 15058 | { |
| 15059 | unsigned int present; |
| 15060 | unsigned char bits; |
| 15061 | |
| 15062 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15063 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15064 | bits = present ? HDA_AMP_MUTE : 0; |
| 15065 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15066 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15067 | } |
| 15068 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15069 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15070 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15071 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15072 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15073 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15074 | } |
| 15075 | |
| 15076 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 15077 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15078 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15079 | alc861vd_lenovo_mic_automute(codec); |
| 15080 | } |
| 15081 | |
| 15082 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15083 | unsigned int res) |
| 15084 | { |
| 15085 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15086 | case ALC880_MIC_EVENT: |
| 15087 | alc861vd_lenovo_mic_automute(codec); |
| 15088 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15089 | default: |
| 15090 | alc_automute_amp_unsol_event(codec, res); |
| 15091 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15092 | } |
| 15093 | } |
| 15094 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15095 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15096 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15097 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15098 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15099 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15100 | |
| 15101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15103 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15104 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15105 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15106 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15107 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15108 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15109 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15110 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15111 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15112 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15113 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15114 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15115 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15116 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15117 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15118 | |
| 15119 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15120 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15121 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15122 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15123 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15124 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15125 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15126 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15127 | |
| 15128 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15129 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15130 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15131 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15132 | |
| 15133 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15134 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15135 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15136 | |
| 15137 | { } /* end */ |
| 15138 | }; |
| 15139 | |
| 15140 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15141 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15142 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15143 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15144 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15145 | spec->autocfg.hp_pins[0] = 0x15; |
| 15146 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15147 | } |
| 15148 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15149 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15150 | #define alc861vd_loopbacks alc880_loopbacks |
| 15151 | #endif |
| 15152 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15153 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15154 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15155 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15156 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15157 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15158 | |
| 15159 | /* |
| 15160 | * configuration and preset |
| 15161 | */ |
| 15162 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15163 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15164 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15165 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15166 | [ALC861VD_3ST] = "3stack", |
| 15167 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15168 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15169 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15170 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15171 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15172 | [ALC861VD_AUTO] = "auto", |
| 15173 | }; |
| 15174 | |
| 15175 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15176 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15177 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15178 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15179 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15180 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15181 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15182 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15183 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15184 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 15185 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15186 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15187 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15188 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15189 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15190 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15191 | {} |
| 15192 | }; |
| 15193 | |
| 15194 | static struct alc_config_preset alc861vd_presets[] = { |
| 15195 | [ALC660VD_3ST] = { |
| 15196 | .mixers = { alc861vd_3st_mixer }, |
| 15197 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15198 | alc861vd_3stack_init_verbs }, |
| 15199 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15200 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15201 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15202 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15203 | .input_mux = &alc861vd_capture_source, |
| 15204 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15205 | [ALC660VD_3ST_DIG] = { |
| 15206 | .mixers = { alc861vd_3st_mixer }, |
| 15207 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15208 | alc861vd_3stack_init_verbs }, |
| 15209 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15210 | .dac_nids = alc660vd_dac_nids, |
| 15211 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15212 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15213 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15214 | .input_mux = &alc861vd_capture_source, |
| 15215 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15216 | [ALC861VD_3ST] = { |
| 15217 | .mixers = { alc861vd_3st_mixer }, |
| 15218 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15219 | alc861vd_3stack_init_verbs }, |
| 15220 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15221 | .dac_nids = alc861vd_dac_nids, |
| 15222 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15223 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15224 | .input_mux = &alc861vd_capture_source, |
| 15225 | }, |
| 15226 | [ALC861VD_3ST_DIG] = { |
| 15227 | .mixers = { alc861vd_3st_mixer }, |
| 15228 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15229 | alc861vd_3stack_init_verbs }, |
| 15230 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15231 | .dac_nids = alc861vd_dac_nids, |
| 15232 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15233 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15234 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15235 | .input_mux = &alc861vd_capture_source, |
| 15236 | }, |
| 15237 | [ALC861VD_6ST_DIG] = { |
| 15238 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15239 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15240 | alc861vd_6stack_init_verbs }, |
| 15241 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15242 | .dac_nids = alc861vd_dac_nids, |
| 15243 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15244 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15245 | .channel_mode = alc861vd_6stack_modes, |
| 15246 | .input_mux = &alc861vd_capture_source, |
| 15247 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15248 | [ALC861VD_LENOVO] = { |
| 15249 | .mixers = { alc861vd_lenovo_mixer }, |
| 15250 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15251 | alc861vd_3stack_init_verbs, |
| 15252 | alc861vd_eapd_verbs, |
| 15253 | alc861vd_lenovo_unsol_verbs }, |
| 15254 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15255 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15256 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15257 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15258 | .input_mux = &alc861vd_capture_source, |
| 15259 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15260 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15261 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15262 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15263 | [ALC861VD_DALLAS] = { |
| 15264 | .mixers = { alc861vd_dallas_mixer }, |
| 15265 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15266 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15267 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15268 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15269 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15270 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15271 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15272 | .setup = alc861vd_dallas_setup, |
| 15273 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15274 | }, |
| 15275 | [ALC861VD_HP] = { |
| 15276 | .mixers = { alc861vd_hp_mixer }, |
| 15277 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15278 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15279 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15280 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15281 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15282 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15283 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15284 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15285 | .setup = alc861vd_dallas_setup, |
| 15286 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15287 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15288 | [ALC660VD_ASUS_V1S] = { |
| 15289 | .mixers = { alc861vd_lenovo_mixer }, |
| 15290 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15291 | alc861vd_3stack_init_verbs, |
| 15292 | alc861vd_eapd_verbs, |
| 15293 | alc861vd_lenovo_unsol_verbs }, |
| 15294 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15295 | .dac_nids = alc660vd_dac_nids, |
| 15296 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15297 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15298 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15299 | .input_mux = &alc861vd_capture_source, |
| 15300 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15301 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15302 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15303 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15304 | }; |
| 15305 | |
| 15306 | /* |
| 15307 | * BIOS auto configuration |
| 15308 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15309 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 15310 | const struct auto_pin_cfg *cfg) |
| 15311 | { |
| 15312 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
| 15313 | } |
| 15314 | |
| 15315 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15316 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15317 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15318 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15319 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15320 | } |
| 15321 | |
| 15322 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15323 | { |
| 15324 | struct alc_spec *spec = codec->spec; |
| 15325 | int i; |
| 15326 | |
| 15327 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15328 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15329 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15330 | if (nid) |
| 15331 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15332 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15333 | } |
| 15334 | } |
| 15335 | |
| 15336 | |
| 15337 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15338 | { |
| 15339 | struct alc_spec *spec = codec->spec; |
| 15340 | hda_nid_t pin; |
| 15341 | |
| 15342 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15343 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15344 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15345 | pin = spec->autocfg.speaker_pins[0]; |
| 15346 | if (pin) |
| 15347 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15348 | } |
| 15349 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15350 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15351 | |
| 15352 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15353 | { |
| 15354 | struct alc_spec *spec = codec->spec; |
| 15355 | int i; |
| 15356 | |
| 15357 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15358 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15359 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15360 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15361 | if (nid != ALC861VD_PIN_CD_NID && |
| 15362 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15363 | snd_hda_codec_write(codec, nid, 0, |
| 15364 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15365 | AMP_OUT_MUTE); |
| 15366 | } |
| 15367 | } |
| 15368 | } |
| 15369 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15370 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15371 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15372 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15373 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15374 | |
| 15375 | /* add playback controls from the parsed DAC table */ |
| 15376 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15377 | * different NIDs for mute/unmute switch and volume control */ |
| 15378 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15379 | const struct auto_pin_cfg *cfg) |
| 15380 | { |
| 15381 | char name[32]; |
| 15382 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15383 | hda_nid_t nid_v, nid_s; |
| 15384 | int i, err; |
| 15385 | |
| 15386 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15387 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15388 | continue; |
| 15389 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15390 | alc880_dac_to_idx( |
| 15391 | spec->multiout.dac_nids[i])); |
| 15392 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15393 | alc880_dac_to_idx( |
| 15394 | spec->multiout.dac_nids[i])); |
| 15395 | |
| 15396 | if (i == 2) { |
| 15397 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15398 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15399 | "Center Playback Volume", |
| 15400 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15401 | HDA_OUTPUT)); |
| 15402 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15403 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15404 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15405 | "LFE Playback Volume", |
| 15406 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15407 | HDA_OUTPUT)); |
| 15408 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15409 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15410 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15411 | "Center Playback Switch", |
| 15412 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15413 | HDA_INPUT)); |
| 15414 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15415 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15416 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15417 | "LFE Playback Switch", |
| 15418 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15419 | HDA_INPUT)); |
| 15420 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15421 | return err; |
| 15422 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15423 | const char *pfx; |
| 15424 | if (cfg->line_outs == 1 && |
| 15425 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 15426 | if (!cfg->hp_pins) |
| 15427 | pfx = "Speaker"; |
| 15428 | else |
| 15429 | pfx = "PCM"; |
| 15430 | } else |
| 15431 | pfx = chname[i]; |
| 15432 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15433 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15434 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15435 | HDA_OUTPUT)); |
| 15436 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15437 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15438 | if (cfg->line_outs == 1 && |
| 15439 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15440 | pfx = "Speaker"; |
| 15441 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15442 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15443 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15444 | HDA_INPUT)); |
| 15445 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15446 | return err; |
| 15447 | } |
| 15448 | } |
| 15449 | return 0; |
| 15450 | } |
| 15451 | |
| 15452 | /* add playback controls for speaker and HP outputs */ |
| 15453 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15454 | * different NIDs for mute/unmute switch and volume control */ |
| 15455 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15456 | hda_nid_t pin, const char *pfx) |
| 15457 | { |
| 15458 | hda_nid_t nid_v, nid_s; |
| 15459 | int err; |
| 15460 | char name[32]; |
| 15461 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15462 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15463 | return 0; |
| 15464 | |
| 15465 | if (alc880_is_fixed_pin(pin)) { |
| 15466 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15467 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15468 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15469 | spec->multiout.hp_nid = nid_v; |
| 15470 | else |
| 15471 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15472 | /* control HP volume/switch on the output mixer amp */ |
| 15473 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15474 | alc880_fixed_pin_idx(pin)); |
| 15475 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15476 | alc880_fixed_pin_idx(pin)); |
| 15477 | |
| 15478 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15479 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15480 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15481 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15482 | return err; |
| 15483 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15484 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15485 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15486 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15487 | return err; |
| 15488 | } else if (alc880_is_multi_pin(pin)) { |
| 15489 | /* set manual connection */ |
| 15490 | /* we have only a switch on HP-out PIN */ |
| 15491 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15492 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15493 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15494 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15495 | return err; |
| 15496 | } |
| 15497 | return 0; |
| 15498 | } |
| 15499 | |
| 15500 | /* parse the BIOS configuration and set up the alc_spec |
| 15501 | * return 1 if successful, 0 if the proper config is not found, |
| 15502 | * or a negative error code |
| 15503 | * Based on ALC880 version - had to change it to override |
| 15504 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15505 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15506 | { |
| 15507 | struct alc_spec *spec = codec->spec; |
| 15508 | int err; |
| 15509 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15510 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15511 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15512 | alc861vd_ignore); |
| 15513 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15514 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15515 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15516 | return 0; /* can't find valid BIOS pin config */ |
| 15517 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15518 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15519 | if (err < 0) |
| 15520 | return err; |
| 15521 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15522 | if (err < 0) |
| 15523 | return err; |
| 15524 | err = alc861vd_auto_create_extra_out(spec, |
| 15525 | spec->autocfg.speaker_pins[0], |
| 15526 | "Speaker"); |
| 15527 | if (err < 0) |
| 15528 | return err; |
| 15529 | err = alc861vd_auto_create_extra_out(spec, |
| 15530 | spec->autocfg.hp_pins[0], |
| 15531 | "Headphone"); |
| 15532 | if (err < 0) |
| 15533 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15534 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15535 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15536 | return err; |
| 15537 | |
| 15538 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15539 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15540 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15541 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15542 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15543 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15544 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15545 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15546 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15547 | |
| 15548 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15549 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15550 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15551 | err = alc_auto_add_mic_boost(codec); |
| 15552 | if (err < 0) |
| 15553 | return err; |
| 15554 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15555 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15556 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15557 | return 1; |
| 15558 | } |
| 15559 | |
| 15560 | /* additional initialization for auto-configuration model */ |
| 15561 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15562 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15563 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15564 | alc861vd_auto_init_multi_out(codec); |
| 15565 | alc861vd_auto_init_hp_out(codec); |
| 15566 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15567 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15568 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15569 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15570 | } |
| 15571 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15572 | enum { |
| 15573 | ALC660VD_FIX_ASUS_GPIO1 |
| 15574 | }; |
| 15575 | |
| 15576 | /* reset GPIO1 */ |
| 15577 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { |
| 15578 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 15579 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 15580 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 15581 | { } |
| 15582 | }; |
| 15583 | |
| 15584 | static const struct alc_fixup alc861vd_fixups[] = { |
| 15585 | [ALC660VD_FIX_ASUS_GPIO1] = { |
| 15586 | .verbs = alc660vd_fix_asus_gpio1_verbs, |
| 15587 | }, |
| 15588 | }; |
| 15589 | |
| 15590 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 15591 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 15592 | {} |
| 15593 | }; |
| 15594 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15595 | static int patch_alc861vd(struct hda_codec *codec) |
| 15596 | { |
| 15597 | struct alc_spec *spec; |
| 15598 | int err, board_config; |
| 15599 | |
| 15600 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15601 | if (spec == NULL) |
| 15602 | return -ENOMEM; |
| 15603 | |
| 15604 | codec->spec = spec; |
| 15605 | |
| 15606 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15607 | alc861vd_models, |
| 15608 | alc861vd_cfg_tbl); |
| 15609 | |
| 15610 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15611 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15612 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15613 | board_config = ALC861VD_AUTO; |
| 15614 | } |
| 15615 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15616 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups); |
| 15617 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15618 | if (board_config == ALC861VD_AUTO) { |
| 15619 | /* automatic parse from the BIOS config */ |
| 15620 | err = alc861vd_parse_auto_config(codec); |
| 15621 | if (err < 0) { |
| 15622 | alc_free(codec); |
| 15623 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15624 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15625 | printk(KERN_INFO |
| 15626 | "hda_codec: Cannot set up configuration " |
| 15627 | "from BIOS. Using base mode...\n"); |
| 15628 | board_config = ALC861VD_3ST; |
| 15629 | } |
| 15630 | } |
| 15631 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15632 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15633 | if (err < 0) { |
| 15634 | alc_free(codec); |
| 15635 | return err; |
| 15636 | } |
| 15637 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15638 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15639 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15640 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15641 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15642 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15643 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15644 | } |
| 15645 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15646 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15647 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15648 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15649 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15650 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15651 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 15652 | if (!spec->adc_nids) { |
| 15653 | spec->adc_nids = alc861vd_adc_nids; |
| 15654 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 15655 | } |
| 15656 | if (!spec->capsrc_nids) |
| 15657 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15658 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15659 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15660 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15661 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15662 | spec->vmaster_nid = 0x02; |
| 15663 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15664 | codec->patch_ops = alc_patch_ops; |
| 15665 | |
| 15666 | if (board_config == ALC861VD_AUTO) |
| 15667 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15668 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15669 | if (!spec->loopback.amplist) |
| 15670 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15671 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15672 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15673 | |
| 15674 | return 0; |
| 15675 | } |
| 15676 | |
| 15677 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15678 | * ALC662 support |
| 15679 | * |
| 15680 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15681 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15682 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15683 | * 6-channel independent captures. |
| 15684 | * |
| 15685 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15686 | * driver yet). |
| 15687 | */ |
| 15688 | #define ALC662_DIGOUT_NID 0x06 |
| 15689 | #define ALC662_DIGIN_NID 0x0a |
| 15690 | |
| 15691 | static hda_nid_t alc662_dac_nids[4] = { |
| 15692 | /* front, rear, clfe, rear_surr */ |
| 15693 | 0x02, 0x03, 0x04 |
| 15694 | }; |
| 15695 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15696 | static hda_nid_t alc272_dac_nids[2] = { |
| 15697 | 0x02, 0x03 |
| 15698 | }; |
| 15699 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15700 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15701 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15702 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15703 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15704 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15705 | static hda_nid_t alc272_adc_nids[1] = { |
| 15706 | /* ADC1-2 */ |
| 15707 | 0x08, |
| 15708 | }; |
| 15709 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15710 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15711 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15712 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15713 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15714 | /* input MUX */ |
| 15715 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15716 | static struct hda_input_mux alc662_capture_source = { |
| 15717 | .num_items = 4, |
| 15718 | .items = { |
| 15719 | { "Mic", 0x0 }, |
| 15720 | { "Front Mic", 0x1 }, |
| 15721 | { "Line", 0x2 }, |
| 15722 | { "CD", 0x4 }, |
| 15723 | }, |
| 15724 | }; |
| 15725 | |
| 15726 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15727 | .num_items = 2, |
| 15728 | .items = { |
| 15729 | { "Mic", 0x1 }, |
| 15730 | { "Line", 0x2 }, |
| 15731 | }, |
| 15732 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15733 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15734 | static struct hda_input_mux alc663_capture_source = { |
| 15735 | .num_items = 3, |
| 15736 | .items = { |
| 15737 | { "Mic", 0x0 }, |
| 15738 | { "Front Mic", 0x1 }, |
| 15739 | { "Line", 0x2 }, |
| 15740 | }, |
| 15741 | }; |
| 15742 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15743 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15744 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15745 | .num_items = 16, |
| 15746 | .items = { |
| 15747 | { "Autoselect Mic", 0x0 }, |
| 15748 | { "Internal Mic", 0x1 }, |
| 15749 | { "In-0x02", 0x2 }, |
| 15750 | { "In-0x03", 0x3 }, |
| 15751 | { "In-0x04", 0x4 }, |
| 15752 | { "In-0x05", 0x5 }, |
| 15753 | { "In-0x06", 0x6 }, |
| 15754 | { "In-0x07", 0x7 }, |
| 15755 | { "In-0x08", 0x8 }, |
| 15756 | { "In-0x09", 0x9 }, |
| 15757 | { "In-0x0a", 0x0a }, |
| 15758 | { "In-0x0b", 0x0b }, |
| 15759 | { "In-0x0c", 0x0c }, |
| 15760 | { "In-0x0d", 0x0d }, |
| 15761 | { "In-0x0e", 0x0e }, |
| 15762 | { "In-0x0f", 0x0f }, |
| 15763 | }, |
| 15764 | }; |
| 15765 | #endif |
| 15766 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15767 | /* |
| 15768 | * 2ch mode |
| 15769 | */ |
| 15770 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15771 | { 2, NULL } |
| 15772 | }; |
| 15773 | |
| 15774 | /* |
| 15775 | * 2ch mode |
| 15776 | */ |
| 15777 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15778 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15779 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15780 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15781 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15782 | { } /* end */ |
| 15783 | }; |
| 15784 | |
| 15785 | /* |
| 15786 | * 6ch mode |
| 15787 | */ |
| 15788 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15789 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15790 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15791 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15792 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15793 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15794 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15795 | { } /* end */ |
| 15796 | }; |
| 15797 | |
| 15798 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15799 | { 2, alc662_3ST_ch2_init }, |
| 15800 | { 6, alc662_3ST_ch6_init }, |
| 15801 | }; |
| 15802 | |
| 15803 | /* |
| 15804 | * 2ch mode |
| 15805 | */ |
| 15806 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15807 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15808 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15809 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15810 | { } /* end */ |
| 15811 | }; |
| 15812 | |
| 15813 | /* |
| 15814 | * 6ch mode |
| 15815 | */ |
| 15816 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15817 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15818 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15819 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15820 | { } /* end */ |
| 15821 | }; |
| 15822 | |
| 15823 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15824 | { 2, alc662_sixstack_ch6_init }, |
| 15825 | { 6, alc662_sixstack_ch8_init }, |
| 15826 | }; |
| 15827 | |
| 15828 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15829 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15830 | */ |
| 15831 | |
| 15832 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15833 | /* output mixer control */ |
| 15834 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15835 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15836 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15837 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15838 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15839 | 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] | 15840 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15841 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15842 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15843 | |
| 15844 | /*Input mixer control */ |
| 15845 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15846 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15847 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15848 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15849 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15850 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15851 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15852 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15853 | { } /* end */ |
| 15854 | }; |
| 15855 | |
| 15856 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15857 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15858 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15859 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15860 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15861 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15862 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15863 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15864 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15865 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15866 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15867 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15868 | { } /* end */ |
| 15869 | }; |
| 15870 | |
| 15871 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15872 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15873 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15874 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15875 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15876 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15877 | 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] | 15878 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15879 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15880 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15881 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15882 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15883 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15884 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15885 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15886 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15887 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15888 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15889 | { } /* end */ |
| 15890 | }; |
| 15891 | |
| 15892 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15893 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15894 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15895 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15896 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15897 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15898 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15899 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15900 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15901 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15902 | { } /* end */ |
| 15903 | }; |
| 15904 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15905 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15906 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15907 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15908 | |
| 15909 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15910 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15911 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15912 | |
| 15913 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15914 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15915 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15916 | { } /* end */ |
| 15917 | }; |
| 15918 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15919 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15920 | ALC262_HIPPO_MASTER_SWITCH, |
| 15921 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15922 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15923 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15924 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15925 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15926 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15927 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15928 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15929 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15930 | { } /* end */ |
| 15931 | }; |
| 15932 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15933 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15934 | .ops = &snd_hda_bind_vol, |
| 15935 | .values = { |
| 15936 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15937 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15938 | 0 |
| 15939 | }, |
| 15940 | }; |
| 15941 | |
| 15942 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15943 | .ops = &snd_hda_bind_sw, |
| 15944 | .values = { |
| 15945 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15946 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15947 | 0 |
| 15948 | }, |
| 15949 | }; |
| 15950 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15951 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15952 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15953 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15954 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15955 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15956 | { } /* end */ |
| 15957 | }; |
| 15958 | |
| 15959 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15960 | .ops = &snd_hda_bind_sw, |
| 15961 | .values = { |
| 15962 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15963 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15964 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15965 | 0 |
| 15966 | }, |
| 15967 | }; |
| 15968 | |
| 15969 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15970 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15971 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15972 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15973 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15974 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15975 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15976 | |
| 15977 | { } /* end */ |
| 15978 | }; |
| 15979 | |
| 15980 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15981 | .ops = &snd_hda_bind_sw, |
| 15982 | .values = { |
| 15983 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15984 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15985 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15986 | 0 |
| 15987 | }, |
| 15988 | }; |
| 15989 | |
| 15990 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15991 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15992 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15995 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15996 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15997 | { } /* end */ |
| 15998 | }; |
| 15999 | |
| 16000 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16001 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16002 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16003 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16004 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16005 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16006 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16007 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16008 | { } /* end */ |
| 16009 | }; |
| 16010 | |
| 16011 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 16012 | .ops = &snd_hda_bind_vol, |
| 16013 | .values = { |
| 16014 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16015 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 16016 | 0 |
| 16017 | }, |
| 16018 | }; |
| 16019 | |
| 16020 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 16021 | .ops = &snd_hda_bind_sw, |
| 16022 | .values = { |
| 16023 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16024 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 16025 | 0 |
| 16026 | }, |
| 16027 | }; |
| 16028 | |
| 16029 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 16030 | HDA_BIND_VOL("Master Playback Volume", |
| 16031 | &alc663_asus_two_bind_master_vol), |
| 16032 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16033 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16034 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16035 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16036 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16037 | { } /* end */ |
| 16038 | }; |
| 16039 | |
| 16040 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 16041 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16042 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16043 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16044 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16045 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16047 | { } /* end */ |
| 16048 | }; |
| 16049 | |
| 16050 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 16051 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16052 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16053 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16054 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16055 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16056 | |
| 16057 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16058 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16059 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16060 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16061 | { } /* end */ |
| 16062 | }; |
| 16063 | |
| 16064 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 16065 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16066 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16067 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16068 | |
| 16069 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16070 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16071 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16072 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16073 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16074 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16075 | { } /* end */ |
| 16076 | }; |
| 16077 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16078 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 16079 | { |
| 16080 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16081 | .name = "Channel Mode", |
| 16082 | .info = alc_ch_mode_info, |
| 16083 | .get = alc_ch_mode_get, |
| 16084 | .put = alc_ch_mode_put, |
| 16085 | }, |
| 16086 | { } /* end */ |
| 16087 | }; |
| 16088 | |
| 16089 | static struct hda_verb alc662_init_verbs[] = { |
| 16090 | /* ADC: mute amp left and right */ |
| 16091 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16092 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16093 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 16094 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16095 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16096 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16100 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16103 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16104 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16105 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16106 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16107 | |
| 16108 | /* Front Pin: output 0 (0x0c) */ |
| 16109 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16110 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16111 | |
| 16112 | /* Rear Pin: output 1 (0x0d) */ |
| 16113 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16114 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16115 | |
| 16116 | /* CLFE Pin: output 2 (0x0e) */ |
| 16117 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16118 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16119 | |
| 16120 | /* Mic (rear) pin: input vref at 80% */ |
| 16121 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16122 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16123 | /* Front Mic pin: input vref at 80% */ |
| 16124 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16125 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16126 | /* Line In pin: input */ |
| 16127 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16128 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16129 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16130 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16131 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16132 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16133 | /* CD pin widget for input */ |
| 16134 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16135 | |
| 16136 | /* FIXME: use matrix-type input source selection */ |
| 16137 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16138 | /* Input mixer */ |
| 16139 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16140 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16141 | |
| 16142 | /* always trun on EAPD */ |
| 16143 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16144 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16145 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16146 | { } |
| 16147 | }; |
| 16148 | |
| 16149 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 16150 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16151 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16152 | {} |
| 16153 | }; |
| 16154 | |
| 16155 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 16156 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16157 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16158 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16159 | }; |
| 16160 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16161 | /* Set Unsolicited Event*/ |
| 16162 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 16163 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16164 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16165 | {} |
| 16166 | }; |
| 16167 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16168 | /* |
| 16169 | * generic initialization of ADC, input mixers and output mixers |
| 16170 | */ |
| 16171 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 16172 | /* |
| 16173 | * Unmute ADC and set the default input to mic-in |
| 16174 | */ |
| 16175 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16176 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16177 | |
| 16178 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 16179 | * mixer widget |
| 16180 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 16181 | * panel mic (mic 2) |
| 16182 | */ |
| 16183 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16184 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16185 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16186 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16187 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16188 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16189 | |
| 16190 | /* |
| 16191 | * Set up output mixers (0x0c - 0x0f) |
| 16192 | */ |
| 16193 | /* set vol=0 to output mixers */ |
| 16194 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16195 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16196 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16197 | |
| 16198 | /* set up input amps for analog loopback */ |
| 16199 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16200 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16201 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16202 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16203 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16204 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16205 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16206 | |
| 16207 | |
| 16208 | /* FIXME: use matrix-type input source selection */ |
| 16209 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16210 | /* Input mixer */ |
| 16211 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16212 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16213 | { } |
| 16214 | }; |
| 16215 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16216 | /* additional verbs for ALC663 */ |
| 16217 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16218 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16219 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16220 | { } |
| 16221 | }; |
| 16222 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16223 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16224 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16225 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16226 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16227 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16228 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16229 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16230 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16231 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16232 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16233 | {} |
| 16234 | }; |
| 16235 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16236 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16237 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16238 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16239 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16240 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16241 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16242 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16243 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16244 | {} |
| 16245 | }; |
| 16246 | |
| 16247 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16248 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16249 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16250 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16251 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16252 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16253 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16254 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16255 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16256 | {} |
| 16257 | }; |
| 16258 | |
| 16259 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16260 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16261 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16262 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16263 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16264 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16265 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16266 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16267 | {} |
| 16268 | }; |
| 16269 | |
| 16270 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16271 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16272 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16273 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16274 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16275 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16276 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16277 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16278 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16279 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16280 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16281 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16282 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16283 | {} |
| 16284 | }; |
| 16285 | |
| 16286 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16287 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16288 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16289 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16290 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16291 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16292 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16293 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16294 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16295 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16296 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16297 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16298 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16299 | {} |
| 16300 | }; |
| 16301 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16302 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16303 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16304 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16305 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16306 | |
| 16307 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16308 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16309 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16310 | |
| 16311 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16312 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16313 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16314 | {} |
| 16315 | }; |
| 16316 | |
| 16317 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16318 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16319 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16320 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16321 | |
| 16322 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16323 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16324 | {} |
| 16325 | }; |
| 16326 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16327 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16328 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16329 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16330 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16331 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16332 | {} |
| 16333 | }; |
| 16334 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16335 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16336 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16337 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16338 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16339 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16340 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16341 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16342 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16343 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16344 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16345 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16346 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16347 | {} |
| 16348 | }; |
| 16349 | |
| 16350 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16351 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16352 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16353 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16354 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16355 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16356 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16357 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16358 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16359 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16360 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16361 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16362 | {} |
| 16363 | }; |
| 16364 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16365 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16366 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16367 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16368 | { } /* end */ |
| 16369 | }; |
| 16370 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16371 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16372 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16373 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16374 | { } /* end */ |
| 16375 | }; |
| 16376 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16377 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16378 | { |
| 16379 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16380 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16381 | |
| 16382 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16383 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16384 | bits = present ? HDA_AMP_MUTE : 0; |
| 16385 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16386 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16387 | } |
| 16388 | |
| 16389 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16390 | { |
| 16391 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16392 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16393 | |
| 16394 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16395 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16396 | bits = present ? HDA_AMP_MUTE : 0; |
| 16397 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16398 | HDA_AMP_MUTE, bits); |
| 16399 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16400 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16401 | } |
| 16402 | |
| 16403 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16404 | unsigned int res) |
| 16405 | { |
| 16406 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16407 | alc662_lenovo_101e_all_automute(codec); |
| 16408 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16409 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16410 | } |
| 16411 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16412 | /* unsolicited event for HP jack sensing */ |
| 16413 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16414 | unsigned int res) |
| 16415 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16416 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16417 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16418 | else |
| 16419 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16420 | } |
| 16421 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16422 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16423 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16424 | struct alc_spec *spec = codec->spec; |
| 16425 | |
| 16426 | alc262_hippo1_setup(codec); |
| 16427 | spec->ext_mic.pin = 0x18; |
| 16428 | spec->ext_mic.mux_idx = 0; |
| 16429 | spec->int_mic.pin = 0x19; |
| 16430 | spec->int_mic.mux_idx = 1; |
| 16431 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16432 | } |
| 16433 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16434 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16435 | { |
| 16436 | alc262_hippo_automute(codec); |
| 16437 | alc_mic_automute(codec); |
| 16438 | } |
| 16439 | |
| 16440 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16441 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16442 | struct alc_spec *spec = codec->spec; |
| 16443 | |
| 16444 | spec->autocfg.hp_pins[0] = 0x14; |
| 16445 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16446 | } |
| 16447 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16448 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 16449 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16450 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16451 | { |
| 16452 | unsigned int present; |
| 16453 | unsigned char bits; |
| 16454 | |
| 16455 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16456 | AC_VERB_GET_PIN_SENSE, 0) |
| 16457 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16458 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16459 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16460 | AMP_IN_MUTE(0), bits); |
| 16461 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16462 | AMP_IN_MUTE(0), bits); |
| 16463 | } |
| 16464 | |
| 16465 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16466 | { |
| 16467 | unsigned int present; |
| 16468 | unsigned char bits; |
| 16469 | |
| 16470 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16471 | AC_VERB_GET_PIN_SENSE, 0) |
| 16472 | & AC_PINSENSE_PRESENCE; |
| 16473 | bits = present ? HDA_AMP_MUTE : 0; |
| 16474 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16475 | AMP_IN_MUTE(0), bits); |
| 16476 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16477 | AMP_IN_MUTE(0), bits); |
| 16478 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16479 | AMP_IN_MUTE(0), bits); |
| 16480 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16481 | AMP_IN_MUTE(0), bits); |
| 16482 | } |
| 16483 | |
| 16484 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16485 | { |
| 16486 | unsigned int present; |
| 16487 | unsigned char bits; |
| 16488 | |
| 16489 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16490 | AC_VERB_GET_PIN_SENSE, 0) |
| 16491 | & AC_PINSENSE_PRESENCE; |
| 16492 | bits = present ? HDA_AMP_MUTE : 0; |
| 16493 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16494 | AMP_IN_MUTE(0), bits); |
| 16495 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16496 | AMP_IN_MUTE(0), bits); |
| 16497 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16498 | AMP_IN_MUTE(0), bits); |
| 16499 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16500 | AMP_IN_MUTE(0), bits); |
| 16501 | } |
| 16502 | |
| 16503 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16504 | { |
| 16505 | unsigned int present; |
| 16506 | unsigned char bits; |
| 16507 | |
| 16508 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16509 | AC_VERB_GET_PIN_SENSE, 0) |
| 16510 | & AC_PINSENSE_PRESENCE; |
| 16511 | bits = present ? 0 : PIN_OUT; |
| 16512 | snd_hda_codec_write(codec, 0x14, 0, |
| 16513 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16514 | } |
| 16515 | |
| 16516 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16517 | { |
| 16518 | unsigned int present1, present2; |
| 16519 | |
| 16520 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16521 | AC_VERB_GET_PIN_SENSE, 0) |
| 16522 | & AC_PINSENSE_PRESENCE; |
| 16523 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16524 | AC_VERB_GET_PIN_SENSE, 0) |
| 16525 | & AC_PINSENSE_PRESENCE; |
| 16526 | |
| 16527 | if (present1 || present2) { |
| 16528 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16529 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16530 | } else { |
| 16531 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16532 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16533 | } |
| 16534 | } |
| 16535 | |
| 16536 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16537 | { |
| 16538 | unsigned int present1, present2; |
| 16539 | |
| 16540 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16541 | AC_VERB_GET_PIN_SENSE, 0) |
| 16542 | & AC_PINSENSE_PRESENCE; |
| 16543 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16544 | AC_VERB_GET_PIN_SENSE, 0) |
| 16545 | & AC_PINSENSE_PRESENCE; |
| 16546 | |
| 16547 | if (present1 || present2) { |
| 16548 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16549 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16550 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16551 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16552 | } else { |
| 16553 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16554 | AMP_IN_MUTE(0), 0); |
| 16555 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16556 | AMP_IN_MUTE(0), 0); |
| 16557 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16558 | } |
| 16559 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16560 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16561 | unsigned int res) |
| 16562 | { |
| 16563 | switch (res >> 26) { |
| 16564 | case ALC880_HP_EVENT: |
| 16565 | alc663_m51va_speaker_automute(codec); |
| 16566 | break; |
| 16567 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16568 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16569 | break; |
| 16570 | } |
| 16571 | } |
| 16572 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16573 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 16574 | { |
| 16575 | struct alc_spec *spec = codec->spec; |
| 16576 | spec->ext_mic.pin = 0x18; |
| 16577 | spec->ext_mic.mux_idx = 0; |
| 16578 | spec->int_mic.pin = 0x12; |
| 16579 | spec->int_mic.mux_idx = 1; |
| 16580 | spec->auto_mic = 1; |
| 16581 | } |
| 16582 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16583 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16584 | { |
| 16585 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16586 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16587 | } |
| 16588 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16589 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16590 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
| 16591 | #define alc663_mode1_setup alc663_m51va_setup |
| 16592 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16593 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16594 | /* ***************** Mode2 ******************************/ |
| 16595 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16596 | unsigned int res) |
| 16597 | { |
| 16598 | switch (res >> 26) { |
| 16599 | case ALC880_HP_EVENT: |
| 16600 | alc662_f5z_speaker_automute(codec); |
| 16601 | break; |
| 16602 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16603 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16604 | break; |
| 16605 | } |
| 16606 | } |
| 16607 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16608 | #define alc662_mode2_setup alc663_m51va_setup |
| 16609 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16610 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16611 | { |
| 16612 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16613 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16614 | } |
| 16615 | /* ***************** Mode3 ******************************/ |
| 16616 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16617 | unsigned int res) |
| 16618 | { |
| 16619 | switch (res >> 26) { |
| 16620 | case ALC880_HP_EVENT: |
| 16621 | alc663_two_hp_m1_speaker_automute(codec); |
| 16622 | break; |
| 16623 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16624 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16625 | break; |
| 16626 | } |
| 16627 | } |
| 16628 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16629 | #define alc663_mode3_setup alc663_m51va_setup |
| 16630 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16631 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16632 | { |
| 16633 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16634 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16635 | } |
| 16636 | /* ***************** Mode4 ******************************/ |
| 16637 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16638 | unsigned int res) |
| 16639 | { |
| 16640 | switch (res >> 26) { |
| 16641 | case ALC880_HP_EVENT: |
| 16642 | alc663_21jd_two_speaker_automute(codec); |
| 16643 | break; |
| 16644 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16645 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16646 | break; |
| 16647 | } |
| 16648 | } |
| 16649 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16650 | #define alc663_mode4_setup alc663_m51va_setup |
| 16651 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16652 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16653 | { |
| 16654 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16655 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16656 | } |
| 16657 | /* ***************** Mode5 ******************************/ |
| 16658 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16659 | unsigned int res) |
| 16660 | { |
| 16661 | switch (res >> 26) { |
| 16662 | case ALC880_HP_EVENT: |
| 16663 | alc663_15jd_two_speaker_automute(codec); |
| 16664 | break; |
| 16665 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16666 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16667 | break; |
| 16668 | } |
| 16669 | } |
| 16670 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16671 | #define alc663_mode5_setup alc663_m51va_setup |
| 16672 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16673 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16674 | { |
| 16675 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16676 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16677 | } |
| 16678 | /* ***************** Mode6 ******************************/ |
| 16679 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16680 | unsigned int res) |
| 16681 | { |
| 16682 | switch (res >> 26) { |
| 16683 | case ALC880_HP_EVENT: |
| 16684 | alc663_two_hp_m2_speaker_automute(codec); |
| 16685 | break; |
| 16686 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16687 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16688 | break; |
| 16689 | } |
| 16690 | } |
| 16691 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16692 | #define alc663_mode6_setup alc663_m51va_setup |
| 16693 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16694 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16695 | { |
| 16696 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16697 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16698 | } |
| 16699 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16700 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16701 | { |
| 16702 | unsigned int present; |
| 16703 | unsigned char bits; |
| 16704 | |
| 16705 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16706 | AC_VERB_GET_PIN_SENSE, 0) |
| 16707 | & AC_PINSENSE_PRESENCE; |
| 16708 | bits = present ? HDA_AMP_MUTE : 0; |
| 16709 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16710 | HDA_AMP_MUTE, bits); |
| 16711 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16712 | HDA_AMP_MUTE, bits); |
| 16713 | } |
| 16714 | |
| 16715 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16716 | { |
| 16717 | unsigned int present; |
| 16718 | unsigned char bits; |
| 16719 | |
| 16720 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16721 | AC_VERB_GET_PIN_SENSE, 0) |
| 16722 | & AC_PINSENSE_PRESENCE; |
| 16723 | bits = present ? HDA_AMP_MUTE : 0; |
| 16724 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16725 | HDA_AMP_MUTE, bits); |
| 16726 | } |
| 16727 | |
| 16728 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16729 | unsigned int res) |
| 16730 | { |
| 16731 | switch (res >> 26) { |
| 16732 | case ALC880_HP_EVENT: |
| 16733 | alc663_g71v_hp_automute(codec); |
| 16734 | break; |
| 16735 | case ALC880_FRONT_EVENT: |
| 16736 | alc663_g71v_front_automute(codec); |
| 16737 | break; |
| 16738 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16739 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16740 | break; |
| 16741 | } |
| 16742 | } |
| 16743 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16744 | #define alc663_g71v_setup alc663_m51va_setup |
| 16745 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16746 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16747 | { |
| 16748 | alc663_g71v_front_automute(codec); |
| 16749 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16750 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16751 | } |
| 16752 | |
| 16753 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16754 | unsigned int res) |
| 16755 | { |
| 16756 | switch (res >> 26) { |
| 16757 | case ALC880_HP_EVENT: |
| 16758 | alc663_m51va_speaker_automute(codec); |
| 16759 | break; |
| 16760 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16761 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16762 | break; |
| 16763 | } |
| 16764 | } |
| 16765 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16766 | #define alc663_g50v_setup alc663_m51va_setup |
| 16767 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16768 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16769 | { |
| 16770 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16771 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16772 | } |
| 16773 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16774 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16775 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16776 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16777 | |
| 16778 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16779 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16780 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16781 | |
| 16782 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16783 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16784 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16785 | { } /* end */ |
| 16786 | }; |
| 16787 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16788 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16789 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16790 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16791 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16792 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16793 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16794 | |
| 16795 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16796 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16797 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16798 | |
| 16799 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16800 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16801 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16802 | { } /* end */ |
| 16803 | }; |
| 16804 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16805 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16806 | #define alc662_loopbacks alc880_loopbacks |
| 16807 | #endif |
| 16808 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16809 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16810 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16811 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16812 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16813 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16814 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16815 | |
| 16816 | /* |
| 16817 | * configuration and preset |
| 16818 | */ |
| 16819 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16820 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16821 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16822 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16823 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16824 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16825 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16826 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16827 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16828 | [ALC663_ASUS_M51VA] = "m51va", |
| 16829 | [ALC663_ASUS_G71V] = "g71v", |
| 16830 | [ALC663_ASUS_H13] = "h13", |
| 16831 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16832 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16833 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16834 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16835 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16836 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16837 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16838 | [ALC272_DELL] = "dell", |
| 16839 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16840 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16841 | [ALC662_AUTO] = "auto", |
| 16842 | }; |
| 16843 | |
| 16844 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16845 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16846 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16847 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16848 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16849 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16850 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16851 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16852 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16853 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16854 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16855 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16856 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16857 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16858 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16859 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16860 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16861 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16862 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16863 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16864 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16865 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16866 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16867 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16868 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16869 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16870 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16871 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16872 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16873 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16874 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16875 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16876 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16877 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16878 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16879 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16880 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16881 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16882 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16883 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16884 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16885 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16886 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16887 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16888 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16889 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16890 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16891 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16892 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16893 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16894 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16895 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16896 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16897 | ALC662_3ST_6ch_DIG), |
Manoj Iyer | 3db6c03 | 2009-09-22 18:33:29 -0500 | [diff] [blame] | 16898 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16899 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16900 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16901 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16902 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16903 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16904 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16905 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16906 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16907 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16908 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16909 | {} |
| 16910 | }; |
| 16911 | |
| 16912 | static struct alc_config_preset alc662_presets[] = { |
| 16913 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16914 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16915 | .init_verbs = { alc662_init_verbs }, |
| 16916 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16917 | .dac_nids = alc662_dac_nids, |
| 16918 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16919 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16920 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16921 | .channel_mode = alc662_3ST_2ch_modes, |
| 16922 | .input_mux = &alc662_capture_source, |
| 16923 | }, |
| 16924 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16925 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16926 | .init_verbs = { alc662_init_verbs }, |
| 16927 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16928 | .dac_nids = alc662_dac_nids, |
| 16929 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16930 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16931 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16932 | .channel_mode = alc662_3ST_6ch_modes, |
| 16933 | .need_dac_fix = 1, |
| 16934 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16935 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16936 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16937 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16938 | .init_verbs = { alc662_init_verbs }, |
| 16939 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16940 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16941 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16942 | .channel_mode = alc662_3ST_6ch_modes, |
| 16943 | .need_dac_fix = 1, |
| 16944 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16945 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16946 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16947 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16948 | .init_verbs = { alc662_init_verbs }, |
| 16949 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16950 | .dac_nids = alc662_dac_nids, |
| 16951 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16952 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16953 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16954 | .channel_mode = alc662_5stack_modes, |
| 16955 | .input_mux = &alc662_capture_source, |
| 16956 | }, |
| 16957 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16958 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16959 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16960 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16961 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16962 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16963 | .channel_mode = alc662_3ST_2ch_modes, |
| 16964 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16965 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16966 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16967 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16968 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16969 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16970 | .init_verbs = { alc662_init_verbs, |
| 16971 | alc662_eeepc_sue_init_verbs }, |
| 16972 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16973 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16974 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16975 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16976 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16977 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16978 | .init_hook = alc662_eeepc_inithook, |
| 16979 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16980 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16981 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16982 | alc662_chmode_mixer }, |
| 16983 | .init_verbs = { alc662_init_verbs, |
| 16984 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16985 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16986 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16987 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16988 | .channel_mode = alc662_3ST_6ch_modes, |
| 16989 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16990 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16991 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16992 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16993 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16994 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16995 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16996 | .init_verbs = { alc662_init_verbs, |
| 16997 | alc662_ecs_init_verbs }, |
| 16998 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16999 | .dac_nids = alc662_dac_nids, |
| 17000 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17001 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17002 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17003 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17004 | .init_hook = alc662_eeepc_inithook, |
| 17005 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17006 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17007 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17008 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17009 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17010 | .dac_nids = alc662_dac_nids, |
| 17011 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17012 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17013 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17014 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17015 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17016 | .init_hook = alc663_m51va_inithook, |
| 17017 | }, |
| 17018 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17019 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17020 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 17021 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17022 | .dac_nids = alc662_dac_nids, |
| 17023 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17024 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17025 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17026 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17027 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17028 | .init_hook = alc663_g71v_inithook, |
| 17029 | }, |
| 17030 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17031 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17032 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17033 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17034 | .dac_nids = alc662_dac_nids, |
| 17035 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17036 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17037 | .unsol_event = alc663_m51va_unsol_event, |
| 17038 | .init_hook = alc663_m51va_inithook, |
| 17039 | }, |
| 17040 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17041 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17042 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 17043 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17044 | .dac_nids = alc662_dac_nids, |
| 17045 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17046 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17047 | .channel_mode = alc662_3ST_6ch_modes, |
| 17048 | .input_mux = &alc663_capture_source, |
| 17049 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17050 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17051 | .init_hook = alc663_g50v_inithook, |
| 17052 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17053 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17054 | .mixers = { alc663_m51va_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, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17064 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17065 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17066 | .init_hook = alc663_mode1_inithook, |
| 17067 | }, |
| 17068 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17069 | .mixers = { alc662_1bjd_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 | alc662_1bjd_amic_init_verbs }, |
| 17073 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17074 | .dac_nids = alc662_dac_nids, |
| 17075 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17076 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17077 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17078 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17079 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17080 | .init_hook = alc662_mode2_inithook, |
| 17081 | }, |
| 17082 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17083 | .mixers = { alc663_two_hp_m1_mixer }, |
| 17084 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17085 | .init_verbs = { alc662_init_verbs, |
| 17086 | alc663_two_hp_amic_m1_init_verbs }, |
| 17087 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17088 | .hp_nid = 0x03, |
| 17089 | .dac_nids = alc662_dac_nids, |
| 17090 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17091 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17092 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17093 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17094 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17095 | .init_hook = alc663_mode3_inithook, |
| 17096 | }, |
| 17097 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17098 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 17099 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17100 | .init_verbs = { alc662_init_verbs, |
| 17101 | alc663_21jd_amic_init_verbs}, |
| 17102 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17103 | .hp_nid = 0x03, |
| 17104 | .dac_nids = alc662_dac_nids, |
| 17105 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17106 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17107 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17108 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17109 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17110 | .init_hook = alc663_mode4_inithook, |
| 17111 | }, |
| 17112 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17113 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 17114 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17115 | .init_verbs = { alc662_init_verbs, |
| 17116 | alc663_15jd_amic_init_verbs }, |
| 17117 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17118 | .hp_nid = 0x03, |
| 17119 | .dac_nids = alc662_dac_nids, |
| 17120 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17121 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17122 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17123 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17124 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17125 | .init_hook = alc663_mode5_inithook, |
| 17126 | }, |
| 17127 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17128 | .mixers = { alc663_two_hp_m2_mixer }, |
| 17129 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17130 | .init_verbs = { alc662_init_verbs, |
| 17131 | alc663_two_hp_amic_m2_init_verbs }, |
| 17132 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17133 | .hp_nid = 0x03, |
| 17134 | .dac_nids = alc662_dac_nids, |
| 17135 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17136 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17137 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17138 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17139 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17140 | .init_hook = alc663_mode6_inithook, |
| 17141 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17142 | [ALC272_DELL] = { |
| 17143 | .mixers = { alc663_m51va_mixer }, |
| 17144 | .cap_mixer = alc272_auto_capture_mixer, |
| 17145 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 17146 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17147 | .dac_nids = alc662_dac_nids, |
| 17148 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17149 | .adc_nids = alc272_adc_nids, |
| 17150 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 17151 | .capsrc_nids = alc272_capsrc_nids, |
| 17152 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17153 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17154 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17155 | .init_hook = alc663_m51va_inithook, |
| 17156 | }, |
| 17157 | [ALC272_DELL_ZM1] = { |
| 17158 | .mixers = { alc663_m51va_mixer }, |
| 17159 | .cap_mixer = alc662_auto_capture_mixer, |
| 17160 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 17161 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17162 | .dac_nids = alc662_dac_nids, |
| 17163 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17164 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17165 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17166 | .capsrc_nids = alc662_capsrc_nids, |
| 17167 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17168 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17169 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17170 | .init_hook = alc663_m51va_inithook, |
| 17171 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17172 | [ALC272_SAMSUNG_NC10] = { |
| 17173 | .mixers = { alc272_nc10_mixer }, |
| 17174 | .init_verbs = { alc662_init_verbs, |
| 17175 | alc663_21jd_amic_init_verbs }, |
| 17176 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17177 | .dac_nids = alc272_dac_nids, |
| 17178 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17179 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17180 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17181 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17182 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17183 | .init_hook = alc663_mode4_inithook, |
| 17184 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17185 | }; |
| 17186 | |
| 17187 | |
| 17188 | /* |
| 17189 | * BIOS auto configuration |
| 17190 | */ |
| 17191 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17192 | /* convert from MIX nid to DAC */ |
| 17193 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 17194 | { |
| 17195 | if (nid == 0x0f) |
| 17196 | return 0x02; |
| 17197 | else if (nid >= 0x0c && nid <= 0x0e) |
| 17198 | return nid - 0x0c + 0x02; |
| 17199 | else |
| 17200 | return 0; |
| 17201 | } |
| 17202 | |
| 17203 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 17204 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 17205 | hda_nid_t dac) |
| 17206 | { |
| 17207 | hda_nid_t mix[4]; |
| 17208 | int i, num; |
| 17209 | |
| 17210 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 17211 | for (i = 0; i < num; i++) { |
| 17212 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 17213 | return mix[i]; |
| 17214 | } |
| 17215 | return 0; |
| 17216 | } |
| 17217 | |
| 17218 | /* look for an empty DAC slot */ |
| 17219 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 17220 | { |
| 17221 | struct alc_spec *spec = codec->spec; |
| 17222 | hda_nid_t srcs[5]; |
| 17223 | int i, j, num; |
| 17224 | |
| 17225 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 17226 | if (num < 0) |
| 17227 | return 0; |
| 17228 | for (i = 0; i < num; i++) { |
| 17229 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 17230 | if (!nid) |
| 17231 | continue; |
| 17232 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 17233 | if (spec->multiout.dac_nids[j] == nid) |
| 17234 | break; |
| 17235 | if (j >= spec->multiout.num_dacs) |
| 17236 | return nid; |
| 17237 | } |
| 17238 | return 0; |
| 17239 | } |
| 17240 | |
| 17241 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 17242 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 17243 | const struct auto_pin_cfg *cfg) |
| 17244 | { |
| 17245 | struct alc_spec *spec = codec->spec; |
| 17246 | int i; |
| 17247 | hda_nid_t dac; |
| 17248 | |
| 17249 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 17250 | for (i = 0; i < cfg->line_outs; i++) { |
| 17251 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 17252 | if (!dac) |
| 17253 | continue; |
| 17254 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 17255 | } |
| 17256 | return 0; |
| 17257 | } |
| 17258 | |
| 17259 | static int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 17260 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17261 | { |
| 17262 | char name[32]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17263 | sprintf(name, "%s Playback Volume", pfx); |
| 17264 | return add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 17265 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 17266 | } |
| 17267 | |
| 17268 | static int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 17269 | hda_nid_t nid, unsigned int chs) |
| 17270 | { |
| 17271 | char name[32]; |
| 17272 | sprintf(name, "%s Playback Switch", pfx); |
| 17273 | return add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17274 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 17275 | } |
| 17276 | |
| 17277 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 17278 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 17279 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 17280 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 17281 | |
| 17282 | /* add playback controls from the parsed DAC table */ |
| 17283 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 17284 | const struct auto_pin_cfg *cfg) |
| 17285 | { |
| 17286 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17287 | static const char *chname[4] = { |
| 17288 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17289 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17290 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17291 | int i, err; |
| 17292 | |
| 17293 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17294 | nid = spec->multiout.dac_nids[i]; |
| 17295 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17296 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17297 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 17298 | if (!mix) |
| 17299 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17300 | if (i == 2) { |
| 17301 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17302 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17303 | if (err < 0) |
| 17304 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17305 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17306 | if (err < 0) |
| 17307 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17308 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17309 | if (err < 0) |
| 17310 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17311 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17312 | if (err < 0) |
| 17313 | return err; |
| 17314 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17315 | const char *pfx; |
| 17316 | if (cfg->line_outs == 1 && |
| 17317 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17318 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17319 | pfx = "Speaker"; |
| 17320 | else |
| 17321 | pfx = "PCM"; |
| 17322 | } else |
| 17323 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17324 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17325 | if (err < 0) |
| 17326 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17327 | if (cfg->line_outs == 1 && |
| 17328 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 17329 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17330 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17331 | if (err < 0) |
| 17332 | return err; |
| 17333 | } |
| 17334 | } |
| 17335 | return 0; |
| 17336 | } |
| 17337 | |
| 17338 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17339 | /* return DAC nid if any new DAC is assigned */ |
| 17340 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17341 | const char *pfx) |
| 17342 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17343 | struct alc_spec *spec = codec->spec; |
| 17344 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17345 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17346 | |
| 17347 | if (!pin) |
| 17348 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17349 | nid = alc662_look_for_dac(codec, pin); |
| 17350 | if (!nid) { |
| 17351 | char name[32]; |
| 17352 | /* the corresponding DAC is already occupied */ |
| 17353 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 17354 | return 0; /* no way */ |
| 17355 | /* create a switch only */ |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17356 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17357 | return add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17358 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17359 | } |
| 17360 | |
| 17361 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 17362 | if (!mix) |
| 17363 | return 0; |
| 17364 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 17365 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17366 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17367 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 17368 | if (err < 0) |
| 17369 | return err; |
| 17370 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17371 | } |
| 17372 | |
| 17373 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17374 | #define alc662_auto_create_input_ctls \ |
| 17375 | alc880_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17376 | |
| 17377 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17378 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17379 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17380 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17381 | int i, num; |
| 17382 | hda_nid_t srcs[4]; |
| 17383 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17384 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17385 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17386 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 17387 | if (num <= 1) |
| 17388 | return; |
| 17389 | for (i = 0; i < num; i++) { |
| 17390 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 17391 | continue; |
| 17392 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 17393 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17394 | } |
| 17395 | } |
| 17396 | |
| 17397 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17398 | { |
| 17399 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17400 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17401 | int i; |
| 17402 | |
| 17403 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17404 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 17405 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17406 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17407 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17408 | } |
| 17409 | } |
| 17410 | |
| 17411 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17412 | { |
| 17413 | struct alc_spec *spec = codec->spec; |
| 17414 | hda_nid_t pin; |
| 17415 | |
| 17416 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17417 | if (pin) |
| 17418 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 17419 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17420 | pin = spec->autocfg.speaker_pins[0]; |
| 17421 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17422 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 17423 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17424 | } |
| 17425 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17426 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17427 | |
| 17428 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17429 | { |
| 17430 | struct alc_spec *spec = codec->spec; |
| 17431 | int i; |
| 17432 | |
| 17433 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17434 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17435 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17436 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17437 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17438 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17439 | snd_hda_codec_write(codec, nid, 0, |
| 17440 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17441 | AMP_OUT_MUTE); |
| 17442 | } |
| 17443 | } |
| 17444 | } |
| 17445 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17446 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17447 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17448 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17449 | { |
| 17450 | struct alc_spec *spec = codec->spec; |
| 17451 | int err; |
| 17452 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17453 | |
| 17454 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17455 | alc662_ignore); |
| 17456 | if (err < 0) |
| 17457 | return err; |
| 17458 | if (!spec->autocfg.line_outs) |
| 17459 | return 0; /* can't find valid BIOS pin config */ |
| 17460 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17461 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17462 | if (err < 0) |
| 17463 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17464 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17465 | if (err < 0) |
| 17466 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17467 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17468 | spec->autocfg.speaker_pins[0], |
| 17469 | "Speaker"); |
| 17470 | if (err < 0) |
| 17471 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17472 | if (err) |
| 17473 | spec->multiout.extra_out_nid[0] = err; |
| 17474 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17475 | "Headphone"); |
| 17476 | if (err < 0) |
| 17477 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17478 | if (err) |
| 17479 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17480 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17481 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17482 | return err; |
| 17483 | |
| 17484 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17485 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17486 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17487 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17488 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17489 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17490 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17491 | |
| 17492 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17493 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17494 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17495 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17496 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17497 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17498 | |
| 17499 | err = alc_auto_add_mic_boost(codec); |
| 17500 | if (err < 0) |
| 17501 | return err; |
| 17502 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17503 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17504 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17505 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17506 | } |
| 17507 | |
| 17508 | /* additional initialization for auto-configuration model */ |
| 17509 | static void alc662_auto_init(struct hda_codec *codec) |
| 17510 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17511 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17512 | alc662_auto_init_multi_out(codec); |
| 17513 | alc662_auto_init_hp_out(codec); |
| 17514 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17515 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17516 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17517 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17518 | } |
| 17519 | |
| 17520 | static int patch_alc662(struct hda_codec *codec) |
| 17521 | { |
| 17522 | struct alc_spec *spec; |
| 17523 | int err, board_config; |
| 17524 | |
| 17525 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17526 | if (!spec) |
| 17527 | return -ENOMEM; |
| 17528 | |
| 17529 | codec->spec = spec; |
| 17530 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17531 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17532 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17533 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17534 | alc662_models, |
| 17535 | alc662_cfg_tbl); |
| 17536 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17537 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17538 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17539 | board_config = ALC662_AUTO; |
| 17540 | } |
| 17541 | |
| 17542 | if (board_config == ALC662_AUTO) { |
| 17543 | /* automatic parse from the BIOS config */ |
| 17544 | err = alc662_parse_auto_config(codec); |
| 17545 | if (err < 0) { |
| 17546 | alc_free(codec); |
| 17547 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17548 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17549 | printk(KERN_INFO |
| 17550 | "hda_codec: Cannot set up configuration " |
| 17551 | "from BIOS. Using base mode...\n"); |
| 17552 | board_config = ALC662_3ST_2ch_DIG; |
| 17553 | } |
| 17554 | } |
| 17555 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17556 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17557 | if (err < 0) { |
| 17558 | alc_free(codec); |
| 17559 | return err; |
| 17560 | } |
| 17561 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17562 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17563 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17564 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17565 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17566 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17567 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17568 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17569 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17570 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17571 | if (!spec->adc_nids) { |
| 17572 | spec->adc_nids = alc662_adc_nids; |
| 17573 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17574 | } |
| 17575 | if (!spec->capsrc_nids) |
| 17576 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17577 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17578 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17579 | set_capture_mixer(codec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17580 | if (codec->vendor_id == 0x10ec0662) |
| 17581 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17582 | else |
| 17583 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17584 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17585 | spec->vmaster_nid = 0x02; |
| 17586 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17587 | codec->patch_ops = alc_patch_ops; |
| 17588 | if (board_config == ALC662_AUTO) |
| 17589 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17590 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17591 | if (!spec->loopback.amplist) |
| 17592 | spec->loopback.amplist = alc662_loopbacks; |
| 17593 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17594 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17595 | |
| 17596 | return 0; |
| 17597 | } |
| 17598 | |
| 17599 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17600 | * patch entries |
| 17601 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17602 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17603 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17604 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17605 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17606 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17607 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17608 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17609 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17610 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17611 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17612 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17613 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17614 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17615 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17616 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17617 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17618 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17619 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17620 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17621 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17622 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17623 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17624 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17625 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17626 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17627 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17628 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17629 | .patch = patch_alc882 }, |
| 17630 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
| 17631 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17632 | {} /* terminator */ |
| 17633 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17634 | |
| 17635 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17636 | |
| 17637 | MODULE_LICENSE("GPL"); |
| 17638 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17639 | |
| 17640 | static struct hda_codec_preset_list realtek_list = { |
| 17641 | .preset = snd_hda_preset_realtek, |
| 17642 | .owner = THIS_MODULE, |
| 17643 | }; |
| 17644 | |
| 17645 | static int __init patch_realtek_init(void) |
| 17646 | { |
| 17647 | return snd_hda_add_codec_preset(&realtek_list); |
| 17648 | } |
| 17649 | |
| 17650 | static void __exit patch_realtek_exit(void) |
| 17651 | { |
| 17652 | snd_hda_delete_codec_preset(&realtek_list); |
| 17653 | } |
| 17654 | |
| 17655 | module_init(patch_realtek_init) |
| 17656 | module_exit(patch_realtek_exit) |