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, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 235 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 236 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 237 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 238 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 239 | ALC889A_INTEL, |
| 240 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 241 | ALC888_ASUS_M90V, |
| 242 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 243 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 244 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 245 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 246 | ALC882_AUTO, |
| 247 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 248 | }; |
| 249 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 250 | /* for GPIO Poll */ |
| 251 | #define GPIO_MASK 0x03 |
| 252 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 253 | /* extra amp-initialization sequence types */ |
| 254 | enum { |
| 255 | ALC_INIT_NONE, |
| 256 | ALC_INIT_DEFAULT, |
| 257 | ALC_INIT_GPIO1, |
| 258 | ALC_INIT_GPIO2, |
| 259 | ALC_INIT_GPIO3, |
| 260 | }; |
| 261 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 262 | struct alc_mic_route { |
| 263 | hda_nid_t pin; |
| 264 | unsigned char mux_idx; |
| 265 | unsigned char amix_idx; |
| 266 | }; |
| 267 | |
| 268 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 269 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | struct alc_spec { |
| 271 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 272 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 274 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 275 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 277 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 278 | * don't forget NULL |
| 279 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 280 | */ |
| 281 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 283 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | struct hda_pcm_stream *stream_analog_playback; |
| 285 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 286 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 287 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 289 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | struct hda_pcm_stream *stream_digital_playback; |
| 291 | struct hda_pcm_stream *stream_digital_capture; |
| 292 | |
| 293 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 294 | struct hda_multi_out multiout; /* playback set-up |
| 295 | * max_channels, dacs must be set |
| 296 | * dig_out_nid and hp_nid are optional |
| 297 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 298 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 299 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 300 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | |
| 302 | /* capture */ |
| 303 | unsigned int num_adc_nids; |
| 304 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 305 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 306 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | |
| 308 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 309 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | const struct hda_input_mux *input_mux; |
| 311 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 312 | struct alc_mic_route ext_mic; |
| 313 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
| 315 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 316 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 318 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 319 | int const_channel_count; |
| 320 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | |
| 322 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 323 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 324 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 325 | /* dynamic controls, init_verbs and input_mux */ |
| 326 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 327 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 328 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 329 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 330 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 331 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 332 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 333 | /* hooks */ |
| 334 | void (*init_hook)(struct hda_codec *codec); |
| 335 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 336 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 337 | /* for pin sensing */ |
| 338 | unsigned int sense_updated: 1; |
| 339 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 340 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 341 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 342 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 343 | /* other flags */ |
| 344 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 345 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 346 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 347 | /* for virtual master */ |
| 348 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 349 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 350 | struct hda_loopback_check loopback; |
| 351 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 352 | |
| 353 | /* for PLL fix */ |
| 354 | hda_nid_t pll_nid; |
| 355 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 356 | }; |
| 357 | |
| 358 | /* |
| 359 | * configuration template - to be copied to the spec instance |
| 360 | */ |
| 361 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 362 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 363 | * with spec |
| 364 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 365 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 366 | const struct hda_verb *init_verbs[5]; |
| 367 | unsigned int num_dacs; |
| 368 | hda_nid_t *dac_nids; |
| 369 | hda_nid_t dig_out_nid; /* optional */ |
| 370 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 371 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 372 | unsigned int num_adc_nids; |
| 373 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 374 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 375 | hda_nid_t dig_in_nid; |
| 376 | unsigned int num_channel_mode; |
| 377 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 378 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 379 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 380 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 381 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 382 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 383 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 384 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 385 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 386 | struct hda_amp_list *loopbacks; |
| 387 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | }; |
| 389 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | |
| 391 | /* |
| 392 | * input MUX handling |
| 393 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 394 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 395 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | { |
| 397 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 398 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 399 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 400 | if (mux_idx >= spec->num_mux_defs) |
| 401 | mux_idx = 0; |
| 402 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | } |
| 404 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 405 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 406 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | { |
| 408 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 409 | struct alc_spec *spec = codec->spec; |
| 410 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 411 | |
| 412 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 413 | return 0; |
| 414 | } |
| 415 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 416 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 417 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | { |
| 419 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 420 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 421 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 422 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 423 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 424 | hda_nid_t nid = spec->capsrc_nids ? |
| 425 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 426 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 427 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 428 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 429 | imux = &spec->input_mux[mux_idx]; |
| 430 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 431 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 432 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 433 | /* Matrix-mixer style (e.g. ALC882) */ |
| 434 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 435 | unsigned int i, idx; |
| 436 | |
| 437 | idx = ucontrol->value.enumerated.item[0]; |
| 438 | if (idx >= imux->num_items) |
| 439 | idx = imux->num_items - 1; |
| 440 | if (*cur_val == idx) |
| 441 | return 0; |
| 442 | for (i = 0; i < imux->num_items; i++) { |
| 443 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 444 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 445 | imux->items[i].index, |
| 446 | HDA_AMP_MUTE, v); |
| 447 | } |
| 448 | *cur_val = idx; |
| 449 | return 1; |
| 450 | } else { |
| 451 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 452 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 453 | &spec->cur_mux[adc_idx]); |
| 454 | } |
| 455 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 456 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | /* |
| 458 | * channel mode setting |
| 459 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 460 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 461 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 | { |
| 463 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 464 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 465 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 466 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | } |
| 468 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 469 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 470 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 471 | { |
| 472 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 473 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 474 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 475 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 476 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | } |
| 478 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 479 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 480 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | { |
| 482 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 483 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 484 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 485 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 486 | &spec->ext_channel_count); |
| 487 | if (err >= 0 && !spec->const_channel_count) { |
| 488 | spec->multiout.max_channels = spec->ext_channel_count; |
| 489 | if (spec->need_dac_fix) |
| 490 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 491 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 492 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 493 | } |
| 494 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 495 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 496 | * 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] | 497 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 498 | * being part of a format specifier. Maximum allowed length of a value is |
| 499 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 500 | * |
| 501 | * Note: some retasking pin complexes seem to ignore requests for input |
| 502 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 503 | * are requested. Therefore order this list so that this behaviour will not |
| 504 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 505 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 506 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 507 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 508 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 509 | "Mic 50pc bias", "Mic 80pc bias", |
| 510 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 511 | }; |
| 512 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 513 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 514 | }; |
| 515 | /* 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] | 516 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 517 | * addition, "input" pins may or may not process the mic bias option |
| 518 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 519 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 520 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 521 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 522 | #define ALC_PIN_DIR_IN 0x00 |
| 523 | #define ALC_PIN_DIR_OUT 0x01 |
| 524 | #define ALC_PIN_DIR_INOUT 0x02 |
| 525 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 526 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 527 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 528 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 529 | * For each direction the minimum and maximum values are given. |
| 530 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 531 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 532 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 533 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 534 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 535 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 536 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 537 | }; |
| 538 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 539 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 540 | #define alc_pin_mode_n_items(_dir) \ |
| 541 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 542 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 543 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 544 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 545 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 546 | unsigned int item_num = uinfo->value.enumerated.item; |
| 547 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 548 | |
| 549 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 550 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 551 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 552 | |
| 553 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 554 | item_num = alc_pin_mode_min(dir); |
| 555 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 556 | return 0; |
| 557 | } |
| 558 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 559 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 560 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 561 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 562 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 563 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 564 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 565 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 566 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 567 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 568 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 569 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 570 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 571 | /* Find enumerated value for current pinctl setting */ |
| 572 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 573 | 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] | 574 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 575 | *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] | 576 | return 0; |
| 577 | } |
| 578 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 579 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 580 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 581 | { |
| 582 | signed int change; |
| 583 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 584 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 585 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 586 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 587 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 588 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 589 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 590 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 591 | 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] | 592 | val = alc_pin_mode_min(dir); |
| 593 | |
| 594 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 595 | if (change) { |
| 596 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 597 | snd_hda_codec_write_cache(codec, nid, 0, |
| 598 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 599 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 600 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 601 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 602 | * for the requested pin mode. Enum values of 2 or less are |
| 603 | * input modes. |
| 604 | * |
| 605 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 606 | * reduces noise slightly (particularly on input) so we'll |
| 607 | * do it. However, having both input and output buffers |
| 608 | * enabled simultaneously doesn't seem to be problematic if |
| 609 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 610 | */ |
| 611 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 612 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 613 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 614 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 615 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 616 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 617 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 618 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 619 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 620 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 621 | } |
| 622 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 623 | return change; |
| 624 | } |
| 625 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 626 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 627 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 628 | .info = alc_pin_mode_info, \ |
| 629 | .get = alc_pin_mode_get, \ |
| 630 | .put = alc_pin_mode_put, \ |
| 631 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 632 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 633 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 634 | * together using a mask with more than one bit set. This control is |
| 635 | * currently used only by the ALC260 test model. At this stage they are not |
| 636 | * needed for any "production" models. |
| 637 | */ |
| 638 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 639 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 640 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 641 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 642 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 643 | { |
| 644 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 645 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 646 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 647 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 648 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 649 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 650 | |
| 651 | *valp = (val & mask) != 0; |
| 652 | return 0; |
| 653 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 654 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 655 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 656 | { |
| 657 | signed int change; |
| 658 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 659 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 660 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 661 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 662 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 663 | AC_VERB_GET_GPIO_DATA, |
| 664 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 665 | |
| 666 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 667 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 668 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 669 | gpio_data &= ~mask; |
| 670 | else |
| 671 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 672 | snd_hda_codec_write_cache(codec, nid, 0, |
| 673 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 674 | |
| 675 | return change; |
| 676 | } |
| 677 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 678 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 679 | .info = alc_gpio_data_info, \ |
| 680 | .get = alc_gpio_data_get, \ |
| 681 | .put = alc_gpio_data_put, \ |
| 682 | .private_value = nid | (mask<<16) } |
| 683 | #endif /* CONFIG_SND_DEBUG */ |
| 684 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 685 | /* A switch control to allow the enabling of the digital IO pins on the |
| 686 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 687 | * to provide something in the test model allowing digital outputs to be |
| 688 | * identified if present. If models are found which can utilise these |
| 689 | * outputs a more complete mixer control can be devised for those models if |
| 690 | * necessary. |
| 691 | */ |
| 692 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 693 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 694 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 695 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 696 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 697 | { |
| 698 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 699 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 700 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 701 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 702 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 703 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 704 | |
| 705 | *valp = (val & mask) != 0; |
| 706 | return 0; |
| 707 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 708 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 709 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 710 | { |
| 711 | signed int change; |
| 712 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 713 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 714 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 715 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 716 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 717 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 718 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 719 | |
| 720 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 721 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 722 | if (val==0) |
| 723 | ctrl_data &= ~mask; |
| 724 | else |
| 725 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 726 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 727 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 728 | |
| 729 | return change; |
| 730 | } |
| 731 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 732 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 733 | .info = alc_spdif_ctrl_info, \ |
| 734 | .get = alc_spdif_ctrl_get, \ |
| 735 | .put = alc_spdif_ctrl_put, \ |
| 736 | .private_value = nid | (mask<<16) } |
| 737 | #endif /* CONFIG_SND_DEBUG */ |
| 738 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 739 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 740 | * Again, this is only used in the ALC26x test models to help identify when |
| 741 | * the EAPD line must be asserted for features to work. |
| 742 | */ |
| 743 | #ifdef CONFIG_SND_DEBUG |
| 744 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 745 | |
| 746 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 747 | struct snd_ctl_elem_value *ucontrol) |
| 748 | { |
| 749 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 750 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 751 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 752 | long *valp = ucontrol->value.integer.value; |
| 753 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 754 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 755 | |
| 756 | *valp = (val & mask) != 0; |
| 757 | return 0; |
| 758 | } |
| 759 | |
| 760 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 761 | struct snd_ctl_elem_value *ucontrol) |
| 762 | { |
| 763 | int change; |
| 764 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 765 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 766 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 767 | long val = *ucontrol->value.integer.value; |
| 768 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 769 | AC_VERB_GET_EAPD_BTLENABLE, |
| 770 | 0x00); |
| 771 | |
| 772 | /* Set/unset the masked control bit(s) as needed */ |
| 773 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 774 | if (!val) |
| 775 | ctrl_data &= ~mask; |
| 776 | else |
| 777 | ctrl_data |= mask; |
| 778 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 779 | ctrl_data); |
| 780 | |
| 781 | return change; |
| 782 | } |
| 783 | |
| 784 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 785 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 786 | .info = alc_eapd_ctrl_info, \ |
| 787 | .get = alc_eapd_ctrl_get, \ |
| 788 | .put = alc_eapd_ctrl_put, \ |
| 789 | .private_value = nid | (mask<<16) } |
| 790 | #endif /* CONFIG_SND_DEBUG */ |
| 791 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 792 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 793 | * set up the input pin config (depending on the given auto-pin type) |
| 794 | */ |
| 795 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 796 | int auto_pin_type) |
| 797 | { |
| 798 | unsigned int val = PIN_IN; |
| 799 | |
| 800 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 801 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 802 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 803 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 804 | if (pincap & AC_PINCAP_VREF_80) |
| 805 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 806 | else if (pincap & AC_PINCAP_VREF_50) |
| 807 | val = PIN_VREF50; |
| 808 | else if (pincap & AC_PINCAP_VREF_100) |
| 809 | val = PIN_VREF100; |
| 810 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 811 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 812 | } |
| 813 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 814 | } |
| 815 | |
| 816 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 817 | */ |
| 818 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 819 | { |
| 820 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 821 | return; |
| 822 | spec->mixers[spec->num_mixers++] = mix; |
| 823 | } |
| 824 | |
| 825 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 826 | { |
| 827 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 828 | return; |
| 829 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 830 | } |
| 831 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 832 | #ifdef CONFIG_PROC_FS |
| 833 | /* |
| 834 | * hook for proc |
| 835 | */ |
| 836 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 837 | struct hda_codec *codec, hda_nid_t nid) |
| 838 | { |
| 839 | int coeff; |
| 840 | |
| 841 | if (nid != 0x20) |
| 842 | return; |
| 843 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 844 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 845 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 846 | AC_VERB_GET_COEF_INDEX, 0); |
| 847 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 848 | } |
| 849 | #else |
| 850 | #define print_realtek_coef NULL |
| 851 | #endif |
| 852 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 853 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 854 | * set up from the preset table |
| 855 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 856 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 857 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 858 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 859 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 860 | int i; |
| 861 | |
| 862 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 863 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 864 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 865 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 866 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 867 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 868 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 869 | spec->channel_mode = preset->channel_mode; |
| 870 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 871 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 872 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 873 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 874 | if (preset->const_channel_count) |
| 875 | spec->multiout.max_channels = preset->const_channel_count; |
| 876 | else |
| 877 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 878 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 879 | |
| 880 | spec->multiout.num_dacs = preset->num_dacs; |
| 881 | spec->multiout.dac_nids = preset->dac_nids; |
| 882 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 883 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 884 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 885 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 886 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 887 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 888 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 889 | spec->input_mux = preset->input_mux; |
| 890 | |
| 891 | spec->num_adc_nids = preset->num_adc_nids; |
| 892 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 893 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 894 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 895 | |
| 896 | spec->unsol_event = preset->unsol_event; |
| 897 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 898 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 899 | spec->loopback.amplist = preset->loopbacks; |
| 900 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 901 | |
| 902 | if (preset->setup) |
| 903 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 904 | } |
| 905 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 906 | /* Enable GPIO mask and set output */ |
| 907 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 908 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 909 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 910 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 911 | { } |
| 912 | }; |
| 913 | |
| 914 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 915 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 916 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 917 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 918 | { } |
| 919 | }; |
| 920 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 921 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 922 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 923 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 924 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 925 | { } |
| 926 | }; |
| 927 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 928 | /* |
| 929 | * Fix hardware PLL issue |
| 930 | * On some codecs, the analog PLL gating control must be off while |
| 931 | * the default value is 1. |
| 932 | */ |
| 933 | static void alc_fix_pll(struct hda_codec *codec) |
| 934 | { |
| 935 | struct alc_spec *spec = codec->spec; |
| 936 | unsigned int val; |
| 937 | |
| 938 | if (!spec->pll_nid) |
| 939 | return; |
| 940 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 941 | spec->pll_coef_idx); |
| 942 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 943 | AC_VERB_GET_PROC_COEF, 0); |
| 944 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 945 | spec->pll_coef_idx); |
| 946 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 947 | val & ~(1 << spec->pll_coef_bit)); |
| 948 | } |
| 949 | |
| 950 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 951 | unsigned int coef_idx, unsigned int coef_bit) |
| 952 | { |
| 953 | struct alc_spec *spec = codec->spec; |
| 954 | spec->pll_nid = nid; |
| 955 | spec->pll_coef_idx = coef_idx; |
| 956 | spec->pll_coef_bit = coef_bit; |
| 957 | alc_fix_pll(codec); |
| 958 | } |
| 959 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 960 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 961 | { |
| 962 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 963 | unsigned int present, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 964 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 965 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 966 | |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 967 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 968 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 969 | 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] | 970 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 971 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 972 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 973 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 974 | nid = spec->autocfg.speaker_pins[i]; |
| 975 | if (!nid) |
| 976 | break; |
| 977 | snd_hda_codec_write(codec, nid, 0, |
| 978 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 979 | spec->jack_present ? 0 : PIN_OUT); |
| 980 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 981 | } |
| 982 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 983 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 984 | hda_nid_t nid) |
| 985 | { |
| 986 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 987 | int i, nums; |
| 988 | |
| 989 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 990 | for (i = 0; i < nums; i++) |
| 991 | if (conn[i] == nid) |
| 992 | return i; |
| 993 | return -1; |
| 994 | } |
| 995 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 996 | static void alc_mic_automute(struct hda_codec *codec) |
| 997 | { |
| 998 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 999 | struct alc_mic_route *dead, *alive; |
| 1000 | unsigned int present, type; |
| 1001 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1002 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1003 | if (!spec->auto_mic) |
| 1004 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1005 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1006 | return; |
| 1007 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1008 | return; |
| 1009 | |
| 1010 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1011 | |
| 1012 | present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0, |
| 1013 | AC_VERB_GET_PIN_SENSE, 0); |
| 1014 | present &= AC_PINSENSE_PRESENCE; |
| 1015 | if (present) { |
| 1016 | alive = &spec->ext_mic; |
| 1017 | dead = &spec->int_mic; |
| 1018 | } else { |
| 1019 | alive = &spec->int_mic; |
| 1020 | dead = &spec->ext_mic; |
| 1021 | } |
| 1022 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1023 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1024 | if (type == AC_WID_AUD_MIX) { |
| 1025 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1026 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1027 | alive->mux_idx, |
| 1028 | HDA_AMP_MUTE, 0); |
| 1029 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1030 | dead->mux_idx, |
| 1031 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1032 | } else { |
| 1033 | /* MUX style (e.g. ALC880) */ |
| 1034 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1035 | AC_VERB_SET_CONNECT_SEL, |
| 1036 | alive->mux_idx); |
| 1037 | } |
| 1038 | |
| 1039 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1040 | } |
| 1041 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1042 | /* unsolicited event for HP jack sensing */ |
| 1043 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1044 | { |
| 1045 | if (codec->vendor_id == 0x10ec0880) |
| 1046 | res >>= 28; |
| 1047 | else |
| 1048 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1049 | switch (res) { |
| 1050 | case ALC880_HP_EVENT: |
| 1051 | alc_automute_pin(codec); |
| 1052 | break; |
| 1053 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1054 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1055 | break; |
| 1056 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1057 | } |
| 1058 | |
| 1059 | static void alc_inithook(struct hda_codec *codec) |
| 1060 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1061 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1062 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1063 | } |
| 1064 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1065 | /* additional initialization for ALC888 variants */ |
| 1066 | static void alc888_coef_init(struct hda_codec *codec) |
| 1067 | { |
| 1068 | unsigned int tmp; |
| 1069 | |
| 1070 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1071 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1072 | 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] | 1073 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1074 | /* alc888S-VC */ |
| 1075 | snd_hda_codec_read(codec, 0x20, 0, |
| 1076 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1077 | else |
| 1078 | /* alc888-VB */ |
| 1079 | snd_hda_codec_read(codec, 0x20, 0, |
| 1080 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1081 | } |
| 1082 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1083 | static void alc889_coef_init(struct hda_codec *codec) |
| 1084 | { |
| 1085 | unsigned int tmp; |
| 1086 | |
| 1087 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1088 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1089 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1090 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1091 | } |
| 1092 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1093 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1094 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1095 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1096 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1097 | switch (type) { |
| 1098 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1099 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1100 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1101 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1102 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1103 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1104 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1105 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1106 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1107 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1108 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1109 | case 0x10ec0260: |
| 1110 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1111 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1112 | snd_hda_codec_write(codec, 0x10, 0, |
| 1113 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1114 | break; |
| 1115 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1116 | case 0x10ec0267: |
| 1117 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1118 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1119 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1120 | case 0x10ec0660: |
| 1121 | case 0x10ec0662: |
| 1122 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1123 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1124 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1125 | snd_hda_codec_write(codec, 0x14, 0, |
| 1126 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1127 | snd_hda_codec_write(codec, 0x15, 0, |
| 1128 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1129 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1130 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1131 | switch (codec->vendor_id) { |
| 1132 | case 0x10ec0260: |
| 1133 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1134 | AC_VERB_SET_COEF_INDEX, 7); |
| 1135 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1136 | AC_VERB_GET_PROC_COEF, 0); |
| 1137 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1138 | AC_VERB_SET_COEF_INDEX, 7); |
| 1139 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1140 | AC_VERB_SET_PROC_COEF, |
| 1141 | tmp | 0x2010); |
| 1142 | break; |
| 1143 | case 0x10ec0262: |
| 1144 | case 0x10ec0880: |
| 1145 | case 0x10ec0882: |
| 1146 | case 0x10ec0883: |
| 1147 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1148 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1149 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1150 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1151 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1152 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1153 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1154 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1155 | case 0x10ec0267: |
| 1156 | case 0x10ec0268: |
| 1157 | snd_hda_codec_write(codec, 0x20, 0, |
| 1158 | AC_VERB_SET_COEF_INDEX, 7); |
| 1159 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1160 | AC_VERB_GET_PROC_COEF, 0); |
| 1161 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1162 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1163 | snd_hda_codec_write(codec, 0x20, 0, |
| 1164 | AC_VERB_SET_PROC_COEF, |
| 1165 | tmp | 0x3000); |
| 1166 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1167 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1168 | break; |
| 1169 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1170 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1171 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1172 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1173 | { |
| 1174 | struct alc_spec *spec = codec->spec; |
| 1175 | |
| 1176 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1177 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1178 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1179 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1180 | if (spec->autocfg.line_out_pins[0] && |
| 1181 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1182 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1183 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1184 | else |
| 1185 | return; |
| 1186 | } |
| 1187 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1188 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1189 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1190 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1191 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1192 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1193 | spec->unsol_event = alc_sku_unsol_event; |
| 1194 | } |
| 1195 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1196 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1197 | { |
| 1198 | struct alc_spec *spec = codec->spec; |
| 1199 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1200 | hda_nid_t fixed, ext; |
| 1201 | int i; |
| 1202 | |
| 1203 | /* there must be only two mic inputs exclusively */ |
| 1204 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1205 | if (cfg->input_pins[i]) |
| 1206 | return; |
| 1207 | |
| 1208 | fixed = ext = 0; |
| 1209 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1210 | hda_nid_t nid = cfg->input_pins[i]; |
| 1211 | unsigned int defcfg; |
| 1212 | if (!nid) |
| 1213 | return; |
| 1214 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1215 | switch (get_defcfg_connect(defcfg)) { |
| 1216 | case AC_JACK_PORT_FIXED: |
| 1217 | if (fixed) |
| 1218 | return; /* already occupied */ |
| 1219 | fixed = nid; |
| 1220 | break; |
| 1221 | case AC_JACK_PORT_COMPLEX: |
| 1222 | if (ext) |
| 1223 | return; /* already occupied */ |
| 1224 | ext = nid; |
| 1225 | break; |
| 1226 | default: |
| 1227 | return; /* invalid entry */ |
| 1228 | } |
| 1229 | } |
| 1230 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1231 | return; /* no unsol support */ |
| 1232 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1233 | ext, fixed); |
| 1234 | spec->ext_mic.pin = ext; |
| 1235 | spec->int_mic.pin = fixed; |
| 1236 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1237 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1238 | spec->auto_mic = 1; |
| 1239 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1240 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1241 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1242 | spec->unsol_event = alc_sku_unsol_event; |
| 1243 | } |
| 1244 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1245 | /* check subsystem ID and set up device-specific initialization; |
| 1246 | * return 1 if initialized, 0 if invalid SSID |
| 1247 | */ |
| 1248 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1249 | * 31 ~ 16 : Manufacture ID |
| 1250 | * 15 ~ 8 : SKU ID |
| 1251 | * 7 ~ 0 : Assembly ID |
| 1252 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1253 | */ |
| 1254 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1255 | hda_nid_t porta, hda_nid_t porte, |
| 1256 | hda_nid_t portd) |
| 1257 | { |
| 1258 | unsigned int ass, tmp, i; |
| 1259 | unsigned nid; |
| 1260 | struct alc_spec *spec = codec->spec; |
| 1261 | |
| 1262 | ass = codec->subsystem_id & 0xffff; |
| 1263 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1264 | goto do_sku; |
| 1265 | |
| 1266 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1267 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1268 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1269 | * 29~21 : reserve |
| 1270 | * 20 : PCBEEP input |
| 1271 | * 19~16 : Check sum (15:1) |
| 1272 | * 15~1 : Custom |
| 1273 | * 0 : override |
| 1274 | */ |
| 1275 | nid = 0x1d; |
| 1276 | if (codec->vendor_id == 0x10ec0260) |
| 1277 | nid = 0x17; |
| 1278 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1279 | snd_printd("realtek: No valid SSID, " |
| 1280 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1281 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1282 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1283 | return 0; |
| 1284 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1285 | return 0; |
| 1286 | |
| 1287 | /* check sum */ |
| 1288 | tmp = 0; |
| 1289 | for (i = 1; i < 16; i++) { |
| 1290 | if ((ass >> i) & 1) |
| 1291 | tmp++; |
| 1292 | } |
| 1293 | if (((ass >> 16) & 0xf) != tmp) |
| 1294 | return 0; |
| 1295 | do_sku: |
| 1296 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1297 | ass & 0xffff, codec->vendor_id); |
| 1298 | /* |
| 1299 | * 0 : override |
| 1300 | * 1 : Swap Jack |
| 1301 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1302 | * 3~5 : External Amplifier control |
| 1303 | * 7~6 : Reserved |
| 1304 | */ |
| 1305 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1306 | switch (tmp) { |
| 1307 | case 1: |
| 1308 | spec->init_amp = ALC_INIT_GPIO1; |
| 1309 | break; |
| 1310 | case 3: |
| 1311 | spec->init_amp = ALC_INIT_GPIO2; |
| 1312 | break; |
| 1313 | case 7: |
| 1314 | spec->init_amp = ALC_INIT_GPIO3; |
| 1315 | break; |
| 1316 | case 5: |
| 1317 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1318 | break; |
| 1319 | } |
| 1320 | |
| 1321 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1322 | * when the external headphone out jack is plugged" |
| 1323 | */ |
| 1324 | if (!(ass & 0x8000)) |
| 1325 | return 1; |
| 1326 | /* |
| 1327 | * 10~8 : Jack location |
| 1328 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1329 | * 14~13: Resvered |
| 1330 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1331 | * when the external headphone out jack is plugged" |
| 1332 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1333 | if (!spec->autocfg.hp_pins[0]) { |
| 1334 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1335 | if (tmp == 0) |
| 1336 | spec->autocfg.hp_pins[0] = porta; |
| 1337 | else if (tmp == 1) |
| 1338 | spec->autocfg.hp_pins[0] = porte; |
| 1339 | else if (tmp == 2) |
| 1340 | spec->autocfg.hp_pins[0] = portd; |
| 1341 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1342 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1343 | } |
| 1344 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1345 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1346 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1347 | return 1; |
| 1348 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1349 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1350 | static void alc_ssid_check(struct hda_codec *codec, |
| 1351 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1352 | { |
| 1353 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1354 | struct alc_spec *spec = codec->spec; |
| 1355 | snd_printd("realtek: " |
| 1356 | "Enable default setup for auto mode as fallback\n"); |
| 1357 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1358 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1359 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1360 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1361 | } |
| 1362 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1363 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1364 | * Fix-up pin default configurations |
| 1365 | */ |
| 1366 | |
| 1367 | struct alc_pincfg { |
| 1368 | hda_nid_t nid; |
| 1369 | u32 val; |
| 1370 | }; |
| 1371 | |
| 1372 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1373 | const struct snd_pci_quirk *quirk, |
| 1374 | const struct alc_pincfg **pinfix) |
| 1375 | { |
| 1376 | const struct alc_pincfg *cfg; |
| 1377 | |
| 1378 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1379 | if (!quirk) |
| 1380 | return; |
| 1381 | |
| 1382 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1383 | for (; cfg->nid; cfg++) |
| 1384 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1385 | } |
| 1386 | |
| 1387 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1388 | * ALC888 |
| 1389 | */ |
| 1390 | |
| 1391 | /* |
| 1392 | * 2ch mode |
| 1393 | */ |
| 1394 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1395 | /* Mic-in jack as mic in */ |
| 1396 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1397 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1398 | /* Line-in jack as Line in */ |
| 1399 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1400 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1401 | /* Line-Out as Front */ |
| 1402 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1403 | { } /* end */ |
| 1404 | }; |
| 1405 | |
| 1406 | /* |
| 1407 | * 4ch mode |
| 1408 | */ |
| 1409 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1410 | /* Mic-in jack as mic in */ |
| 1411 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1412 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1413 | /* Line-in jack as Surround */ |
| 1414 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1415 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1416 | /* Line-Out as Front */ |
| 1417 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1418 | { } /* end */ |
| 1419 | }; |
| 1420 | |
| 1421 | /* |
| 1422 | * 6ch mode |
| 1423 | */ |
| 1424 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1425 | /* Mic-in jack as CLFE */ |
| 1426 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1427 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1428 | /* Line-in jack as Surround */ |
| 1429 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1430 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1431 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1432 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1433 | { } /* end */ |
| 1434 | }; |
| 1435 | |
| 1436 | /* |
| 1437 | * 8ch mode |
| 1438 | */ |
| 1439 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1440 | /* Mic-in jack as CLFE */ |
| 1441 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1442 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1443 | /* Line-in jack as Surround */ |
| 1444 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1445 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1446 | /* Line-Out as Side */ |
| 1447 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1448 | { } /* end */ |
| 1449 | }; |
| 1450 | |
| 1451 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1452 | { 2, alc888_4ST_ch2_intel_init }, |
| 1453 | { 4, alc888_4ST_ch4_intel_init }, |
| 1454 | { 6, alc888_4ST_ch6_intel_init }, |
| 1455 | { 8, alc888_4ST_ch8_intel_init }, |
| 1456 | }; |
| 1457 | |
| 1458 | /* |
| 1459 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1460 | */ |
| 1461 | |
| 1462 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1463 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1464 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1465 | /* Connect Internal HP to Front */ |
| 1466 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1467 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1468 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1469 | /* Connect Bass HP to Front */ |
| 1470 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1471 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1472 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1473 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1474 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1475 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1476 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1477 | /* Connect Mic jack to CLFE */ |
| 1478 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1479 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1480 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1481 | /* Connect Line-in jack to Surround */ |
| 1482 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1483 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1484 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1485 | /* Connect HP out jack to Front */ |
| 1486 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1487 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1488 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1489 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1490 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1491 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1492 | {} |
| 1493 | }; |
| 1494 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1495 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1496 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1497 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1498 | unsigned int val, mute, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1499 | hda_nid_t nid; |
| 1500 | int i; |
| 1501 | |
| 1502 | spec->jack_present = 0; |
| 1503 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1504 | nid = spec->autocfg.hp_pins[i]; |
| 1505 | if (!nid) |
| 1506 | break; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1507 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 1508 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 1509 | snd_hda_codec_read(codec, nid, 0, |
| 1510 | AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1511 | val = snd_hda_codec_read(codec, nid, 0, |
| 1512 | AC_VERB_GET_PIN_SENSE, 0); |
| 1513 | if (val & AC_PINSENSE_PRESENCE) { |
| 1514 | spec->jack_present = 1; |
| 1515 | break; |
| 1516 | } |
| 1517 | } |
| 1518 | |
| 1519 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1520 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1521 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1522 | nid = spec->autocfg.speaker_pins[i]; |
| 1523 | if (!nid) |
| 1524 | break; |
| 1525 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1526 | HDA_AMP_MUTE, mute); |
| 1527 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1528 | } |
| 1529 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1530 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1531 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1532 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1533 | if (codec->vendor_id == 0x10ec0880) |
| 1534 | res >>= 28; |
| 1535 | else |
| 1536 | res >>= 26; |
| 1537 | if (res == ALC880_HP_EVENT) |
| 1538 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1539 | } |
| 1540 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1541 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1542 | { |
| 1543 | struct alc_spec *spec = codec->spec; |
| 1544 | |
| 1545 | spec->autocfg.hp_pins[0] = 0x15; |
| 1546 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1547 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1548 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1549 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1550 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1551 | } |
| 1552 | |
| 1553 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1554 | { |
| 1555 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1556 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1557 | } |
| 1558 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1559 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1560 | { |
| 1561 | struct alc_spec *spec = codec->spec; |
| 1562 | |
| 1563 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1564 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1565 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1566 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1567 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1568 | |
| 1569 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1570 | * ALC888 Acer Aspire 4930G model |
| 1571 | */ |
| 1572 | |
| 1573 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1574 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1575 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1576 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1577 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1578 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1579 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1580 | /* Connect Internal HP to front */ |
| 1581 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1582 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1583 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1584 | /* Connect HP out to front */ |
| 1585 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1586 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1587 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1588 | { } |
| 1589 | }; |
| 1590 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1591 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1592 | * ALC888 Acer Aspire 6530G model |
| 1593 | */ |
| 1594 | |
| 1595 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1596 | /* Bias voltage on for external mic port */ |
| 1597 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1598 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1599 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1600 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1601 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1602 | /* Enable unsolicited event for HP jack */ |
| 1603 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1604 | /* Enable speaker output */ |
| 1605 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1606 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1607 | /* Enable headphone output */ |
| 1608 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1609 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1610 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1611 | { } |
| 1612 | }; |
| 1613 | |
| 1614 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1615 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1616 | */ |
| 1617 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1618 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1619 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1620 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1621 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1622 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1623 | /* Enable unsolicited event for HP jack */ |
| 1624 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1625 | /* Connect Internal Front to Front */ |
| 1626 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1627 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1628 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1629 | /* Connect Internal Rear to Rear */ |
| 1630 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1631 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1632 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1633 | /* Connect Internal CLFE to CLFE */ |
| 1634 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1635 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1636 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1637 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1638 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1639 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1640 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1641 | /* Enable all DACs */ |
| 1642 | /* DAC DISABLE/MUTE 1? */ |
| 1643 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1644 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1645 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1646 | /* DAC DISABLE/MUTE 2? */ |
| 1647 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1648 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1649 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1650 | /* Enable amplifiers */ |
| 1651 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1652 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1653 | /* DMIC fix |
| 1654 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1655 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1656 | * makes the signal become a difference/sum signal instead of standard |
| 1657 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1658 | * codec replicate the sum signal to both channels, turning it into a |
| 1659 | * normal mono mic. |
| 1660 | */ |
| 1661 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1662 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1663 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1664 | { } |
| 1665 | }; |
| 1666 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1667 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1668 | /* Front mic only available on one ADC */ |
| 1669 | { |
| 1670 | .num_items = 4, |
| 1671 | .items = { |
| 1672 | { "Mic", 0x0 }, |
| 1673 | { "Line", 0x2 }, |
| 1674 | { "CD", 0x4 }, |
| 1675 | { "Front Mic", 0xb }, |
| 1676 | }, |
| 1677 | }, |
| 1678 | { |
| 1679 | .num_items = 3, |
| 1680 | .items = { |
| 1681 | { "Mic", 0x0 }, |
| 1682 | { "Line", 0x2 }, |
| 1683 | { "CD", 0x4 }, |
| 1684 | }, |
| 1685 | } |
| 1686 | }; |
| 1687 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1688 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1689 | /* Interal mic only available on one ADC */ |
| 1690 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1691 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1692 | .items = { |
| 1693 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1694 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1695 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1696 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1697 | { "Int Mic", 0xb }, |
| 1698 | }, |
| 1699 | }, |
| 1700 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1701 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1702 | .items = { |
| 1703 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1704 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1705 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1706 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1707 | }, |
| 1708 | } |
| 1709 | }; |
| 1710 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1711 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1712 | /* Digital mic only available on first "ADC" */ |
| 1713 | { |
| 1714 | .num_items = 5, |
| 1715 | .items = { |
| 1716 | { "Mic", 0x0 }, |
| 1717 | { "Line", 0x2 }, |
| 1718 | { "CD", 0x4 }, |
| 1719 | { "Front Mic", 0xb }, |
| 1720 | { "Input Mix", 0xa }, |
| 1721 | }, |
| 1722 | }, |
| 1723 | { |
| 1724 | .num_items = 4, |
| 1725 | .items = { |
| 1726 | { "Mic", 0x0 }, |
| 1727 | { "Line", 0x2 }, |
| 1728 | { "CD", 0x4 }, |
| 1729 | { "Input Mix", 0xa }, |
| 1730 | }, |
| 1731 | }, |
| 1732 | { |
| 1733 | .num_items = 4, |
| 1734 | .items = { |
| 1735 | { "Mic", 0x0 }, |
| 1736 | { "Line", 0x2 }, |
| 1737 | { "CD", 0x4 }, |
| 1738 | { "Input Mix", 0xa }, |
| 1739 | }, |
| 1740 | } |
| 1741 | }; |
| 1742 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1743 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1744 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1745 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1746 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1747 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1748 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1749 | HDA_OUTPUT), |
| 1750 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1751 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1752 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1753 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1754 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1755 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1756 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1757 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1758 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1759 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1760 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1761 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1762 | { } /* end */ |
| 1763 | }; |
| 1764 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1765 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1766 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1767 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1768 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1769 | spec->autocfg.hp_pins[0] = 0x15; |
| 1770 | spec->autocfg.speaker_pins[0] = 0x14; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1771 | } |
| 1772 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1773 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1774 | { |
| 1775 | struct alc_spec *spec = codec->spec; |
| 1776 | |
| 1777 | spec->autocfg.hp_pins[0] = 0x15; |
| 1778 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1779 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1780 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1781 | } |
| 1782 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1783 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1784 | { |
| 1785 | struct alc_spec *spec = codec->spec; |
| 1786 | |
| 1787 | spec->autocfg.hp_pins[0] = 0x15; |
| 1788 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1789 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1790 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1791 | } |
| 1792 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1793 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1794 | * ALC880 3-stack model |
| 1795 | * |
| 1796 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1797 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1798 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1799 | */ |
| 1800 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1801 | static hda_nid_t alc880_dac_nids[4] = { |
| 1802 | /* front, rear, clfe, rear_surr */ |
| 1803 | 0x02, 0x05, 0x04, 0x03 |
| 1804 | }; |
| 1805 | |
| 1806 | static hda_nid_t alc880_adc_nids[3] = { |
| 1807 | /* ADC0-2 */ |
| 1808 | 0x07, 0x08, 0x09, |
| 1809 | }; |
| 1810 | |
| 1811 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1812 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1813 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1814 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1815 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1816 | /* ADC1-2 */ |
| 1817 | 0x08, 0x09, |
| 1818 | }; |
| 1819 | |
| 1820 | #define ALC880_DIGOUT_NID 0x06 |
| 1821 | #define ALC880_DIGIN_NID 0x0a |
| 1822 | |
| 1823 | static struct hda_input_mux alc880_capture_source = { |
| 1824 | .num_items = 4, |
| 1825 | .items = { |
| 1826 | { "Mic", 0x0 }, |
| 1827 | { "Front Mic", 0x3 }, |
| 1828 | { "Line", 0x2 }, |
| 1829 | { "CD", 0x4 }, |
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 | }; |
| 1832 | |
| 1833 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1834 | /* 2ch mode */ |
| 1835 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1836 | /* set line-in to input, mute it */ |
| 1837 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1838 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1839 | /* set mic-in to input vref 80%, mute it */ |
| 1840 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1841 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1842 | { } /* end */ |
| 1843 | }; |
| 1844 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1845 | /* 6ch mode */ |
| 1846 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1847 | /* set line-in to output, unmute it */ |
| 1848 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1849 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1850 | /* set mic-in to output, unmute it */ |
| 1851 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1852 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1853 | { } /* end */ |
| 1854 | }; |
| 1855 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1856 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1857 | { 2, alc880_threestack_ch2_init }, |
| 1858 | { 6, alc880_threestack_ch6_init }, |
| 1859 | }; |
| 1860 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1861 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1862 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1863 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1864 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1865 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1866 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1867 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1868 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1869 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1870 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1871 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1872 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1873 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1874 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1875 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1876 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1877 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1878 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1879 | { |
| 1880 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1881 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1882 | .info = alc_ch_mode_info, |
| 1883 | .get = alc_ch_mode_get, |
| 1884 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1885 | }, |
| 1886 | { } /* end */ |
| 1887 | }; |
| 1888 | |
| 1889 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1890 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1891 | struct snd_ctl_elem_info *uinfo) |
| 1892 | { |
| 1893 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1894 | struct alc_spec *spec = codec->spec; |
| 1895 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1896 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1897 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1898 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1899 | HDA_INPUT); |
| 1900 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1901 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1902 | return err; |
| 1903 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1904 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1905 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1906 | unsigned int size, unsigned int __user *tlv) |
| 1907 | { |
| 1908 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1909 | struct alc_spec *spec = codec->spec; |
| 1910 | int err; |
| 1911 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1912 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1913 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1914 | HDA_INPUT); |
| 1915 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1916 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1917 | return err; |
| 1918 | } |
| 1919 | |
| 1920 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1921 | struct snd_ctl_elem_value *ucontrol); |
| 1922 | |
| 1923 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1924 | struct snd_ctl_elem_value *ucontrol, |
| 1925 | getput_call_t func) |
| 1926 | { |
| 1927 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1928 | struct alc_spec *spec = codec->spec; |
| 1929 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1930 | int err; |
| 1931 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1932 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1933 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1934 | 3, 0, HDA_INPUT); |
| 1935 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1936 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1937 | return err; |
| 1938 | } |
| 1939 | |
| 1940 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1941 | struct snd_ctl_elem_value *ucontrol) |
| 1942 | { |
| 1943 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1944 | snd_hda_mixer_amp_volume_get); |
| 1945 | } |
| 1946 | |
| 1947 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1948 | struct snd_ctl_elem_value *ucontrol) |
| 1949 | { |
| 1950 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1951 | snd_hda_mixer_amp_volume_put); |
| 1952 | } |
| 1953 | |
| 1954 | /* capture mixer elements */ |
| 1955 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1956 | |
| 1957 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1958 | struct snd_ctl_elem_value *ucontrol) |
| 1959 | { |
| 1960 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1961 | snd_hda_mixer_amp_switch_get); |
| 1962 | } |
| 1963 | |
| 1964 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1965 | struct snd_ctl_elem_value *ucontrol) |
| 1966 | { |
| 1967 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1968 | snd_hda_mixer_amp_switch_put); |
| 1969 | } |
| 1970 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1971 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1972 | { \ |
| 1973 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1974 | .name = "Capture Switch", \ |
| 1975 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1976 | .count = num, \ |
| 1977 | .info = alc_cap_sw_info, \ |
| 1978 | .get = alc_cap_sw_get, \ |
| 1979 | .put = alc_cap_sw_put, \ |
| 1980 | }, \ |
| 1981 | { \ |
| 1982 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1983 | .name = "Capture Volume", \ |
| 1984 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1985 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1986 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1987 | .count = num, \ |
| 1988 | .info = alc_cap_vol_info, \ |
| 1989 | .get = alc_cap_vol_get, \ |
| 1990 | .put = alc_cap_vol_put, \ |
| 1991 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1992 | } |
| 1993 | |
| 1994 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1995 | { \ |
| 1996 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1997 | /* .name = "Capture Source", */ \ |
| 1998 | .name = "Input Source", \ |
| 1999 | .count = num, \ |
| 2000 | .info = alc_mux_enum_info, \ |
| 2001 | .get = alc_mux_enum_get, \ |
| 2002 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2003 | } |
| 2004 | |
| 2005 | #define DEFINE_CAPMIX(num) \ |
| 2006 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2007 | _DEFINE_CAPMIX(num), \ |
| 2008 | _DEFINE_CAPSRC(num), \ |
| 2009 | { } /* end */ \ |
| 2010 | } |
| 2011 | |
| 2012 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2013 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2014 | _DEFINE_CAPMIX(num), \ |
| 2015 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2016 | } |
| 2017 | |
| 2018 | /* up to three ADCs */ |
| 2019 | DEFINE_CAPMIX(1); |
| 2020 | DEFINE_CAPMIX(2); |
| 2021 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2022 | DEFINE_CAPMIX_NOSRC(1); |
| 2023 | DEFINE_CAPMIX_NOSRC(2); |
| 2024 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2025 | |
| 2026 | /* |
| 2027 | * ALC880 5-stack model |
| 2028 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2029 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2030 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2031 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2032 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2033 | */ |
| 2034 | |
| 2035 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2036 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2037 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2038 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2039 | { } /* end */ |
| 2040 | }; |
| 2041 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2042 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2043 | /* 6ch mode */ |
| 2044 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2045 | /* set line-in to input, mute it */ |
| 2046 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2047 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2048 | { } /* end */ |
| 2049 | }; |
| 2050 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2051 | /* 8ch mode */ |
| 2052 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2053 | /* set line-in to output, unmute it */ |
| 2054 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2055 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2056 | { } /* end */ |
| 2057 | }; |
| 2058 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2059 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2060 | { 6, alc880_fivestack_ch6_init }, |
| 2061 | { 8, alc880_fivestack_ch8_init }, |
| 2062 | }; |
| 2063 | |
| 2064 | |
| 2065 | /* |
| 2066 | * ALC880 6-stack model |
| 2067 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2068 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2069 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2070 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2071 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2072 | */ |
| 2073 | |
| 2074 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2075 | /* front, rear, clfe, rear_surr */ |
| 2076 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2077 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2078 | |
| 2079 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2080 | .num_items = 4, |
| 2081 | .items = { |
| 2082 | { "Mic", 0x0 }, |
| 2083 | { "Front Mic", 0x1 }, |
| 2084 | { "Line", 0x2 }, |
| 2085 | { "CD", 0x4 }, |
| 2086 | }, |
| 2087 | }; |
| 2088 | |
| 2089 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2090 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2091 | { 8, NULL }, |
| 2092 | }; |
| 2093 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2094 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2095 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2096 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2097 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2098 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2099 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2100 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2101 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2102 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2103 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2104 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2105 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2106 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2107 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2108 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2109 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2110 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2111 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2112 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2113 | { |
| 2114 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2115 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2116 | .info = alc_ch_mode_info, |
| 2117 | .get = alc_ch_mode_get, |
| 2118 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2119 | }, |
| 2120 | { } /* end */ |
| 2121 | }; |
| 2122 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2123 | |
| 2124 | /* |
| 2125 | * ALC880 W810 model |
| 2126 | * |
| 2127 | * W810 has rear IO for: |
| 2128 | * Front (DAC 02) |
| 2129 | * Surround (DAC 03) |
| 2130 | * Center/LFE (DAC 04) |
| 2131 | * Digital out (06) |
| 2132 | * |
| 2133 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2134 | * 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] | 2135 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2136 | * There is a variable resistor to control the speaker or headphone |
| 2137 | * volume. This is a hardware-only device without a software API. |
| 2138 | * |
| 2139 | * Plugging headphones in will disable the internal speakers. This is |
| 2140 | * implemented in hardware, not via the driver using jack sense. In |
| 2141 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2142 | * disable both the speakers and headphones. |
| 2143 | * |
| 2144 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2145 | * These may not do anything useful with this driver yet, because I |
| 2146 | * haven't setup any initialization verbs for these yet... |
| 2147 | */ |
| 2148 | |
| 2149 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2150 | /* front, rear/surround, clfe */ |
| 2151 | 0x02, 0x03, 0x04 |
| 2152 | }; |
| 2153 | |
| 2154 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2155 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2156 | { 6, NULL } |
| 2157 | }; |
| 2158 | |
| 2159 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2160 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2161 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2162 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2163 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2164 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2165 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2166 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2167 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2168 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2169 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2170 | { } /* end */ |
| 2171 | }; |
| 2172 | |
| 2173 | |
| 2174 | /* |
| 2175 | * Z710V model |
| 2176 | * |
| 2177 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2178 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2179 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2180 | */ |
| 2181 | |
| 2182 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2183 | 0x02 |
| 2184 | }; |
| 2185 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2186 | |
| 2187 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2188 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2189 | { 2, NULL } |
| 2190 | }; |
| 2191 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2192 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2193 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2194 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2195 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2196 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2197 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2198 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2199 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2200 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2201 | { } /* end */ |
| 2202 | }; |
| 2203 | |
| 2204 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2205 | /* |
| 2206 | * ALC880 F1734 model |
| 2207 | * |
| 2208 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2209 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2210 | */ |
| 2211 | |
| 2212 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2213 | 0x03 |
| 2214 | }; |
| 2215 | #define ALC880_F1734_HP_DAC 0x02 |
| 2216 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2217 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2218 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2219 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2220 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2221 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2222 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2223 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2224 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2225 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2226 | { } /* end */ |
| 2227 | }; |
| 2228 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2229 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2230 | .num_items = 2, |
| 2231 | .items = { |
| 2232 | { "Mic", 0x1 }, |
| 2233 | { "CD", 0x4 }, |
| 2234 | }, |
| 2235 | }; |
| 2236 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2237 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2238 | /* |
| 2239 | * ALC880 ASUS model |
| 2240 | * |
| 2241 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2242 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2243 | * Mic = 0x18, Line = 0x1a |
| 2244 | */ |
| 2245 | |
| 2246 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2247 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2248 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2249 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2250 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2251 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2252 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2253 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2254 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2255 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2256 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2257 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2258 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2259 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2260 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2261 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2262 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2263 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2264 | { |
| 2265 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2266 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2267 | .info = alc_ch_mode_info, |
| 2268 | .get = alc_ch_mode_get, |
| 2269 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2270 | }, |
| 2271 | { } /* end */ |
| 2272 | }; |
| 2273 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2274 | /* |
| 2275 | * ALC880 ASUS W1V model |
| 2276 | * |
| 2277 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2278 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2279 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2280 | */ |
| 2281 | |
| 2282 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2283 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2284 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2285 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2286 | { } /* end */ |
| 2287 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2288 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2289 | /* TCL S700 */ |
| 2290 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2291 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2292 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2293 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2294 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2295 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2296 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2297 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2298 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2299 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2300 | { } /* end */ |
| 2301 | }; |
| 2302 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2303 | /* Uniwill */ |
| 2304 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2305 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2306 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2307 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2308 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2309 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2310 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2311 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2312 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2313 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2314 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2315 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2316 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2317 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2318 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2319 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2320 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2321 | { |
| 2322 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2323 | .name = "Channel Mode", |
| 2324 | .info = alc_ch_mode_info, |
| 2325 | .get = alc_ch_mode_get, |
| 2326 | .put = alc_ch_mode_put, |
| 2327 | }, |
| 2328 | { } /* end */ |
| 2329 | }; |
| 2330 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2331 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2332 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2333 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2334 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2335 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2336 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2337 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2338 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2339 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2340 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2341 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2342 | { } /* end */ |
| 2343 | }; |
| 2344 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2345 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2346 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2347 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2348 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2349 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2350 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2351 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2352 | { } /* end */ |
| 2353 | }; |
| 2354 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2355 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2356 | * virtual master controls |
| 2357 | */ |
| 2358 | |
| 2359 | /* |
| 2360 | * slave controls for virtual master |
| 2361 | */ |
| 2362 | static const char *alc_slave_vols[] = { |
| 2363 | "Front Playback Volume", |
| 2364 | "Surround Playback Volume", |
| 2365 | "Center Playback Volume", |
| 2366 | "LFE Playback Volume", |
| 2367 | "Side Playback Volume", |
| 2368 | "Headphone Playback Volume", |
| 2369 | "Speaker Playback Volume", |
| 2370 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2371 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2372 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2373 | NULL, |
| 2374 | }; |
| 2375 | |
| 2376 | static const char *alc_slave_sws[] = { |
| 2377 | "Front Playback Switch", |
| 2378 | "Surround Playback Switch", |
| 2379 | "Center Playback Switch", |
| 2380 | "LFE Playback Switch", |
| 2381 | "Side Playback Switch", |
| 2382 | "Headphone Playback Switch", |
| 2383 | "Speaker Playback Switch", |
| 2384 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2385 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2386 | NULL, |
| 2387 | }; |
| 2388 | |
| 2389 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2390 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2391 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2392 | |
| 2393 | static void alc_free_kctls(struct hda_codec *codec); |
| 2394 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2395 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2396 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2397 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2398 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2399 | { } /* end */ |
| 2400 | }; |
| 2401 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2402 | static int alc_build_controls(struct hda_codec *codec) |
| 2403 | { |
| 2404 | struct alc_spec *spec = codec->spec; |
| 2405 | int err; |
| 2406 | int i; |
| 2407 | |
| 2408 | for (i = 0; i < spec->num_mixers; i++) { |
| 2409 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2410 | if (err < 0) |
| 2411 | return err; |
| 2412 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2413 | if (spec->cap_mixer) { |
| 2414 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2415 | if (err < 0) |
| 2416 | return err; |
| 2417 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2418 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2419 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2420 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2421 | if (err < 0) |
| 2422 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2423 | if (!spec->no_analog) { |
| 2424 | err = snd_hda_create_spdif_share_sw(codec, |
| 2425 | &spec->multiout); |
| 2426 | if (err < 0) |
| 2427 | return err; |
| 2428 | spec->multiout.share_spdif = 1; |
| 2429 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2430 | } |
| 2431 | if (spec->dig_in_nid) { |
| 2432 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2433 | if (err < 0) |
| 2434 | return err; |
| 2435 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2436 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2437 | /* create beep controls if needed */ |
| 2438 | if (spec->beep_amp) { |
| 2439 | struct snd_kcontrol_new *knew; |
| 2440 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2441 | struct snd_kcontrol *kctl; |
| 2442 | kctl = snd_ctl_new1(knew, codec); |
| 2443 | if (!kctl) |
| 2444 | return -ENOMEM; |
| 2445 | kctl->private_value = spec->beep_amp; |
| 2446 | err = snd_hda_ctl_add(codec, kctl); |
| 2447 | if (err < 0) |
| 2448 | return err; |
| 2449 | } |
| 2450 | } |
| 2451 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2452 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2453 | if (!spec->no_analog && |
| 2454 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2455 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2456 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2457 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2458 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2459 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2460 | if (err < 0) |
| 2461 | return err; |
| 2462 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2463 | if (!spec->no_analog && |
| 2464 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2465 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2466 | NULL, alc_slave_sws); |
| 2467 | if (err < 0) |
| 2468 | return err; |
| 2469 | } |
| 2470 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2471 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2472 | return 0; |
| 2473 | } |
| 2474 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2475 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2476 | /* |
| 2477 | * initialize the codec volumes, etc |
| 2478 | */ |
| 2479 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2480 | /* |
| 2481 | * generic initialization of ADC, input mixers and output mixers |
| 2482 | */ |
| 2483 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2484 | /* |
| 2485 | * Unmute ADC0-2 and set the default input to mic-in |
| 2486 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2487 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2488 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2489 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2490 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2491 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2492 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2493 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2494 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2495 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2496 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2497 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2498 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2499 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2500 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2501 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2502 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2503 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2504 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2505 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2506 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2507 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2508 | /* |
| 2509 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2510 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2511 | /* set vol=0 to output mixers */ |
| 2512 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2513 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2514 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2515 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2516 | /* set up input amps for analog loopback */ |
| 2517 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2519 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2520 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2521 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2522 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2523 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2524 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2525 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2526 | |
| 2527 | { } |
| 2528 | }; |
| 2529 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2530 | /* |
| 2531 | * 3-stack pin configuration: |
| 2532 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2533 | */ |
| 2534 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2535 | /* |
| 2536 | * preset connection lists of input pins |
| 2537 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2538 | */ |
| 2539 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2540 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2541 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2542 | |
| 2543 | /* |
| 2544 | * Set pin mode and muting |
| 2545 | */ |
| 2546 | /* set front pin widgets 0x14 for output */ |
| 2547 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2548 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2549 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2550 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2551 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2552 | /* Mic2 (as headphone out) for HP output */ |
| 2553 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2554 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2555 | /* Line In pin widget for input */ |
| 2556 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2557 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2558 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2559 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2560 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2561 | /* CD pin widget for input */ |
| 2562 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2563 | |
| 2564 | { } |
| 2565 | }; |
| 2566 | |
| 2567 | /* |
| 2568 | * 5-stack pin configuration: |
| 2569 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2570 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2571 | */ |
| 2572 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2573 | /* |
| 2574 | * preset connection lists of input pins |
| 2575 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2576 | */ |
| 2577 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2578 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2579 | |
| 2580 | /* |
| 2581 | * Set pin mode and muting |
| 2582 | */ |
| 2583 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2584 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2585 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2586 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2587 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2588 | /* unmute pins for output (no gain on this amp) */ |
| 2589 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2590 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2591 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2592 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2593 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2594 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2595 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2596 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2597 | /* Mic2 (as headphone out) for HP output */ |
| 2598 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2599 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2600 | /* Line In pin widget for input */ |
| 2601 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2602 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2603 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2604 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2605 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2606 | /* CD pin widget for input */ |
| 2607 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2608 | |
| 2609 | { } |
| 2610 | }; |
| 2611 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2612 | /* |
| 2613 | * W810 pin configuration: |
| 2614 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2615 | */ |
| 2616 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2617 | /* hphone/speaker input selector: front DAC */ |
| 2618 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2619 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2620 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2621 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2622 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2623 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2624 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2625 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2626 | |
| 2627 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2628 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2629 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2630 | { } |
| 2631 | }; |
| 2632 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2633 | /* |
| 2634 | * Z71V pin configuration: |
| 2635 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2636 | */ |
| 2637 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2638 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2639 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2640 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2641 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2642 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2643 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2644 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2645 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2646 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2647 | |
| 2648 | { } |
| 2649 | }; |
| 2650 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2651 | /* |
| 2652 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2653 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2654 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2655 | */ |
| 2656 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2657 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2658 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2659 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2660 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2661 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2662 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2663 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2664 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2665 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2666 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2667 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2668 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2669 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2670 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2671 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2672 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2673 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2674 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2675 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2676 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2677 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2678 | { } |
| 2679 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2680 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2681 | /* |
| 2682 | * Uniwill pin configuration: |
| 2683 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2684 | * line = 0x1a |
| 2685 | */ |
| 2686 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2687 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2688 | |
| 2689 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2690 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2691 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2692 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2693 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2694 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2695 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2696 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2697 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2698 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2699 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2700 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2701 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2702 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2703 | |
| 2704 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2705 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2706 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2707 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2708 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2709 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2710 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2711 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2712 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2713 | |
| 2714 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2715 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2716 | |
| 2717 | { } |
| 2718 | }; |
| 2719 | |
| 2720 | /* |
| 2721 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2722 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2723 | */ |
| 2724 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2725 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2726 | |
| 2727 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2728 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2729 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2730 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2731 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2732 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2733 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2734 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2735 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2736 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2737 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2738 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2739 | |
| 2740 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2741 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2742 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2743 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2744 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2745 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2746 | |
| 2747 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2748 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2749 | |
| 2750 | { } |
| 2751 | }; |
| 2752 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2753 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2754 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2755 | { } |
| 2756 | }; |
| 2757 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2758 | /* auto-toggle front mic */ |
| 2759 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2760 | { |
| 2761 | unsigned int present; |
| 2762 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2763 | |
| 2764 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2765 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2766 | bits = present ? HDA_AMP_MUTE : 0; |
| 2767 | 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] | 2768 | } |
| 2769 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2770 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2771 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2772 | struct alc_spec *spec = codec->spec; |
| 2773 | |
| 2774 | spec->autocfg.hp_pins[0] = 0x14; |
| 2775 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2776 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2777 | } |
| 2778 | |
| 2779 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 2780 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2781 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2782 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2783 | } |
| 2784 | |
| 2785 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2786 | unsigned int res) |
| 2787 | { |
| 2788 | /* Looks like the unsol event is incompatible with the standard |
| 2789 | * definition. 4bit tag is placed at 28 bit! |
| 2790 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2791 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2792 | case ALC880_MIC_EVENT: |
| 2793 | alc880_uniwill_mic_automute(codec); |
| 2794 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2795 | default: |
| 2796 | alc_automute_amp_unsol_event(codec, res); |
| 2797 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2798 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2799 | } |
| 2800 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2801 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2802 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2803 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2804 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2805 | spec->autocfg.hp_pins[0] = 0x14; |
| 2806 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2807 | } |
| 2808 | |
| 2809 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2810 | { |
| 2811 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2812 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2813 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2814 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2815 | present &= HDA_AMP_VOLMASK; |
| 2816 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2817 | HDA_AMP_VOLMASK, present); |
| 2818 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2819 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2820 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2821 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2822 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2823 | unsigned int res) |
| 2824 | { |
| 2825 | /* Looks like the unsol event is incompatible with the standard |
| 2826 | * definition. 4bit tag is placed at 28 bit! |
| 2827 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2828 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2829 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2830 | else |
| 2831 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2832 | } |
| 2833 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2834 | /* |
| 2835 | * F1734 pin configuration: |
| 2836 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2837 | */ |
| 2838 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2839 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2840 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2841 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2842 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2843 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2844 | |
| 2845 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2846 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2847 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2848 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2849 | |
| 2850 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2851 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2852 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2853 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2854 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2855 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2856 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2857 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2858 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2859 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2860 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2861 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2862 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2863 | { } |
| 2864 | }; |
| 2865 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2866 | /* |
| 2867 | * ASUS pin configuration: |
| 2868 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2869 | */ |
| 2870 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2871 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2872 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2873 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2874 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2875 | |
| 2876 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2877 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2878 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2879 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2880 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2881 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2882 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2883 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2884 | |
| 2885 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2886 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2887 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2888 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2889 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2890 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2891 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2892 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2893 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2894 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2895 | { } |
| 2896 | }; |
| 2897 | |
| 2898 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2899 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2900 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2901 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2902 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2903 | /* Clevo m520g init */ |
| 2904 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2905 | /* headphone output */ |
| 2906 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2907 | /* line-out */ |
| 2908 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2909 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2910 | /* Line-in */ |
| 2911 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2912 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2913 | /* CD */ |
| 2914 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2915 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2916 | /* Mic1 (rear panel) */ |
| 2917 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2918 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2919 | /* Mic2 (front panel) */ |
| 2920 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2921 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2922 | /* headphone */ |
| 2923 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2924 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2925 | /* change to EAPD mode */ |
| 2926 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2927 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2928 | |
| 2929 | { } |
| 2930 | }; |
| 2931 | |
| 2932 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2933 | /* change to EAPD mode */ |
| 2934 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2935 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2936 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2937 | /* Headphone output */ |
| 2938 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2939 | /* Front output*/ |
| 2940 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2941 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2942 | |
| 2943 | /* Line In pin widget for input */ |
| 2944 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2945 | /* CD pin widget for input */ |
| 2946 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2947 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2948 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2949 | |
| 2950 | /* change to EAPD mode */ |
| 2951 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2952 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2953 | |
| 2954 | { } |
| 2955 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2956 | |
| 2957 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2958 | * LG m1 express dual |
| 2959 | * |
| 2960 | * Pin assignment: |
| 2961 | * Rear Line-In/Out (blue): 0x14 |
| 2962 | * Build-in Mic-In: 0x15 |
| 2963 | * Speaker-out: 0x17 |
| 2964 | * HP-Out (green): 0x1b |
| 2965 | * Mic-In/Out (red): 0x19 |
| 2966 | * SPDIF-Out: 0x1e |
| 2967 | */ |
| 2968 | |
| 2969 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2970 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2971 | 0x05, 0x02, 0x03 |
| 2972 | }; |
| 2973 | |
| 2974 | /* seems analog CD is not working */ |
| 2975 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2976 | .num_items = 3, |
| 2977 | .items = { |
| 2978 | { "Mic", 0x1 }, |
| 2979 | { "Line", 0x5 }, |
| 2980 | { "Internal Mic", 0x6 }, |
| 2981 | }, |
| 2982 | }; |
| 2983 | |
| 2984 | /* 2,4,6 channel modes */ |
| 2985 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2986 | /* set line-in and mic-in to input */ |
| 2987 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2988 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2989 | { } |
| 2990 | }; |
| 2991 | |
| 2992 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2993 | /* set line-in to out and mic-in to input */ |
| 2994 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2995 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2996 | { } |
| 2997 | }; |
| 2998 | |
| 2999 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3000 | /* set line-in and mic-in to output */ |
| 3001 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3002 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3003 | { } |
| 3004 | }; |
| 3005 | |
| 3006 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3007 | { 2, alc880_lg_ch2_init }, |
| 3008 | { 4, alc880_lg_ch4_init }, |
| 3009 | { 6, alc880_lg_ch6_init }, |
| 3010 | }; |
| 3011 | |
| 3012 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3013 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3014 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3015 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3016 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3017 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3018 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3019 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3020 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3021 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3022 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3023 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3024 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3025 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3026 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3027 | { |
| 3028 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3029 | .name = "Channel Mode", |
| 3030 | .info = alc_ch_mode_info, |
| 3031 | .get = alc_ch_mode_get, |
| 3032 | .put = alc_ch_mode_put, |
| 3033 | }, |
| 3034 | { } /* end */ |
| 3035 | }; |
| 3036 | |
| 3037 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3038 | /* set capture source to mic-in */ |
| 3039 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3040 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3041 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3042 | /* mute all amp mixer inputs */ |
| 3043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3044 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3045 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3046 | /* line-in to input */ |
| 3047 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3048 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3049 | /* built-in mic */ |
| 3050 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3051 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3052 | /* speaker-out */ |
| 3053 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3054 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3055 | /* mic-in to input */ |
| 3056 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3057 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3058 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3059 | /* HP-out */ |
| 3060 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3061 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3062 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3063 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3064 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3065 | { } |
| 3066 | }; |
| 3067 | |
| 3068 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3069 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3070 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3071 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3072 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3073 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3074 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3075 | } |
| 3076 | |
| 3077 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3078 | * LG LW20 |
| 3079 | * |
| 3080 | * Pin assignment: |
| 3081 | * Speaker-out: 0x14 |
| 3082 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3083 | * Built-in Mic-In: 0x19 |
| 3084 | * Line-In: 0x1b |
| 3085 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3086 | * SPDIF-Out: 0x1e |
| 3087 | */ |
| 3088 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3089 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3090 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3091 | .items = { |
| 3092 | { "Mic", 0x0 }, |
| 3093 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3094 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3095 | }, |
| 3096 | }; |
| 3097 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3098 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3099 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3100 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3101 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3102 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3103 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3104 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3105 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3106 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3107 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3108 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3109 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3110 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3111 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3112 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3113 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3114 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3115 | { |
| 3116 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3117 | .name = "Channel Mode", |
| 3118 | .info = alc_ch_mode_info, |
| 3119 | .get = alc_ch_mode_get, |
| 3120 | .put = alc_ch_mode_put, |
| 3121 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3122 | { } /* end */ |
| 3123 | }; |
| 3124 | |
| 3125 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3126 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3127 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3128 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3129 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3130 | /* set capture source to mic-in */ |
| 3131 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3132 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3133 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3135 | /* speaker-out */ |
| 3136 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3137 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3138 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3139 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3140 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3141 | /* mic-in to input */ |
| 3142 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3143 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3144 | /* built-in mic */ |
| 3145 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3146 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3147 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3148 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3149 | { } |
| 3150 | }; |
| 3151 | |
| 3152 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3153 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3154 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3155 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3156 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3157 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3158 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3159 | } |
| 3160 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3161 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3162 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3163 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3164 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3165 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3166 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3167 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3168 | { } /* end */ |
| 3169 | }; |
| 3170 | |
| 3171 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3172 | .num_items = 2, |
| 3173 | .items = { |
| 3174 | { "Mic", 0x0 }, |
| 3175 | { "Internal Mic", 0x1 }, |
| 3176 | }, |
| 3177 | }; |
| 3178 | |
| 3179 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3180 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3181 | |
| 3182 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3183 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3184 | |
| 3185 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3186 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3187 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3188 | /* Mic2 (as headphone out) for HP output */ |
| 3189 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3190 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3191 | /* Internal Speaker */ |
| 3192 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3193 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3194 | |
| 3195 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3196 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3197 | |
| 3198 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3199 | { } |
| 3200 | }; |
| 3201 | |
| 3202 | /* toggle speaker-output according to the hp-jack state */ |
| 3203 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3204 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3205 | struct alc_spec *spec = codec->spec; |
| 3206 | alc_automute_amp(codec); |
| 3207 | /* toggle EAPD */ |
| 3208 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3209 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3210 | else |
| 3211 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3212 | } |
| 3213 | |
| 3214 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3215 | unsigned int res) |
| 3216 | { |
| 3217 | /* Looks like the unsol event is incompatible with the standard |
| 3218 | * definition. 4bit tag is placed at 28 bit! |
| 3219 | */ |
| 3220 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3221 | alc880_medion_rim_automute(codec); |
| 3222 | } |
| 3223 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3224 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3225 | { |
| 3226 | struct alc_spec *spec = codec->spec; |
| 3227 | |
| 3228 | spec->autocfg.hp_pins[0] = 0x14; |
| 3229 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3230 | } |
| 3231 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3232 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3233 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3234 | { 0x0b, HDA_INPUT, 0 }, |
| 3235 | { 0x0b, HDA_INPUT, 1 }, |
| 3236 | { 0x0b, HDA_INPUT, 2 }, |
| 3237 | { 0x0b, HDA_INPUT, 3 }, |
| 3238 | { 0x0b, HDA_INPUT, 4 }, |
| 3239 | { } /* end */ |
| 3240 | }; |
| 3241 | |
| 3242 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3243 | { 0x0b, HDA_INPUT, 1 }, |
| 3244 | { 0x0b, HDA_INPUT, 6 }, |
| 3245 | { 0x0b, HDA_INPUT, 7 }, |
| 3246 | { } /* end */ |
| 3247 | }; |
| 3248 | #endif |
| 3249 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3250 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3251 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3252 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3253 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3254 | static int alc_init(struct hda_codec *codec) |
| 3255 | { |
| 3256 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3257 | unsigned int i; |
| 3258 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3259 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3260 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3261 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3262 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3263 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3264 | |
| 3265 | if (spec->init_hook) |
| 3266 | spec->init_hook(codec); |
| 3267 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3268 | return 0; |
| 3269 | } |
| 3270 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3271 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3272 | { |
| 3273 | struct alc_spec *spec = codec->spec; |
| 3274 | |
| 3275 | if (spec->unsol_event) |
| 3276 | spec->unsol_event(codec, res); |
| 3277 | } |
| 3278 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3279 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3280 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3281 | { |
| 3282 | struct alc_spec *spec = codec->spec; |
| 3283 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3284 | } |
| 3285 | #endif |
| 3286 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3287 | /* |
| 3288 | * Analog playback callbacks |
| 3289 | */ |
| 3290 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3291 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3292 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3293 | { |
| 3294 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3295 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3296 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3297 | } |
| 3298 | |
| 3299 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3300 | struct hda_codec *codec, |
| 3301 | unsigned int stream_tag, |
| 3302 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3303 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3304 | { |
| 3305 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3306 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3307 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3308 | } |
| 3309 | |
| 3310 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3311 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3312 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3313 | { |
| 3314 | struct alc_spec *spec = codec->spec; |
| 3315 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3316 | } |
| 3317 | |
| 3318 | /* |
| 3319 | * Digital out |
| 3320 | */ |
| 3321 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3322 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3323 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3324 | { |
| 3325 | struct alc_spec *spec = codec->spec; |
| 3326 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3327 | } |
| 3328 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3329 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3330 | struct hda_codec *codec, |
| 3331 | unsigned int stream_tag, |
| 3332 | unsigned int format, |
| 3333 | struct snd_pcm_substream *substream) |
| 3334 | { |
| 3335 | struct alc_spec *spec = codec->spec; |
| 3336 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3337 | stream_tag, format, substream); |
| 3338 | } |
| 3339 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3340 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3341 | struct hda_codec *codec, |
| 3342 | struct snd_pcm_substream *substream) |
| 3343 | { |
| 3344 | struct alc_spec *spec = codec->spec; |
| 3345 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3346 | } |
| 3347 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3348 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3349 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3350 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3351 | { |
| 3352 | struct alc_spec *spec = codec->spec; |
| 3353 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3354 | } |
| 3355 | |
| 3356 | /* |
| 3357 | * Analog capture |
| 3358 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3359 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3360 | struct hda_codec *codec, |
| 3361 | unsigned int stream_tag, |
| 3362 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3363 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3364 | { |
| 3365 | struct alc_spec *spec = codec->spec; |
| 3366 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3367 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3368 | stream_tag, 0, format); |
| 3369 | return 0; |
| 3370 | } |
| 3371 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3372 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3373 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3374 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3375 | { |
| 3376 | struct alc_spec *spec = codec->spec; |
| 3377 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3378 | snd_hda_codec_cleanup_stream(codec, |
| 3379 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3380 | return 0; |
| 3381 | } |
| 3382 | |
| 3383 | |
| 3384 | /* |
| 3385 | */ |
| 3386 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3387 | .substreams = 1, |
| 3388 | .channels_min = 2, |
| 3389 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3390 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3391 | .ops = { |
| 3392 | .open = alc880_playback_pcm_open, |
| 3393 | .prepare = alc880_playback_pcm_prepare, |
| 3394 | .cleanup = alc880_playback_pcm_cleanup |
| 3395 | }, |
| 3396 | }; |
| 3397 | |
| 3398 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3399 | .substreams = 1, |
| 3400 | .channels_min = 2, |
| 3401 | .channels_max = 2, |
| 3402 | /* NID is set in alc_build_pcms */ |
| 3403 | }; |
| 3404 | |
| 3405 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3406 | .substreams = 1, |
| 3407 | .channels_min = 2, |
| 3408 | .channels_max = 2, |
| 3409 | /* NID is set in alc_build_pcms */ |
| 3410 | }; |
| 3411 | |
| 3412 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3413 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3414 | .channels_min = 2, |
| 3415 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3416 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3417 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3418 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3419 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3420 | }, |
| 3421 | }; |
| 3422 | |
| 3423 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3424 | .substreams = 1, |
| 3425 | .channels_min = 2, |
| 3426 | .channels_max = 2, |
| 3427 | /* NID is set in alc_build_pcms */ |
| 3428 | .ops = { |
| 3429 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3430 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3431 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3432 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3433 | }, |
| 3434 | }; |
| 3435 | |
| 3436 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3437 | .substreams = 1, |
| 3438 | .channels_min = 2, |
| 3439 | .channels_max = 2, |
| 3440 | /* NID is set in alc_build_pcms */ |
| 3441 | }; |
| 3442 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3443 | /* 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] | 3444 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3445 | .substreams = 0, |
| 3446 | .channels_min = 0, |
| 3447 | .channels_max = 0, |
| 3448 | }; |
| 3449 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3450 | static int alc_build_pcms(struct hda_codec *codec) |
| 3451 | { |
| 3452 | struct alc_spec *spec = codec->spec; |
| 3453 | struct hda_pcm *info = spec->pcm_rec; |
| 3454 | int i; |
| 3455 | |
| 3456 | codec->num_pcms = 1; |
| 3457 | codec->pcm_info = info; |
| 3458 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3459 | if (spec->no_analog) |
| 3460 | goto skip_analog; |
| 3461 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3462 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3463 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3464 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3465 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3466 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3467 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3468 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3469 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3470 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3471 | } |
| 3472 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3473 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3474 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3475 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3476 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3477 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3478 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3479 | if (spec->channel_mode) { |
| 3480 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3481 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3482 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3483 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3484 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3485 | } |
| 3486 | } |
| 3487 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3488 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3489 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3490 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3491 | snprintf(spec->stream_name_digital, |
| 3492 | sizeof(spec->stream_name_digital), |
| 3493 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3494 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3495 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3496 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3497 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3498 | if (spec->dig_out_type) |
| 3499 | info->pcm_type = spec->dig_out_type; |
| 3500 | else |
| 3501 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3502 | if (spec->multiout.dig_out_nid && |
| 3503 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3504 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3505 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3506 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3507 | if (spec->dig_in_nid && |
| 3508 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3509 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3510 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3511 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3512 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3513 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3514 | } |
| 3515 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3516 | if (spec->no_analog) |
| 3517 | return 0; |
| 3518 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3519 | /* If the use of more than one ADC is requested for the current |
| 3520 | * model, configure a second analog capture-only PCM. |
| 3521 | */ |
| 3522 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3523 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3524 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3525 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3526 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3527 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3528 | if (spec->alt_dac_nid) { |
| 3529 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3530 | *spec->stream_analog_alt_playback; |
| 3531 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3532 | spec->alt_dac_nid; |
| 3533 | } else { |
| 3534 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3535 | alc_pcm_null_stream; |
| 3536 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3537 | } |
| 3538 | if (spec->num_adc_nids > 1) { |
| 3539 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3540 | *spec->stream_analog_alt_capture; |
| 3541 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3542 | spec->adc_nids[1]; |
| 3543 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3544 | spec->num_adc_nids - 1; |
| 3545 | } else { |
| 3546 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3547 | alc_pcm_null_stream; |
| 3548 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3549 | } |
| 3550 | } |
| 3551 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3552 | return 0; |
| 3553 | } |
| 3554 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3555 | static void alc_free_kctls(struct hda_codec *codec) |
| 3556 | { |
| 3557 | struct alc_spec *spec = codec->spec; |
| 3558 | |
| 3559 | if (spec->kctls.list) { |
| 3560 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3561 | int i; |
| 3562 | for (i = 0; i < spec->kctls.used; i++) |
| 3563 | kfree(kctl[i].name); |
| 3564 | } |
| 3565 | snd_array_free(&spec->kctls); |
| 3566 | } |
| 3567 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3568 | static void alc_free(struct hda_codec *codec) |
| 3569 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3570 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3571 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3572 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3573 | return; |
| 3574 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3575 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3576 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3577 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3578 | } |
| 3579 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3580 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3581 | static int alc_resume(struct hda_codec *codec) |
| 3582 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3583 | codec->patch_ops.init(codec); |
| 3584 | snd_hda_codec_resume_amp(codec); |
| 3585 | snd_hda_codec_resume_cache(codec); |
| 3586 | return 0; |
| 3587 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3588 | #endif |
| 3589 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3590 | /* |
| 3591 | */ |
| 3592 | static struct hda_codec_ops alc_patch_ops = { |
| 3593 | .build_controls = alc_build_controls, |
| 3594 | .build_pcms = alc_build_pcms, |
| 3595 | .init = alc_init, |
| 3596 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3597 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3598 | #ifdef SND_HDA_NEEDS_RESUME |
| 3599 | .resume = alc_resume, |
| 3600 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3601 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3602 | .check_power_status = alc_check_power_status, |
| 3603 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3604 | }; |
| 3605 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3606 | |
| 3607 | /* |
| 3608 | * Test configuration for debugging |
| 3609 | * |
| 3610 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3611 | * enum controls. |
| 3612 | */ |
| 3613 | #ifdef CONFIG_SND_DEBUG |
| 3614 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3615 | 0x02, 0x03, 0x04, 0x05 |
| 3616 | }; |
| 3617 | |
| 3618 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3619 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3620 | .items = { |
| 3621 | { "In-1", 0x0 }, |
| 3622 | { "In-2", 0x1 }, |
| 3623 | { "In-3", 0x2 }, |
| 3624 | { "In-4", 0x3 }, |
| 3625 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3626 | { "Front", 0x5 }, |
| 3627 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3628 | }, |
| 3629 | }; |
| 3630 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3631 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3632 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3633 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3634 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3635 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3636 | }; |
| 3637 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3638 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3639 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3640 | { |
| 3641 | static char *texts[] = { |
| 3642 | "N/A", "Line Out", "HP Out", |
| 3643 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3644 | }; |
| 3645 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3646 | uinfo->count = 1; |
| 3647 | uinfo->value.enumerated.items = 8; |
| 3648 | if (uinfo->value.enumerated.item >= 8) |
| 3649 | uinfo->value.enumerated.item = 7; |
| 3650 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3651 | return 0; |
| 3652 | } |
| 3653 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3654 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3655 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3656 | { |
| 3657 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3658 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3659 | unsigned int pin_ctl, item = 0; |
| 3660 | |
| 3661 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3662 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3663 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3664 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3665 | item = 2; |
| 3666 | else |
| 3667 | item = 1; |
| 3668 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3669 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3670 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3671 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3672 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3673 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3674 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3675 | } |
| 3676 | } |
| 3677 | ucontrol->value.enumerated.item[0] = item; |
| 3678 | return 0; |
| 3679 | } |
| 3680 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3681 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3682 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3683 | { |
| 3684 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3685 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3686 | static unsigned int ctls[] = { |
| 3687 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3688 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3689 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3690 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3691 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3692 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3693 | }; |
| 3694 | unsigned int old_ctl, new_ctl; |
| 3695 | |
| 3696 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3697 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3698 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3699 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3700 | int val; |
| 3701 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3702 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3703 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3704 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3705 | HDA_AMP_MUTE : 0; |
| 3706 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3707 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3708 | return 1; |
| 3709 | } |
| 3710 | return 0; |
| 3711 | } |
| 3712 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3713 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3714 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3715 | { |
| 3716 | static char *texts[] = { |
| 3717 | "Front", "Surround", "CLFE", "Side" |
| 3718 | }; |
| 3719 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3720 | uinfo->count = 1; |
| 3721 | uinfo->value.enumerated.items = 4; |
| 3722 | if (uinfo->value.enumerated.item >= 4) |
| 3723 | uinfo->value.enumerated.item = 3; |
| 3724 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3725 | return 0; |
| 3726 | } |
| 3727 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3728 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3729 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3730 | { |
| 3731 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3732 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3733 | unsigned int sel; |
| 3734 | |
| 3735 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3736 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3737 | return 0; |
| 3738 | } |
| 3739 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3740 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3741 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3742 | { |
| 3743 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3744 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3745 | unsigned int sel; |
| 3746 | |
| 3747 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3748 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3749 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3750 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3751 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3752 | return 1; |
| 3753 | } |
| 3754 | return 0; |
| 3755 | } |
| 3756 | |
| 3757 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3758 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3759 | .name = xname, \ |
| 3760 | .info = alc_test_pin_ctl_info, \ |
| 3761 | .get = alc_test_pin_ctl_get, \ |
| 3762 | .put = alc_test_pin_ctl_put, \ |
| 3763 | .private_value = nid \ |
| 3764 | } |
| 3765 | |
| 3766 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3767 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3768 | .name = xname, \ |
| 3769 | .info = alc_test_pin_src_info, \ |
| 3770 | .get = alc_test_pin_src_get, \ |
| 3771 | .put = alc_test_pin_src_put, \ |
| 3772 | .private_value = nid \ |
| 3773 | } |
| 3774 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3775 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3776 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3777 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3778 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3779 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3780 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3781 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3782 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3783 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3784 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3785 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3786 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3787 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3788 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3789 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3790 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3791 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3792 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3793 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3794 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3795 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3796 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3797 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3798 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3799 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3800 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3801 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3802 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3803 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3804 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3805 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3806 | { |
| 3807 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3808 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3809 | .info = alc_ch_mode_info, |
| 3810 | .get = alc_ch_mode_get, |
| 3811 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3812 | }, |
| 3813 | { } /* end */ |
| 3814 | }; |
| 3815 | |
| 3816 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3817 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3818 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3819 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3820 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3821 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3822 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3823 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3824 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3825 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3826 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3827 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3828 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3829 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3830 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3831 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3832 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3833 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3834 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3835 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3836 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3837 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3838 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3839 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3840 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3841 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3842 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3843 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3844 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3845 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3846 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3847 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3848 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3849 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3850 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3851 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3852 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3853 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3854 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3855 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3856 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3857 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3858 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3859 | /* Analog input/passthru */ |
| 3860 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3861 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3862 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3863 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3864 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3865 | { } |
| 3866 | }; |
| 3867 | #endif |
| 3868 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3869 | /* |
| 3870 | */ |
| 3871 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3872 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3873 | [ALC880_3ST] = "3stack", |
| 3874 | [ALC880_TCL_S700] = "tcl", |
| 3875 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3876 | [ALC880_CLEVO] = "clevo", |
| 3877 | [ALC880_5ST] = "5stack", |
| 3878 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3879 | [ALC880_W810] = "w810", |
| 3880 | [ALC880_Z71V] = "z71v", |
| 3881 | [ALC880_6ST] = "6stack", |
| 3882 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3883 | [ALC880_ASUS] = "asus", |
| 3884 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3885 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3886 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3887 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3888 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3889 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3890 | [ALC880_F1734] = "F1734", |
| 3891 | [ALC880_LG] = "lg", |
| 3892 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3893 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3894 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3895 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3896 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3897 | [ALC880_AUTO] = "auto", |
| 3898 | }; |
| 3899 | |
| 3900 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3901 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3902 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3903 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3904 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3905 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3906 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3907 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3908 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3909 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3910 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3911 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3912 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3913 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3914 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3915 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3916 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3917 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3918 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3919 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3920 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3921 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3922 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3923 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3924 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3925 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3926 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3927 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3928 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3929 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3930 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3931 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3932 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3933 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3934 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3935 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3936 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3937 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3938 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3939 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3940 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3941 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3942 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3943 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3944 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3945 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3946 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3947 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3948 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3949 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3950 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3951 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3952 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3953 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3954 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3955 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3956 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3957 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3958 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3959 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3960 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3961 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3962 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3963 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3964 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3965 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3966 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3967 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3968 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3969 | /* default Intel */ |
| 3970 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3971 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3972 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3973 | {} |
| 3974 | }; |
| 3975 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3976 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3977 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3978 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3979 | static struct alc_config_preset alc880_presets[] = { |
| 3980 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3981 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3982 | .init_verbs = { alc880_volume_init_verbs, |
| 3983 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3984 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3985 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3986 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3987 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3988 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3989 | .input_mux = &alc880_capture_source, |
| 3990 | }, |
| 3991 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3992 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3993 | .init_verbs = { alc880_volume_init_verbs, |
| 3994 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3995 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3996 | .dac_nids = alc880_dac_nids, |
| 3997 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3998 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3999 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4000 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4001 | .input_mux = &alc880_capture_source, |
| 4002 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4003 | [ALC880_TCL_S700] = { |
| 4004 | .mixers = { alc880_tcl_s700_mixer }, |
| 4005 | .init_verbs = { alc880_volume_init_verbs, |
| 4006 | alc880_pin_tcl_S700_init_verbs, |
| 4007 | alc880_gpio2_init_verbs }, |
| 4008 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4009 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4010 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4011 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4012 | .hp_nid = 0x03, |
| 4013 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4014 | .channel_mode = alc880_2_jack_modes, |
| 4015 | .input_mux = &alc880_capture_source, |
| 4016 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4017 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4018 | .mixers = { alc880_three_stack_mixer, |
| 4019 | alc880_five_stack_mixer}, |
| 4020 | .init_verbs = { alc880_volume_init_verbs, |
| 4021 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4022 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4023 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4024 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4025 | .channel_mode = alc880_fivestack_modes, |
| 4026 | .input_mux = &alc880_capture_source, |
| 4027 | }, |
| 4028 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4029 | .mixers = { alc880_three_stack_mixer, |
| 4030 | alc880_five_stack_mixer }, |
| 4031 | .init_verbs = { alc880_volume_init_verbs, |
| 4032 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4033 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4034 | .dac_nids = alc880_dac_nids, |
| 4035 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4036 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4037 | .channel_mode = alc880_fivestack_modes, |
| 4038 | .input_mux = &alc880_capture_source, |
| 4039 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4040 | [ALC880_6ST] = { |
| 4041 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4042 | .init_verbs = { alc880_volume_init_verbs, |
| 4043 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4044 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4045 | .dac_nids = alc880_6st_dac_nids, |
| 4046 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4047 | .channel_mode = alc880_sixstack_modes, |
| 4048 | .input_mux = &alc880_6stack_capture_source, |
| 4049 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4050 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4051 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4052 | .init_verbs = { alc880_volume_init_verbs, |
| 4053 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4054 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4055 | .dac_nids = alc880_6st_dac_nids, |
| 4056 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4057 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4058 | .channel_mode = alc880_sixstack_modes, |
| 4059 | .input_mux = &alc880_6stack_capture_source, |
| 4060 | }, |
| 4061 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4062 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4063 | .init_verbs = { alc880_volume_init_verbs, |
| 4064 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4065 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4066 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4067 | .dac_nids = alc880_w810_dac_nids, |
| 4068 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4069 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4070 | .channel_mode = alc880_w810_modes, |
| 4071 | .input_mux = &alc880_capture_source, |
| 4072 | }, |
| 4073 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4074 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4075 | .init_verbs = { alc880_volume_init_verbs, |
| 4076 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4077 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4078 | .dac_nids = alc880_z71v_dac_nids, |
| 4079 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4080 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4081 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4082 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4083 | .input_mux = &alc880_capture_source, |
| 4084 | }, |
| 4085 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4086 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4087 | .init_verbs = { alc880_volume_init_verbs, |
| 4088 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4089 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4090 | .dac_nids = alc880_f1734_dac_nids, |
| 4091 | .hp_nid = 0x02, |
| 4092 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4093 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4094 | .input_mux = &alc880_f1734_capture_source, |
| 4095 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4096 | .setup = alc880_uniwill_p53_setup, |
| 4097 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4098 | }, |
| 4099 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4100 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4101 | .init_verbs = { alc880_volume_init_verbs, |
| 4102 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4103 | alc880_gpio1_init_verbs }, |
| 4104 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4105 | .dac_nids = alc880_asus_dac_nids, |
| 4106 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4107 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4108 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4109 | .input_mux = &alc880_capture_source, |
| 4110 | }, |
| 4111 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4112 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4113 | .init_verbs = { alc880_volume_init_verbs, |
| 4114 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4115 | alc880_gpio1_init_verbs }, |
| 4116 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4117 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4118 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4119 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4120 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4121 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4122 | .input_mux = &alc880_capture_source, |
| 4123 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4124 | [ALC880_ASUS_DIG2] = { |
| 4125 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4126 | .init_verbs = { alc880_volume_init_verbs, |
| 4127 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4128 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4129 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4130 | .dac_nids = alc880_asus_dac_nids, |
| 4131 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4132 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4133 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4134 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4135 | .input_mux = &alc880_capture_source, |
| 4136 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4137 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4138 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4139 | .init_verbs = { alc880_volume_init_verbs, |
| 4140 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4141 | alc880_gpio1_init_verbs }, |
| 4142 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4143 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4144 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4145 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4146 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4147 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4148 | .input_mux = &alc880_capture_source, |
| 4149 | }, |
| 4150 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4151 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4152 | .init_verbs = { alc880_volume_init_verbs, |
| 4153 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4154 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4155 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4156 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4157 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4158 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4159 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4160 | .input_mux = &alc880_capture_source, |
| 4161 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4162 | [ALC880_UNIWILL] = { |
| 4163 | .mixers = { alc880_uniwill_mixer }, |
| 4164 | .init_verbs = { alc880_volume_init_verbs, |
| 4165 | alc880_uniwill_init_verbs }, |
| 4166 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4167 | .dac_nids = alc880_asus_dac_nids, |
| 4168 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4169 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4170 | .channel_mode = alc880_threestack_modes, |
| 4171 | .need_dac_fix = 1, |
| 4172 | .input_mux = &alc880_capture_source, |
| 4173 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4174 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4175 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4176 | }, |
| 4177 | [ALC880_UNIWILL_P53] = { |
| 4178 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4179 | .init_verbs = { alc880_volume_init_verbs, |
| 4180 | alc880_uniwill_p53_init_verbs }, |
| 4181 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4182 | .dac_nids = alc880_asus_dac_nids, |
| 4183 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4184 | .channel_mode = alc880_threestack_modes, |
| 4185 | .input_mux = &alc880_capture_source, |
| 4186 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4187 | .setup = alc880_uniwill_p53_setup, |
| 4188 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4189 | }, |
| 4190 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4191 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4192 | .init_verbs = { alc880_volume_init_verbs, |
| 4193 | alc880_uniwill_p53_init_verbs, |
| 4194 | alc880_beep_init_verbs }, |
| 4195 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4196 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4197 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4198 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4199 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4200 | .input_mux = &alc880_capture_source, |
| 4201 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4202 | .setup = alc880_uniwill_p53_setup, |
| 4203 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4204 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4205 | [ALC880_CLEVO] = { |
| 4206 | .mixers = { alc880_three_stack_mixer }, |
| 4207 | .init_verbs = { alc880_volume_init_verbs, |
| 4208 | alc880_pin_clevo_init_verbs }, |
| 4209 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4210 | .dac_nids = alc880_dac_nids, |
| 4211 | .hp_nid = 0x03, |
| 4212 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4213 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4214 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4215 | .input_mux = &alc880_capture_source, |
| 4216 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4217 | [ALC880_LG] = { |
| 4218 | .mixers = { alc880_lg_mixer }, |
| 4219 | .init_verbs = { alc880_volume_init_verbs, |
| 4220 | alc880_lg_init_verbs }, |
| 4221 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4222 | .dac_nids = alc880_lg_dac_nids, |
| 4223 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4224 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4225 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4226 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4227 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4228 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4229 | .setup = alc880_lg_setup, |
| 4230 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4231 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4232 | .loopbacks = alc880_lg_loopbacks, |
| 4233 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4234 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4235 | [ALC880_LG_LW] = { |
| 4236 | .mixers = { alc880_lg_lw_mixer }, |
| 4237 | .init_verbs = { alc880_volume_init_verbs, |
| 4238 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4239 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4240 | .dac_nids = alc880_dac_nids, |
| 4241 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4242 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4243 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4244 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4245 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4246 | .setup = alc880_lg_lw_setup, |
| 4247 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4248 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4249 | [ALC880_MEDION_RIM] = { |
| 4250 | .mixers = { alc880_medion_rim_mixer }, |
| 4251 | .init_verbs = { alc880_volume_init_verbs, |
| 4252 | alc880_medion_rim_init_verbs, |
| 4253 | alc_gpio2_init_verbs }, |
| 4254 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4255 | .dac_nids = alc880_dac_nids, |
| 4256 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4257 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4258 | .channel_mode = alc880_2_jack_modes, |
| 4259 | .input_mux = &alc880_medion_rim_capture_source, |
| 4260 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4261 | .setup = alc880_medion_rim_setup, |
| 4262 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4263 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4264 | #ifdef CONFIG_SND_DEBUG |
| 4265 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4266 | .mixers = { alc880_test_mixer }, |
| 4267 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4268 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4269 | .dac_nids = alc880_test_dac_nids, |
| 4270 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4271 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4272 | .channel_mode = alc880_test_modes, |
| 4273 | .input_mux = &alc880_test_capture_source, |
| 4274 | }, |
| 4275 | #endif |
| 4276 | }; |
| 4277 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4278 | /* |
| 4279 | * Automatic parse of I/O pins from the BIOS configuration |
| 4280 | */ |
| 4281 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4282 | enum { |
| 4283 | ALC_CTL_WIDGET_VOL, |
| 4284 | ALC_CTL_WIDGET_MUTE, |
| 4285 | ALC_CTL_BIND_MUTE, |
| 4286 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4287 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4288 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4289 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4290 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4291 | }; |
| 4292 | |
| 4293 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4294 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4295 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4296 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4297 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4298 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4299 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4300 | knew = snd_array_new(&spec->kctls); |
| 4301 | if (!knew) |
| 4302 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4303 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4304 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4305 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4306 | return -ENOMEM; |
| 4307 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4308 | return 0; |
| 4309 | } |
| 4310 | |
| 4311 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4312 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4313 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4314 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4315 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4316 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4317 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4318 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4319 | #define ALC880_PIN_CD_NID 0x1c |
| 4320 | |
| 4321 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4322 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4323 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4324 | { |
| 4325 | hda_nid_t nid; |
| 4326 | int assigned[4]; |
| 4327 | int i, j; |
| 4328 | |
| 4329 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4330 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4331 | |
| 4332 | /* check the pins hardwired to audio widget */ |
| 4333 | for (i = 0; i < cfg->line_outs; i++) { |
| 4334 | nid = cfg->line_out_pins[i]; |
| 4335 | if (alc880_is_fixed_pin(nid)) { |
| 4336 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4337 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4338 | assigned[idx] = 1; |
| 4339 | } |
| 4340 | } |
| 4341 | /* left pins can be connect to any audio widget */ |
| 4342 | for (i = 0; i < cfg->line_outs; i++) { |
| 4343 | nid = cfg->line_out_pins[i]; |
| 4344 | if (alc880_is_fixed_pin(nid)) |
| 4345 | continue; |
| 4346 | /* search for an empty channel */ |
| 4347 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4348 | if (!assigned[j]) { |
| 4349 | spec->multiout.dac_nids[i] = |
| 4350 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4351 | assigned[j] = 1; |
| 4352 | break; |
| 4353 | } |
| 4354 | } |
| 4355 | } |
| 4356 | spec->multiout.num_dacs = cfg->line_outs; |
| 4357 | return 0; |
| 4358 | } |
| 4359 | |
| 4360 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4361 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4362 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4363 | { |
| 4364 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4365 | static const char *chname[4] = { |
| 4366 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4367 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4368 | hda_nid_t nid; |
| 4369 | int i, err; |
| 4370 | |
| 4371 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4372 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4373 | continue; |
| 4374 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4375 | if (i == 2) { |
| 4376 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4377 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4378 | "Center Playback Volume", |
| 4379 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4380 | HDA_OUTPUT)); |
| 4381 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4382 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4383 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4384 | "LFE Playback Volume", |
| 4385 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4386 | HDA_OUTPUT)); |
| 4387 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4388 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4389 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4390 | "Center Playback Switch", |
| 4391 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4392 | HDA_INPUT)); |
| 4393 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4394 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4395 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4396 | "LFE Playback Switch", |
| 4397 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4398 | HDA_INPUT)); |
| 4399 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4400 | return err; |
| 4401 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4402 | const char *pfx; |
| 4403 | if (cfg->line_outs == 1 && |
| 4404 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4405 | pfx = "Speaker"; |
| 4406 | else |
| 4407 | pfx = chname[i]; |
| 4408 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4409 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4410 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4411 | HDA_OUTPUT)); |
| 4412 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4413 | return err; |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4414 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4415 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4416 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4417 | HDA_INPUT)); |
| 4418 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4419 | return err; |
| 4420 | } |
| 4421 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4422 | return 0; |
| 4423 | } |
| 4424 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4425 | /* add playback controls for speaker and HP outputs */ |
| 4426 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4427 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4428 | { |
| 4429 | hda_nid_t nid; |
| 4430 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4431 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4432 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4433 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4434 | return 0; |
| 4435 | |
| 4436 | if (alc880_is_fixed_pin(pin)) { |
| 4437 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4438 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4439 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4440 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4441 | else |
| 4442 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4443 | /* control HP volume/switch on the output mixer amp */ |
| 4444 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4445 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4446 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4447 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4448 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4449 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4450 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4451 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4452 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4453 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4454 | return err; |
| 4455 | } else if (alc880_is_multi_pin(pin)) { |
| 4456 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4457 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4458 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4459 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4460 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4461 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4462 | return err; |
| 4463 | } |
| 4464 | return 0; |
| 4465 | } |
| 4466 | |
| 4467 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4468 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4469 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4470 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4471 | { |
| 4472 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4473 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4474 | |
| 4475 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4476 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4477 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4478 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4479 | return err; |
| 4480 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4481 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4482 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4483 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4484 | return err; |
| 4485 | return 0; |
| 4486 | } |
| 4487 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4488 | 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] | 4489 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4490 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4491 | return (pincap & AC_PINCAP_IN) != 0; |
| 4492 | } |
| 4493 | |
| 4494 | /* create playback/capture controls for input pins */ |
| 4495 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4496 | const struct auto_pin_cfg *cfg, |
| 4497 | hda_nid_t mixer, |
| 4498 | hda_nid_t cap1, hda_nid_t cap2) |
| 4499 | { |
| 4500 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4501 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4502 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4503 | |
| 4504 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4505 | hda_nid_t pin; |
| 4506 | |
| 4507 | pin = cfg->input_pins[i]; |
| 4508 | if (!alc_is_input_pin(codec, pin)) |
| 4509 | continue; |
| 4510 | |
| 4511 | if (mixer) { |
| 4512 | idx = get_connection_index(codec, mixer, pin); |
| 4513 | if (idx >= 0) { |
| 4514 | err = new_analog_input(spec, pin, |
| 4515 | auto_pin_cfg_labels[i], |
| 4516 | idx, mixer); |
| 4517 | if (err < 0) |
| 4518 | return err; |
| 4519 | } |
| 4520 | } |
| 4521 | |
| 4522 | if (!cap1) |
| 4523 | continue; |
| 4524 | idx = get_connection_index(codec, cap1, pin); |
| 4525 | if (idx < 0 && cap2) |
| 4526 | idx = get_connection_index(codec, cap2, pin); |
| 4527 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4528 | imux->items[imux->num_items].label = |
| 4529 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4530 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4531 | imux->num_items++; |
| 4532 | } |
| 4533 | } |
| 4534 | return 0; |
| 4535 | } |
| 4536 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4537 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4538 | const struct auto_pin_cfg *cfg) |
| 4539 | { |
| 4540 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4541 | } |
| 4542 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4543 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4544 | unsigned int pin_type) |
| 4545 | { |
| 4546 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4547 | pin_type); |
| 4548 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4549 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4550 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4551 | } |
| 4552 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4553 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4554 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4555 | int dac_idx) |
| 4556 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4557 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4558 | /* need the manual connection? */ |
| 4559 | if (alc880_is_multi_pin(nid)) { |
| 4560 | struct alc_spec *spec = codec->spec; |
| 4561 | int idx = alc880_multi_pin_idx(nid); |
| 4562 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4563 | AC_VERB_SET_CONNECT_SEL, |
| 4564 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4565 | } |
| 4566 | } |
| 4567 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4568 | static int get_pin_type(int line_out_type) |
| 4569 | { |
| 4570 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4571 | return PIN_HP; |
| 4572 | else |
| 4573 | return PIN_OUT; |
| 4574 | } |
| 4575 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4576 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4577 | { |
| 4578 | struct alc_spec *spec = codec->spec; |
| 4579 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4580 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4581 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4582 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4583 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4584 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4585 | } |
| 4586 | } |
| 4587 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4588 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4589 | { |
| 4590 | struct alc_spec *spec = codec->spec; |
| 4591 | hda_nid_t pin; |
| 4592 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4593 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4594 | if (pin) /* connect to front */ |
| 4595 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4596 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4597 | if (pin) /* connect to front */ |
| 4598 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4599 | } |
| 4600 | |
| 4601 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4602 | { |
| 4603 | struct alc_spec *spec = codec->spec; |
| 4604 | int i; |
| 4605 | |
| 4606 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4607 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4608 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4609 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4610 | if (nid != ALC880_PIN_CD_NID && |
| 4611 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4612 | snd_hda_codec_write(codec, nid, 0, |
| 4613 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4614 | AMP_OUT_MUTE); |
| 4615 | } |
| 4616 | } |
| 4617 | } |
| 4618 | |
| 4619 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4620 | /* return 1 if successful, 0 if the proper config is not found, |
| 4621 | * or a negative error code |
| 4622 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4623 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4624 | { |
| 4625 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4626 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4627 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4628 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4629 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4630 | alc880_ignore); |
| 4631 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4632 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4633 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4634 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4635 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4636 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4637 | if (err < 0) |
| 4638 | return err; |
| 4639 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4640 | if (err < 0) |
| 4641 | return err; |
| 4642 | err = alc880_auto_create_extra_out(spec, |
| 4643 | spec->autocfg.speaker_pins[0], |
| 4644 | "Speaker"); |
| 4645 | if (err < 0) |
| 4646 | return err; |
| 4647 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4648 | "Headphone"); |
| 4649 | if (err < 0) |
| 4650 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4651 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4652 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4653 | return err; |
| 4654 | |
| 4655 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4656 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4657 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4658 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4659 | hda_nid_t dig_nid; |
| 4660 | err = snd_hda_get_connections(codec, |
| 4661 | spec->autocfg.dig_out_pins[i], |
| 4662 | &dig_nid, 1); |
| 4663 | if (err < 0) |
| 4664 | continue; |
| 4665 | if (!i) |
| 4666 | spec->multiout.dig_out_nid = dig_nid; |
| 4667 | else { |
| 4668 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4669 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4670 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4671 | break; |
| 4672 | } |
| 4673 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4674 | if (spec->autocfg.dig_in_pin) |
| 4675 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4676 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4677 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4678 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4679 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4680 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4681 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4682 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4683 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4684 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4685 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4686 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4687 | return 1; |
| 4688 | } |
| 4689 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4690 | /* additional initialization for auto-configuration model */ |
| 4691 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4692 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4693 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4694 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4695 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4696 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4697 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4698 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4699 | } |
| 4700 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4701 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 4702 | * one of two digital mic pins, e.g. on ALC272 |
| 4703 | */ |
| 4704 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4705 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4706 | struct alc_spec *spec = codec->spec; |
| 4707 | int i; |
| 4708 | |
| 4709 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4710 | hda_nid_t cap = spec->capsrc_nids ? |
| 4711 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4712 | int iidx, eidx; |
| 4713 | |
| 4714 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 4715 | if (iidx < 0) |
| 4716 | continue; |
| 4717 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 4718 | if (eidx < 0) |
| 4719 | continue; |
| 4720 | spec->int_mic.mux_idx = iidx; |
| 4721 | spec->ext_mic.mux_idx = eidx; |
| 4722 | if (spec->capsrc_nids) |
| 4723 | spec->capsrc_nids += i; |
| 4724 | spec->adc_nids += i; |
| 4725 | spec->num_adc_nids = 1; |
| 4726 | return; |
| 4727 | } |
| 4728 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 4729 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 4730 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 4731 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 4732 | } |
| 4733 | |
| 4734 | static void set_capture_mixer(struct hda_codec *codec) |
| 4735 | { |
| 4736 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4737 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4738 | { alc_capture_mixer_nosrc1, |
| 4739 | alc_capture_mixer_nosrc2, |
| 4740 | alc_capture_mixer_nosrc3 }, |
| 4741 | { alc_capture_mixer1, |
| 4742 | alc_capture_mixer2, |
| 4743 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4744 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4745 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4746 | int mux; |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4747 | if (spec->auto_mic) { |
| 4748 | mux = 0; |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4749 | fixup_automic_adc(codec); |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4750 | } else if (spec->input_mux && spec->input_mux->num_items > 1) |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4751 | mux = 1; |
| 4752 | else |
| 4753 | mux = 0; |
| 4754 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4755 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4756 | } |
| 4757 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4758 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4759 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4760 | |
| 4761 | /* |
| 4762 | * OK, here we have finally the patch for ALC880 |
| 4763 | */ |
| 4764 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4765 | static int patch_alc880(struct hda_codec *codec) |
| 4766 | { |
| 4767 | struct alc_spec *spec; |
| 4768 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4769 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4770 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4771 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4772 | if (spec == NULL) |
| 4773 | return -ENOMEM; |
| 4774 | |
| 4775 | codec->spec = spec; |
| 4776 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4777 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4778 | alc880_models, |
| 4779 | alc880_cfg_tbl); |
| 4780 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 4781 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 4782 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4783 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4784 | } |
| 4785 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4786 | if (board_config == ALC880_AUTO) { |
| 4787 | /* automatic parse from the BIOS config */ |
| 4788 | err = alc880_parse_auto_config(codec); |
| 4789 | if (err < 0) { |
| 4790 | alc_free(codec); |
| 4791 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4792 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4793 | printk(KERN_INFO |
| 4794 | "hda_codec: Cannot set up configuration " |
| 4795 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4796 | board_config = ALC880_3ST; |
| 4797 | } |
| 4798 | } |
| 4799 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4800 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4801 | if (err < 0) { |
| 4802 | alc_free(codec); |
| 4803 | return err; |
| 4804 | } |
| 4805 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4806 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 4807 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4808 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4809 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4810 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4811 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4812 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4813 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4814 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4815 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4816 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4817 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4818 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4819 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 4820 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4821 | if (wcap != AC_WID_AUD_IN) { |
| 4822 | spec->adc_nids = alc880_adc_nids_alt; |
| 4823 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4824 | } else { |
| 4825 | spec->adc_nids = alc880_adc_nids; |
| 4826 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4827 | } |
| 4828 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4829 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4830 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4831 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4832 | spec->vmaster_nid = 0x0c; |
| 4833 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4834 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4835 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4836 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4837 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4838 | if (!spec->loopback.amplist) |
| 4839 | spec->loopback.amplist = alc880_loopbacks; |
| 4840 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4841 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4842 | |
| 4843 | return 0; |
| 4844 | } |
| 4845 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4846 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4847 | /* |
| 4848 | * ALC260 support |
| 4849 | */ |
| 4850 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4851 | static hda_nid_t alc260_dac_nids[1] = { |
| 4852 | /* front */ |
| 4853 | 0x02, |
| 4854 | }; |
| 4855 | |
| 4856 | static hda_nid_t alc260_adc_nids[1] = { |
| 4857 | /* ADC0 */ |
| 4858 | 0x04, |
| 4859 | }; |
| 4860 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4861 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4862 | /* ADC1 */ |
| 4863 | 0x05, |
| 4864 | }; |
| 4865 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4866 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4867 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4868 | */ |
| 4869 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4870 | /* ADC0, ADC1 */ |
| 4871 | 0x04, 0x05 |
| 4872 | }; |
| 4873 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4874 | #define ALC260_DIGOUT_NID 0x03 |
| 4875 | #define ALC260_DIGIN_NID 0x06 |
| 4876 | |
| 4877 | static struct hda_input_mux alc260_capture_source = { |
| 4878 | .num_items = 4, |
| 4879 | .items = { |
| 4880 | { "Mic", 0x0 }, |
| 4881 | { "Front Mic", 0x1 }, |
| 4882 | { "Line", 0x2 }, |
| 4883 | { "CD", 0x4 }, |
| 4884 | }, |
| 4885 | }; |
| 4886 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4887 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4888 | * headphone jack and the internal CD lines since these are the only pins at |
| 4889 | * which audio can appear. For flexibility, also allow the option of |
| 4890 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4891 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4892 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4893 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4894 | { |
| 4895 | .num_items = 3, |
| 4896 | .items = { |
| 4897 | { "Mic/Line", 0x0 }, |
| 4898 | { "CD", 0x4 }, |
| 4899 | { "Headphone", 0x2 }, |
| 4900 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4901 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4902 | { |
| 4903 | .num_items = 4, |
| 4904 | .items = { |
| 4905 | { "Mic/Line", 0x0 }, |
| 4906 | { "CD", 0x4 }, |
| 4907 | { "Headphone", 0x2 }, |
| 4908 | { "Mixer", 0x5 }, |
| 4909 | }, |
| 4910 | }, |
| 4911 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4912 | }; |
| 4913 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4914 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4915 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4916 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4917 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4918 | { |
| 4919 | .num_items = 4, |
| 4920 | .items = { |
| 4921 | { "Mic", 0x0 }, |
| 4922 | { "Line", 0x2 }, |
| 4923 | { "CD", 0x4 }, |
| 4924 | { "Headphone", 0x5 }, |
| 4925 | }, |
| 4926 | }, |
| 4927 | { |
| 4928 | .num_items = 5, |
| 4929 | .items = { |
| 4930 | { "Mic", 0x0 }, |
| 4931 | { "Line", 0x2 }, |
| 4932 | { "CD", 0x4 }, |
| 4933 | { "Headphone", 0x6 }, |
| 4934 | { "Mixer", 0x5 }, |
| 4935 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4936 | }, |
| 4937 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4938 | |
| 4939 | /* Maxdata Favorit 100XS */ |
| 4940 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4941 | { |
| 4942 | .num_items = 2, |
| 4943 | .items = { |
| 4944 | { "Line/Mic", 0x0 }, |
| 4945 | { "CD", 0x4 }, |
| 4946 | }, |
| 4947 | }, |
| 4948 | { |
| 4949 | .num_items = 3, |
| 4950 | .items = { |
| 4951 | { "Line/Mic", 0x0 }, |
| 4952 | { "CD", 0x4 }, |
| 4953 | { "Mixer", 0x5 }, |
| 4954 | }, |
| 4955 | }, |
| 4956 | }; |
| 4957 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4958 | /* |
| 4959 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4960 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4961 | * element which allows changing the channel mode, so the verb list is |
| 4962 | * never used. |
| 4963 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4964 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4965 | { 2, NULL }, |
| 4966 | }; |
| 4967 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4968 | |
| 4969 | /* Mixer combinations |
| 4970 | * |
| 4971 | * basic: base_output + input + pc_beep + capture |
| 4972 | * HP: base_output + input + capture_alt |
| 4973 | * HP_3013: hp_3013 + input + capture |
| 4974 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4975 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4976 | */ |
| 4977 | |
| 4978 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4979 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4980 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4981 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4982 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4983 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4984 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4985 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4986 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4987 | |
| 4988 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4989 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4990 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4991 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4992 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4995 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4996 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4997 | { } /* end */ |
| 4998 | }; |
| 4999 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5000 | /* update HP, line and mono out pins according to the master switch */ |
| 5001 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5002 | hda_nid_t hp, hda_nid_t line, |
| 5003 | hda_nid_t mono) |
| 5004 | { |
| 5005 | struct alc_spec *spec = codec->spec; |
| 5006 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5007 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5008 | 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] | 5009 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5010 | 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] | 5011 | val); |
| 5012 | /* mono (speaker) depending on the HP jack sense */ |
| 5013 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5014 | 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] | 5015 | val); |
| 5016 | } |
| 5017 | |
| 5018 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5019 | struct snd_ctl_elem_value *ucontrol) |
| 5020 | { |
| 5021 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5022 | struct alc_spec *spec = codec->spec; |
| 5023 | *ucontrol->value.integer.value = spec->master_sw; |
| 5024 | return 0; |
| 5025 | } |
| 5026 | |
| 5027 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5028 | struct snd_ctl_elem_value *ucontrol) |
| 5029 | { |
| 5030 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5031 | struct alc_spec *spec = codec->spec; |
| 5032 | int val = !!*ucontrol->value.integer.value; |
| 5033 | hda_nid_t hp, line, mono; |
| 5034 | |
| 5035 | if (val == spec->master_sw) |
| 5036 | return 0; |
| 5037 | spec->master_sw = val; |
| 5038 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5039 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5040 | mono = kcontrol->private_value & 0xff; |
| 5041 | alc260_hp_master_update(codec, hp, line, mono); |
| 5042 | return 1; |
| 5043 | } |
| 5044 | |
| 5045 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5046 | { |
| 5047 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5048 | .name = "Master Playback Switch", |
| 5049 | .info = snd_ctl_boolean_mono_info, |
| 5050 | .get = alc260_hp_master_sw_get, |
| 5051 | .put = alc260_hp_master_sw_put, |
| 5052 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5053 | }, |
| 5054 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5055 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5056 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5057 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5058 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5059 | HDA_OUTPUT), |
| 5060 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5061 | { } /* end */ |
| 5062 | }; |
| 5063 | |
| 5064 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5065 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5066 | {}, |
| 5067 | }; |
| 5068 | |
| 5069 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5070 | { |
| 5071 | struct alc_spec *spec = codec->spec; |
| 5072 | unsigned int present; |
| 5073 | |
| 5074 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 5075 | AC_VERB_GET_PIN_SENSE, 0); |
| 5076 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 5077 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5078 | } |
| 5079 | |
| 5080 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5081 | { |
| 5082 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5083 | alc260_hp_automute(codec); |
| 5084 | } |
| 5085 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5086 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5087 | { |
| 5088 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5089 | .name = "Master Playback Switch", |
| 5090 | .info = snd_ctl_boolean_mono_info, |
| 5091 | .get = alc260_hp_master_sw_get, |
| 5092 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5093 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5094 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5095 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5096 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5097 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5098 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5099 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5100 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5101 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5102 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5103 | { } /* end */ |
| 5104 | }; |
| 5105 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5106 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5107 | .ops = &snd_hda_bind_vol, |
| 5108 | .values = { |
| 5109 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5110 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5111 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5112 | 0 |
| 5113 | }, |
| 5114 | }; |
| 5115 | |
| 5116 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5117 | .ops = &snd_hda_bind_sw, |
| 5118 | .values = { |
| 5119 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5120 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5121 | 0 |
| 5122 | }, |
| 5123 | }; |
| 5124 | |
| 5125 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5126 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5127 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5128 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5129 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5130 | { } /* end */ |
| 5131 | }; |
| 5132 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5133 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5134 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5135 | {}, |
| 5136 | }; |
| 5137 | |
| 5138 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5139 | { |
| 5140 | struct alc_spec *spec = codec->spec; |
| 5141 | unsigned int present; |
| 5142 | |
| 5143 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5144 | AC_VERB_GET_PIN_SENSE, 0); |
| 5145 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5146 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5147 | } |
| 5148 | |
| 5149 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5150 | unsigned int res) |
| 5151 | { |
| 5152 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5153 | alc260_hp_3013_automute(codec); |
| 5154 | } |
| 5155 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5156 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5157 | { |
| 5158 | unsigned int present, bits; |
| 5159 | |
| 5160 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 5161 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 5162 | |
| 5163 | bits = present ? 0 : PIN_OUT; |
| 5164 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5165 | bits); |
| 5166 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5167 | bits); |
| 5168 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5169 | bits); |
| 5170 | } |
| 5171 | |
| 5172 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5173 | unsigned int res) |
| 5174 | { |
| 5175 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5176 | alc260_hp_3012_automute(codec); |
| 5177 | } |
| 5178 | |
| 5179 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5180 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5181 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5182 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5183 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5184 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5185 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5186 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5187 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5188 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5189 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5190 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5191 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5192 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5193 | { } /* end */ |
| 5194 | }; |
| 5195 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5196 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5197 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5198 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5199 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5200 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5201 | * revisions available in early 2006. Therefore for now allow the |
| 5202 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5203 | * that the lack of mic bias for this NID is intentional we could change the |
| 5204 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5205 | * |
| 5206 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5207 | * don't appear to make the mic bias available from the "line" jack, even |
| 5208 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5209 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5210 | * and the output jack. If this turns out to be the case for all such |
| 5211 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5212 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5213 | * |
| 5214 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5215 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5216 | * controls for such models. On models without a "mono speaker" the control |
| 5217 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5218 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5219 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5220 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5221 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5222 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5223 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5224 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5225 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5226 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5227 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5228 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5229 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5230 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5231 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5232 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5233 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5234 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5235 | { } /* end */ |
| 5236 | }; |
| 5237 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5238 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5239 | */ |
| 5240 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5241 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5242 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5243 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5244 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5245 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5246 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5247 | { } /* end */ |
| 5248 | }; |
| 5249 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5250 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5251 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5252 | */ |
| 5253 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5254 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5255 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5256 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5257 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5258 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5259 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5260 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5261 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5262 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5263 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5264 | { } /* end */ |
| 5265 | }; |
| 5266 | |
| 5267 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5268 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5269 | */ |
| 5270 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5271 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5272 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5273 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5274 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5275 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5276 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5277 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5278 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5279 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5280 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5281 | { } /* end */ |
| 5282 | }; |
| 5283 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5284 | /* |
| 5285 | * initialization verbs |
| 5286 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5287 | static struct hda_verb alc260_init_verbs[] = { |
| 5288 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5289 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5290 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5291 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5292 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5293 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5294 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5295 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5296 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5297 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5298 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5299 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5300 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5301 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5302 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5303 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5304 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5305 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5306 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5307 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5308 | /* set connection select to line in (default select for this ADC) */ |
| 5309 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5310 | /* mute capture amp left and right */ |
| 5311 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5312 | /* set connection select to line in (default select for this ADC) */ |
| 5313 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5314 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5315 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5316 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5317 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5318 | /* set vol=0 HP mixer amp left and right */ |
| 5319 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5320 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5321 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5322 | /* set vol=0 Mono mixer amp left and right */ |
| 5323 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5324 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5325 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5326 | /* unmute LINE-2 out pin */ |
| 5327 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5328 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5329 | * Line In 2 = 0x03 |
| 5330 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5331 | /* mute analog inputs */ |
| 5332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5334 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5335 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5336 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5337 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5338 | /* mute Front out path */ |
| 5339 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5340 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5341 | /* mute Headphone out path */ |
| 5342 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5343 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5344 | /* mute Mono out path */ |
| 5345 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5346 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5347 | { } |
| 5348 | }; |
| 5349 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5350 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5351 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5352 | /* Headphone and output */ |
| 5353 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5354 | /* mono output */ |
| 5355 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5356 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5357 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5358 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5359 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5360 | /* Line In pin widget for input */ |
| 5361 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5362 | /* Line-2 pin widget for output */ |
| 5363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5364 | /* CD pin widget for input */ |
| 5365 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5366 | /* unmute amp left and right */ |
| 5367 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5368 | /* set connection select to line in (default select for this ADC) */ |
| 5369 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5370 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5371 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5372 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5373 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5374 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5375 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5376 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5377 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5378 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5379 | * Line In 2 = 0x03 |
| 5380 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5381 | /* mute analog inputs */ |
| 5382 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5383 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5385 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5386 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5387 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5388 | /* Unmute Front out path */ |
| 5389 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5390 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5391 | /* Unmute Headphone out path */ |
| 5392 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5393 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5394 | /* Unmute Mono out path */ |
| 5395 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5396 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5397 | { } |
| 5398 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5399 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5400 | |
| 5401 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5402 | /* Line out and output */ |
| 5403 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5404 | /* mono output */ |
| 5405 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5406 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5407 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5408 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5409 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5410 | /* Line In pin widget for input */ |
| 5411 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5412 | /* Headphone pin widget for output */ |
| 5413 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5414 | /* CD pin widget for input */ |
| 5415 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5416 | /* unmute amp left and right */ |
| 5417 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5418 | /* set connection select to line in (default select for this ADC) */ |
| 5419 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5420 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5421 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5422 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5423 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5424 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5425 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5426 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5427 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5428 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5429 | * Line In 2 = 0x03 |
| 5430 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5431 | /* mute analog inputs */ |
| 5432 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5433 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5434 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5435 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5436 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5437 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5438 | /* Unmute Front out path */ |
| 5439 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5440 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5441 | /* Unmute Headphone out path */ |
| 5442 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5443 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5444 | /* Unmute Mono out path */ |
| 5445 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5446 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5447 | { } |
| 5448 | }; |
| 5449 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5450 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5451 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5452 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5453 | */ |
| 5454 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5455 | /* Disable all GPIOs */ |
| 5456 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5457 | /* Internal speaker is connected to headphone pin */ |
| 5458 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5459 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5460 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5461 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5462 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5463 | /* Ensure all other unused pins are disabled and muted. */ |
| 5464 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5465 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5466 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5467 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5468 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5469 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5470 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5471 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5472 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5473 | /* Disable digital (SPDIF) pins */ |
| 5474 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5475 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5476 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5477 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5478 | * when acting as an output. |
| 5479 | */ |
| 5480 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5481 | |
| 5482 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5483 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5484 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5485 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5486 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5487 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5488 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5489 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5490 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5491 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5492 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5493 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5494 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5495 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5496 | * If the pin mode is changed by the user the pin mode control will |
| 5497 | * take care of enabling the pin's input/output buffers as needed. |
| 5498 | * Therefore there's no need to enable the input buffer at this |
| 5499 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5500 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5501 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5502 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5503 | * mixer ctrl) |
| 5504 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5505 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5506 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5507 | /* Mute capture amp left and right */ |
| 5508 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5509 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5510 | * in (on mic1 pin) |
| 5511 | */ |
| 5512 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5513 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5514 | /* Do the same for the second ADC: mute capture input amp and |
| 5515 | * set ADC connection to line in (on mic1 pin) |
| 5516 | */ |
| 5517 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5518 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5519 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5520 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5521 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5522 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5523 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5524 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5525 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5526 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5527 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5528 | {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] | 5529 | |
| 5530 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5531 | }; |
| 5532 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5533 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5534 | * similar laptops (adapted from Fujitsu init verbs). |
| 5535 | */ |
| 5536 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5537 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5538 | * the headphone jack. Turn this on and rely on the standard mute |
| 5539 | * methods whenever the user wants to turn these outputs off. |
| 5540 | */ |
| 5541 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5542 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5543 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5544 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5545 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5546 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5547 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5548 | /* Line In jack is connected to Line1 pin */ |
| 5549 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5550 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5551 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5552 | /* Ensure all other unused pins are disabled and muted. */ |
| 5553 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5554 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5555 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5556 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5557 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5558 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5559 | /* Disable digital (SPDIF) pins */ |
| 5560 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5561 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5562 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5563 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5564 | * bus when acting as outputs. |
| 5565 | */ |
| 5566 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5567 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5568 | |
| 5569 | /* Start with output sum widgets muted and their output gains at min */ |
| 5570 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5571 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5572 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5573 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5574 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5575 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5576 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5577 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5578 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5579 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5580 | /* Unmute Line-out pin widget amp left and right |
| 5581 | * (no equiv mixer ctrl) |
| 5582 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5583 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5584 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5585 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5586 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5587 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5588 | * will take care of enabling the pin's input/output buffers as needed. |
| 5589 | * Therefore there's no need to enable the input buffer at this |
| 5590 | * stage. |
| 5591 | */ |
| 5592 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5593 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5594 | |
| 5595 | /* Mute capture amp left and right */ |
| 5596 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5597 | /* Set ADC connection select to match default mixer setting - mic |
| 5598 | * (on mic1 pin) |
| 5599 | */ |
| 5600 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5601 | |
| 5602 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5603 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5604 | */ |
| 5605 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5606 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5607 | |
| 5608 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5609 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5610 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5611 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5612 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5613 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5614 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5615 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5616 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5617 | |
| 5618 | { } |
| 5619 | }; |
| 5620 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5621 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5622 | * (adapted from Acer init verbs). |
| 5623 | */ |
| 5624 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5625 | /* GPIO 0 enables the output jack. |
| 5626 | * Turn this on and rely on the standard mute |
| 5627 | * methods whenever the user wants to turn these outputs off. |
| 5628 | */ |
| 5629 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5630 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5631 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5632 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5633 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5634 | /* Ensure all other unused pins are disabled and muted. */ |
| 5635 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5636 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5637 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5638 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5639 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5640 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5641 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5642 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5643 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5644 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5645 | /* Disable digital (SPDIF) pins */ |
| 5646 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5647 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5648 | |
| 5649 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5650 | * bus when acting as outputs. |
| 5651 | */ |
| 5652 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5653 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5654 | |
| 5655 | /* Start with output sum widgets muted and their output gains at min */ |
| 5656 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5657 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5658 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5659 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5660 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5661 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5662 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5663 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5664 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5665 | |
| 5666 | /* Unmute Line-out pin widget amp left and right |
| 5667 | * (no equiv mixer ctrl) |
| 5668 | */ |
| 5669 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5670 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5671 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5672 | * will take care of enabling the pin's input/output buffers as needed. |
| 5673 | * Therefore there's no need to enable the input buffer at this |
| 5674 | * stage. |
| 5675 | */ |
| 5676 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5677 | |
| 5678 | /* Mute capture amp left and right */ |
| 5679 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5680 | /* Set ADC connection select to match default mixer setting - mic |
| 5681 | * (on mic1 pin) |
| 5682 | */ |
| 5683 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5684 | |
| 5685 | /* Do similar with the second ADC: mute capture input amp and |
| 5686 | * set ADC connection to mic to match ALSA's default state. |
| 5687 | */ |
| 5688 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5689 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5690 | |
| 5691 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5692 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5693 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5694 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5695 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5696 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5697 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5698 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5700 | |
| 5701 | { } |
| 5702 | }; |
| 5703 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5704 | static struct hda_verb alc260_will_verbs[] = { |
| 5705 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5706 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5707 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5708 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5709 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5710 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5711 | {} |
| 5712 | }; |
| 5713 | |
| 5714 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5715 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5716 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5717 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5718 | |
| 5719 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5720 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5721 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5722 | |
| 5723 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5724 | {} |
| 5725 | }; |
| 5726 | |
| 5727 | /* toggle speaker-output according to the hp-jack state */ |
| 5728 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5729 | { |
| 5730 | unsigned int present; |
| 5731 | |
| 5732 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5733 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5734 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5735 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5736 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5737 | AC_VERB_SET_GPIO_DATA, 1); |
| 5738 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5739 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5740 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5741 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5742 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5743 | AC_VERB_SET_GPIO_DATA, 0); |
| 5744 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5745 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5746 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5747 | } |
| 5748 | } |
| 5749 | |
| 5750 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5751 | unsigned int res) |
| 5752 | { |
| 5753 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5754 | alc260_replacer_672v_automute(codec); |
| 5755 | } |
| 5756 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5757 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5758 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5759 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5760 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5761 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5762 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5763 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5764 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5765 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5766 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5767 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5768 | {} |
| 5769 | }; |
| 5770 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5771 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5772 | * configuration. |
| 5773 | */ |
| 5774 | #ifdef CONFIG_SND_DEBUG |
| 5775 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5776 | 0x02, |
| 5777 | }; |
| 5778 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5779 | 0x04, 0x05, |
| 5780 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5781 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5782 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5783 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5784 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5785 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5786 | { |
| 5787 | .num_items = 7, |
| 5788 | .items = { |
| 5789 | { "MIC1 pin", 0x0 }, |
| 5790 | { "MIC2 pin", 0x1 }, |
| 5791 | { "LINE1 pin", 0x2 }, |
| 5792 | { "LINE2 pin", 0x3 }, |
| 5793 | { "CD pin", 0x4 }, |
| 5794 | { "LINE-OUT pin", 0x5 }, |
| 5795 | { "HP-OUT pin", 0x6 }, |
| 5796 | }, |
| 5797 | }, |
| 5798 | { |
| 5799 | .num_items = 8, |
| 5800 | .items = { |
| 5801 | { "MIC1 pin", 0x0 }, |
| 5802 | { "MIC2 pin", 0x1 }, |
| 5803 | { "LINE1 pin", 0x2 }, |
| 5804 | { "LINE2 pin", 0x3 }, |
| 5805 | { "CD pin", 0x4 }, |
| 5806 | { "Mixer", 0x5 }, |
| 5807 | { "LINE-OUT pin", 0x6 }, |
| 5808 | { "HP-OUT pin", 0x7 }, |
| 5809 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5810 | }, |
| 5811 | }; |
| 5812 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5813 | /* Output driver widgets */ |
| 5814 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5815 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5816 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5817 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5818 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5819 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5820 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5821 | /* Modes for retasking pin widgets |
| 5822 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5823 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5824 | * mention this restriction. At this stage it's not clear whether |
| 5825 | * this behaviour is intentional or is a hardware bug in chip |
| 5826 | * revisions available at least up until early 2006. Therefore for |
| 5827 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5828 | * choices, but if it turns out that the lack of mic bias for these |
| 5829 | * NIDs is intentional we could change their modes from |
| 5830 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5831 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5832 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5833 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5834 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5835 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5836 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5837 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5838 | |
| 5839 | /* Loopback mixer controls */ |
| 5840 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5841 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5842 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5843 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5844 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5845 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5846 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5847 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5848 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5849 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5850 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5851 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5852 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5853 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5854 | |
| 5855 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5856 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5857 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5858 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5859 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5860 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5861 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5862 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5863 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5864 | */ |
| 5865 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5866 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5867 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5868 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5869 | * this output to turn on an external amplifier. |
| 5870 | */ |
| 5871 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5872 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5873 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5874 | { } /* end */ |
| 5875 | }; |
| 5876 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5877 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5878 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5879 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5880 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5881 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5882 | /* Enable retasking pins as output, initially without power amp */ |
| 5883 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5884 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5885 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5886 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5887 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5888 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5889 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5890 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5891 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5892 | * payload also sets the generation to 0, output to be in "consumer" |
| 5893 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5894 | * control. |
| 5895 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5896 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5897 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5898 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5899 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5900 | * OUT1 sum bus when acting as an output. |
| 5901 | */ |
| 5902 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5903 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5904 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5905 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5906 | |
| 5907 | /* Start with output sum widgets muted and their output gains at min */ |
| 5908 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5909 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5910 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5911 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5912 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5913 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5914 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5915 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5916 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5917 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5918 | /* Unmute retasking pin widget output buffers since the default |
| 5919 | * state appears to be output. As the pin mode is changed by the |
| 5920 | * user the pin mode control will take care of enabling the pin's |
| 5921 | * input/output buffers as needed. |
| 5922 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5923 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5924 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5925 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5926 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5927 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5928 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5929 | /* Also unmute the mono-out pin widget */ |
| 5930 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5931 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5932 | /* Mute capture amp left and right */ |
| 5933 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5934 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5935 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5936 | */ |
| 5937 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5938 | |
| 5939 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5940 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5941 | */ |
| 5942 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5943 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5944 | |
| 5945 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5946 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5947 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5948 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5949 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5950 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5951 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5952 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5953 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5954 | |
| 5955 | { } |
| 5956 | }; |
| 5957 | #endif |
| 5958 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5959 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5960 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5961 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5962 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5963 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5964 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5965 | /* |
| 5966 | * for BIOS auto-configuration |
| 5967 | */ |
| 5968 | |
| 5969 | 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] | 5970 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5971 | { |
| 5972 | hda_nid_t nid_vol; |
| 5973 | unsigned long vol_val, sw_val; |
| 5974 | char name[32]; |
| 5975 | int err; |
| 5976 | |
| 5977 | if (nid >= 0x0f && nid < 0x11) { |
| 5978 | nid_vol = nid - 0x7; |
| 5979 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5980 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5981 | } else if (nid == 0x11) { |
| 5982 | nid_vol = nid - 0x7; |
| 5983 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5984 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5985 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5986 | nid_vol = 0x08; |
| 5987 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5988 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5989 | } else |
| 5990 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5991 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5992 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5993 | /* first control for the volume widget */ |
| 5994 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5995 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5996 | if (err < 0) |
| 5997 | return err; |
| 5998 | *vol_bits |= (1 << nid_vol); |
| 5999 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6000 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6001 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 6002 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6003 | return err; |
| 6004 | return 1; |
| 6005 | } |
| 6006 | |
| 6007 | /* add playback controls from the parsed DAC table */ |
| 6008 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6009 | const struct auto_pin_cfg *cfg) |
| 6010 | { |
| 6011 | hda_nid_t nid; |
| 6012 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6013 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6014 | |
| 6015 | spec->multiout.num_dacs = 1; |
| 6016 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6017 | spec->multiout.dac_nids[0] = 0x02; |
| 6018 | |
| 6019 | nid = cfg->line_out_pins[0]; |
| 6020 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6021 | const char *pfx; |
| 6022 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6023 | pfx = "Master"; |
| 6024 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6025 | pfx = "Speaker"; |
| 6026 | else |
| 6027 | pfx = "Front"; |
| 6028 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6029 | if (err < 0) |
| 6030 | return err; |
| 6031 | } |
| 6032 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6033 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6034 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6035 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6036 | if (err < 0) |
| 6037 | return err; |
| 6038 | } |
| 6039 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6040 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6041 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6042 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6043 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6044 | if (err < 0) |
| 6045 | return err; |
| 6046 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6047 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6048 | } |
| 6049 | |
| 6050 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6051 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6052 | const struct auto_pin_cfg *cfg) |
| 6053 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6054 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6055 | } |
| 6056 | |
| 6057 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6058 | hda_nid_t nid, int pin_type, |
| 6059 | int sel_idx) |
| 6060 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6061 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6062 | /* need the manual connection? */ |
| 6063 | if (nid >= 0x12) { |
| 6064 | int idx = nid - 0x12; |
| 6065 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6066 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6067 | } |
| 6068 | } |
| 6069 | |
| 6070 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6071 | { |
| 6072 | struct alc_spec *spec = codec->spec; |
| 6073 | hda_nid_t nid; |
| 6074 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6075 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6076 | if (nid) { |
| 6077 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6078 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6079 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6080 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6081 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6082 | if (nid) |
| 6083 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6084 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6085 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6086 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6087 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6088 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6089 | |
| 6090 | #define ALC260_PIN_CD_NID 0x16 |
| 6091 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6092 | { |
| 6093 | struct alc_spec *spec = codec->spec; |
| 6094 | int i; |
| 6095 | |
| 6096 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6097 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6098 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6099 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6100 | if (nid != ALC260_PIN_CD_NID && |
| 6101 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6102 | snd_hda_codec_write(codec, nid, 0, |
| 6103 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6104 | AMP_OUT_MUTE); |
| 6105 | } |
| 6106 | } |
| 6107 | } |
| 6108 | |
| 6109 | /* |
| 6110 | * generic initialization of ADC, input mixers and output mixers |
| 6111 | */ |
| 6112 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6113 | /* |
| 6114 | * Unmute ADC0-1 and set the default input to mic-in |
| 6115 | */ |
| 6116 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6117 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6118 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6119 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6120 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6121 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6122 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6123 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6124 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6125 | */ |
| 6126 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6127 | /* mute analog inputs */ |
| 6128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6131 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6133 | |
| 6134 | /* |
| 6135 | * Set up output mixers (0x08 - 0x0a) |
| 6136 | */ |
| 6137 | /* set vol=0 to output mixers */ |
| 6138 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6139 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6140 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6141 | /* set up input amps for analog loopback */ |
| 6142 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6143 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6144 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6145 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6146 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6147 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6148 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6149 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6150 | { } |
| 6151 | }; |
| 6152 | |
| 6153 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6154 | { |
| 6155 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6156 | int err; |
| 6157 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6158 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6159 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6160 | alc260_ignore); |
| 6161 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6162 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6163 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6164 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6165 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6166 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6167 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6168 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6169 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6170 | return err; |
| 6171 | |
| 6172 | spec->multiout.max_channels = 2; |
| 6173 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6174 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6175 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6176 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6177 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6178 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6179 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6180 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6181 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6182 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6183 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6184 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6185 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6186 | return 1; |
| 6187 | } |
| 6188 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6189 | /* additional initialization for auto-configuration model */ |
| 6190 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6191 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6192 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6193 | alc260_auto_init_multi_out(codec); |
| 6194 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6195 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6196 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6197 | } |
| 6198 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6199 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6200 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6201 | { 0x07, HDA_INPUT, 0 }, |
| 6202 | { 0x07, HDA_INPUT, 1 }, |
| 6203 | { 0x07, HDA_INPUT, 2 }, |
| 6204 | { 0x07, HDA_INPUT, 3 }, |
| 6205 | { 0x07, HDA_INPUT, 4 }, |
| 6206 | { } /* end */ |
| 6207 | }; |
| 6208 | #endif |
| 6209 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6210 | /* |
| 6211 | * ALC260 configurations |
| 6212 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6213 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6214 | [ALC260_BASIC] = "basic", |
| 6215 | [ALC260_HP] = "hp", |
| 6216 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6217 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6218 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6219 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6220 | [ALC260_WILL] = "will", |
| 6221 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6222 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6223 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6224 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6225 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6226 | [ALC260_AUTO] = "auto", |
| 6227 | }; |
| 6228 | |
| 6229 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6230 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6231 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6232 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6233 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 6234 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6235 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6236 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6237 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6238 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6239 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6240 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6241 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6242 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6243 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6244 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6245 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6246 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6247 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6248 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6249 | {} |
| 6250 | }; |
| 6251 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6252 | static struct alc_config_preset alc260_presets[] = { |
| 6253 | [ALC260_BASIC] = { |
| 6254 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6255 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6256 | .init_verbs = { alc260_init_verbs }, |
| 6257 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6258 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6259 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6260 | .adc_nids = alc260_adc_nids, |
| 6261 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6262 | .channel_mode = alc260_modes, |
| 6263 | .input_mux = &alc260_capture_source, |
| 6264 | }, |
| 6265 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6266 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6267 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6268 | .init_verbs = { alc260_init_verbs, |
| 6269 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6270 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6271 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6272 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6273 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6274 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6275 | .channel_mode = alc260_modes, |
| 6276 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6277 | .unsol_event = alc260_hp_unsol_event, |
| 6278 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6279 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6280 | [ALC260_HP_DC7600] = { |
| 6281 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6282 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6283 | .init_verbs = { alc260_init_verbs, |
| 6284 | alc260_hp_dc7600_verbs }, |
| 6285 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6286 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6287 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6288 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6289 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6290 | .channel_mode = alc260_modes, |
| 6291 | .input_mux = &alc260_capture_source, |
| 6292 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6293 | .init_hook = alc260_hp_3012_automute, |
| 6294 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6295 | [ALC260_HP_3013] = { |
| 6296 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6297 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6298 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6299 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6300 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6301 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6302 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6303 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6304 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6305 | .channel_mode = alc260_modes, |
| 6306 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6307 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6308 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6309 | }, |
| 6310 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6311 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6312 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6313 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6314 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6315 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6316 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6317 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6318 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6319 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6320 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6321 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6322 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6323 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6324 | .init_verbs = { alc260_acer_init_verbs }, |
| 6325 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6326 | .dac_nids = alc260_dac_nids, |
| 6327 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6328 | .adc_nids = alc260_dual_adc_nids, |
| 6329 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6330 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6331 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6332 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6333 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6334 | [ALC260_FAVORIT100] = { |
| 6335 | .mixers = { alc260_favorit100_mixer }, |
| 6336 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6337 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6338 | .dac_nids = alc260_dac_nids, |
| 6339 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6340 | .adc_nids = alc260_dual_adc_nids, |
| 6341 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6342 | .channel_mode = alc260_modes, |
| 6343 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6344 | .input_mux = alc260_favorit100_capture_sources, |
| 6345 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6346 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6347 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6348 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6349 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6350 | .dac_nids = alc260_dac_nids, |
| 6351 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6352 | .adc_nids = alc260_adc_nids, |
| 6353 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6354 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6355 | .channel_mode = alc260_modes, |
| 6356 | .input_mux = &alc260_capture_source, |
| 6357 | }, |
| 6358 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6359 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6360 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6361 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6362 | .dac_nids = alc260_dac_nids, |
| 6363 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6364 | .adc_nids = alc260_adc_nids, |
| 6365 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6366 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6367 | .channel_mode = alc260_modes, |
| 6368 | .input_mux = &alc260_capture_source, |
| 6369 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6370 | .init_hook = alc260_replacer_672v_automute, |
| 6371 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6372 | #ifdef CONFIG_SND_DEBUG |
| 6373 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6374 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6375 | .init_verbs = { alc260_test_init_verbs }, |
| 6376 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6377 | .dac_nids = alc260_test_dac_nids, |
| 6378 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6379 | .adc_nids = alc260_test_adc_nids, |
| 6380 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6381 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6382 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6383 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6384 | }, |
| 6385 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6386 | }; |
| 6387 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6388 | static int patch_alc260(struct hda_codec *codec) |
| 6389 | { |
| 6390 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6391 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6392 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6393 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6394 | if (spec == NULL) |
| 6395 | return -ENOMEM; |
| 6396 | |
| 6397 | codec->spec = spec; |
| 6398 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6399 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6400 | alc260_models, |
| 6401 | alc260_cfg_tbl); |
| 6402 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6403 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6404 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6405 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6406 | } |
| 6407 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6408 | if (board_config == ALC260_AUTO) { |
| 6409 | /* automatic parse from the BIOS config */ |
| 6410 | err = alc260_parse_auto_config(codec); |
| 6411 | if (err < 0) { |
| 6412 | alc_free(codec); |
| 6413 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6414 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6415 | printk(KERN_INFO |
| 6416 | "hda_codec: Cannot set up configuration " |
| 6417 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6418 | board_config = ALC260_BASIC; |
| 6419 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6420 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6421 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6422 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6423 | if (err < 0) { |
| 6424 | alc_free(codec); |
| 6425 | return err; |
| 6426 | } |
| 6427 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6428 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6429 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6430 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6431 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6432 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6433 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6434 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6435 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6436 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6437 | if (!spec->adc_nids && spec->input_mux) { |
| 6438 | /* check whether NID 0x04 is valid */ |
| 6439 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6440 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6441 | /* get type */ |
| 6442 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6443 | spec->adc_nids = alc260_adc_nids_alt; |
| 6444 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6445 | } else { |
| 6446 | spec->adc_nids = alc260_adc_nids; |
| 6447 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6448 | } |
| 6449 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6450 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6451 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6452 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6453 | spec->vmaster_nid = 0x08; |
| 6454 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6455 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6456 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6457 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6458 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6459 | if (!spec->loopback.amplist) |
| 6460 | spec->loopback.amplist = alc260_loopbacks; |
| 6461 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6462 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6463 | |
| 6464 | return 0; |
| 6465 | } |
| 6466 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6467 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6468 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6469 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6470 | * |
| 6471 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6472 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6473 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6474 | * 6-channel independent captures. |
| 6475 | * |
| 6476 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6477 | * driver yet). |
| 6478 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6479 | #define ALC882_DIGOUT_NID 0x06 |
| 6480 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6481 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6482 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6483 | #define ALC1200_DIGOUT_NID 0x10 |
| 6484 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6485 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6486 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6487 | { 8, NULL } |
| 6488 | }; |
| 6489 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6490 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6491 | static hda_nid_t alc882_dac_nids[4] = { |
| 6492 | /* front, rear, clfe, rear_surr */ |
| 6493 | 0x02, 0x03, 0x04, 0x05 |
| 6494 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6495 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6496 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6497 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6498 | #define alc882_adc_nids alc880_adc_nids |
| 6499 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6500 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6501 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6502 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6503 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6504 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6505 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6506 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6507 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6508 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6509 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6510 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6511 | /* input MUX */ |
| 6512 | /* FIXME: should be a matrix-type input source selection */ |
| 6513 | |
| 6514 | static struct hda_input_mux alc882_capture_source = { |
| 6515 | .num_items = 4, |
| 6516 | .items = { |
| 6517 | { "Mic", 0x0 }, |
| 6518 | { "Front Mic", 0x1 }, |
| 6519 | { "Line", 0x2 }, |
| 6520 | { "CD", 0x4 }, |
| 6521 | }, |
| 6522 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6523 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6524 | #define alc883_capture_source alc882_capture_source |
| 6525 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6526 | static struct hda_input_mux alc889_capture_source = { |
| 6527 | .num_items = 3, |
| 6528 | .items = { |
| 6529 | { "Front Mic", 0x0 }, |
| 6530 | { "Mic", 0x3 }, |
| 6531 | { "Line", 0x2 }, |
| 6532 | }, |
| 6533 | }; |
| 6534 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6535 | static struct hda_input_mux mb5_capture_source = { |
| 6536 | .num_items = 3, |
| 6537 | .items = { |
| 6538 | { "Mic", 0x1 }, |
| 6539 | { "Line", 0x2 }, |
| 6540 | { "CD", 0x4 }, |
| 6541 | }, |
| 6542 | }; |
| 6543 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6544 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6545 | .num_items = 4, |
| 6546 | .items = { |
| 6547 | { "Mic", 0x1 }, |
| 6548 | { "Front Mic", 0x0 }, |
| 6549 | { "Line", 0x2 }, |
| 6550 | { "CD", 0x4 }, |
| 6551 | }, |
| 6552 | }; |
| 6553 | |
| 6554 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6555 | .num_items = 2, |
| 6556 | .items = { |
| 6557 | { "Mic", 0x1 }, |
| 6558 | { "Line", 0x2 }, |
| 6559 | }, |
| 6560 | }; |
| 6561 | |
| 6562 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6563 | .num_items = 4, |
| 6564 | .items = { |
| 6565 | { "Mic", 0x0 }, |
| 6566 | { "iMic", 0x1 }, |
| 6567 | { "Line", 0x2 }, |
| 6568 | { "CD", 0x4 }, |
| 6569 | }, |
| 6570 | }; |
| 6571 | |
| 6572 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6573 | .num_items = 2, |
| 6574 | .items = { |
| 6575 | { "Mic", 0x0 }, |
| 6576 | { "Int Mic", 0x1 }, |
| 6577 | }, |
| 6578 | }; |
| 6579 | |
| 6580 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6581 | .num_items = 3, |
| 6582 | .items = { |
| 6583 | { "Mic", 0x0 }, |
| 6584 | { "Front Mic", 0x1 }, |
| 6585 | { "Line", 0x4 }, |
| 6586 | }, |
| 6587 | }; |
| 6588 | |
| 6589 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6590 | .num_items = 2, |
| 6591 | .items = { |
| 6592 | { "Mic", 0x0 }, |
| 6593 | { "Line", 0x2 }, |
| 6594 | }, |
| 6595 | }; |
| 6596 | |
| 6597 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6598 | .num_items = 2, |
| 6599 | .items = { |
| 6600 | { "Mic", 0x0 }, |
| 6601 | /* Front Mic (0x01) unused */ |
| 6602 | { "Line", 0x2 }, |
| 6603 | /* Line 2 (0x03) unused */ |
| 6604 | /* CD (0x04) unsused? */ |
| 6605 | }, |
| 6606 | }; |
| 6607 | |
| 6608 | /* |
| 6609 | * 2ch mode |
| 6610 | */ |
| 6611 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6612 | { 2, NULL } |
| 6613 | }; |
| 6614 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6615 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6616 | * 2ch mode |
| 6617 | */ |
| 6618 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6619 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6620 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6621 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6622 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6623 | { } /* end */ |
| 6624 | }; |
| 6625 | |
| 6626 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6627 | * 4ch mode |
| 6628 | */ |
| 6629 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6630 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6631 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6632 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6633 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6634 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6635 | { } /* end */ |
| 6636 | }; |
| 6637 | |
| 6638 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6639 | * 6ch mode |
| 6640 | */ |
| 6641 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6642 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6643 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6644 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6645 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6646 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6647 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6648 | { } /* end */ |
| 6649 | }; |
| 6650 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6651 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6652 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6653 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6654 | { 6, alc882_3ST_ch6_init }, |
| 6655 | }; |
| 6656 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6657 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6658 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6659 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6660 | * 6ch mode |
| 6661 | */ |
| 6662 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6663 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6664 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6665 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6666 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6667 | { } /* end */ |
| 6668 | }; |
| 6669 | |
| 6670 | /* |
| 6671 | * 8ch mode |
| 6672 | */ |
| 6673 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6674 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6675 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6676 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6677 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6678 | { } /* end */ |
| 6679 | }; |
| 6680 | |
| 6681 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6682 | { 6, alc882_sixstack_ch6_init }, |
| 6683 | { 8, alc882_sixstack_ch8_init }, |
| 6684 | }; |
| 6685 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6686 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6687 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6688 | */ |
| 6689 | |
| 6690 | /* |
| 6691 | * 2ch mode |
| 6692 | */ |
| 6693 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6694 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6695 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6696 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6697 | { } /* end */ |
| 6698 | }; |
| 6699 | |
| 6700 | /* |
| 6701 | * 6ch mode |
| 6702 | */ |
| 6703 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6704 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6705 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6706 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6707 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6708 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6709 | { } /* end */ |
| 6710 | }; |
| 6711 | |
| 6712 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6713 | { 2, alc885_mbp_ch2_init }, |
| 6714 | { 6, alc885_mbp_ch6_init }, |
| 6715 | }; |
| 6716 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6717 | /* |
| 6718 | * 2ch |
| 6719 | * Speakers/Woofer/HP = Front |
| 6720 | * LineIn = Input |
| 6721 | */ |
| 6722 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6723 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6724 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6725 | { } /* end */ |
| 6726 | }; |
| 6727 | |
| 6728 | /* |
| 6729 | * 6ch mode |
| 6730 | * Speakers/HP = Front |
| 6731 | * Woofer = LFE |
| 6732 | * LineIn = Surround |
| 6733 | */ |
| 6734 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6735 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6736 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6737 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6738 | { } /* end */ |
| 6739 | }; |
| 6740 | |
| 6741 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6742 | { 2, alc885_mb5_ch2_init }, |
| 6743 | { 6, alc885_mb5_ch6_init }, |
| 6744 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6745 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6746 | |
| 6747 | /* |
| 6748 | * 2ch mode |
| 6749 | */ |
| 6750 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 6751 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6752 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6753 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6754 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6755 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6756 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6757 | { } /* end */ |
| 6758 | }; |
| 6759 | |
| 6760 | /* |
| 6761 | * 4ch mode |
| 6762 | */ |
| 6763 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 6764 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6765 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6766 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6767 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6768 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6769 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6770 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6771 | { } /* end */ |
| 6772 | }; |
| 6773 | |
| 6774 | /* |
| 6775 | * 6ch mode |
| 6776 | */ |
| 6777 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 6778 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6779 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6780 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6781 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6782 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6783 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6784 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6785 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6786 | { } /* end */ |
| 6787 | }; |
| 6788 | |
| 6789 | /* |
| 6790 | * 8ch mode |
| 6791 | */ |
| 6792 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 6793 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6794 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6795 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6796 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6797 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6798 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6799 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6800 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6801 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6802 | { } /* end */ |
| 6803 | }; |
| 6804 | |
| 6805 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 6806 | { 2, alc883_4ST_ch2_init }, |
| 6807 | { 4, alc883_4ST_ch4_init }, |
| 6808 | { 6, alc883_4ST_ch6_init }, |
| 6809 | { 8, alc883_4ST_ch8_init }, |
| 6810 | }; |
| 6811 | |
| 6812 | |
| 6813 | /* |
| 6814 | * 2ch mode |
| 6815 | */ |
| 6816 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6817 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6818 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6819 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6820 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6821 | { } /* end */ |
| 6822 | }; |
| 6823 | |
| 6824 | /* |
| 6825 | * 4ch mode |
| 6826 | */ |
| 6827 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6828 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6829 | { 0x19, 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_3ST_ch6_intel_init[] = { |
| 6840 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6841 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6842 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6843 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6844 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6845 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6846 | { } /* end */ |
| 6847 | }; |
| 6848 | |
| 6849 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6850 | { 2, alc883_3ST_ch2_intel_init }, |
| 6851 | { 4, alc883_3ST_ch4_intel_init }, |
| 6852 | { 6, alc883_3ST_ch6_intel_init }, |
| 6853 | }; |
| 6854 | |
| 6855 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6856 | * 2ch mode |
| 6857 | */ |
| 6858 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 6859 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6860 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6861 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6862 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6863 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6864 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6865 | { } /* end */ |
| 6866 | }; |
| 6867 | |
| 6868 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6869 | * 6ch mode |
| 6870 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6871 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6872 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6873 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6874 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6875 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6876 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6877 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6878 | { } /* end */ |
| 6879 | }; |
| 6880 | |
| 6881 | /* |
| 6882 | * 8ch mode |
| 6883 | */ |
| 6884 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6885 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6886 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6887 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6888 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6889 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6890 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6891 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6892 | { } /* end */ |
| 6893 | }; |
| 6894 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6895 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 6896 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6897 | { 6, alc889_ch6_intel_init }, |
| 6898 | { 8, alc889_ch8_intel_init }, |
| 6899 | }; |
| 6900 | |
| 6901 | /* |
| 6902 | * 6ch mode |
| 6903 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6904 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6905 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6906 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6907 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6908 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6909 | { } /* end */ |
| 6910 | }; |
| 6911 | |
| 6912 | /* |
| 6913 | * 8ch mode |
| 6914 | */ |
| 6915 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6916 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6917 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6918 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6919 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6920 | { } /* end */ |
| 6921 | }; |
| 6922 | |
| 6923 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6924 | { 6, alc883_sixstack_ch6_init }, |
| 6925 | { 8, alc883_sixstack_ch8_init }, |
| 6926 | }; |
| 6927 | |
| 6928 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6929 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6930 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6931 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6932 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6933 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6934 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6935 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6936 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6937 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6938 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6939 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6940 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6941 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6942 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6943 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6944 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6945 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6946 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6947 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6948 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6949 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6950 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6951 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6952 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6953 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6954 | { } /* end */ |
| 6955 | }; |
| 6956 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6957 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6958 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6959 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6960 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6961 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6962 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6963 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6964 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6965 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6966 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6967 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6968 | { } /* end */ |
| 6969 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6970 | |
| 6971 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6972 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6973 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6974 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6975 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 6976 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 6977 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 6978 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 6979 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6980 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6981 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6982 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6983 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6984 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 6985 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 6986 | { } /* end */ |
| 6987 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6988 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6989 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6990 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6991 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6992 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6993 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6994 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6995 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6996 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6997 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6998 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6999 | { } /* end */ |
| 7000 | }; |
| 7001 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7002 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7003 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7004 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 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), |
| 7011 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7012 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7013 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7014 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7015 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7016 | { } /* end */ |
| 7017 | }; |
| 7018 | |
| 7019 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7020 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7021 | */ |
| 7022 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7023 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7024 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7025 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7026 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7027 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7028 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7029 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7030 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7031 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7032 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7033 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7034 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7035 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7036 | { } /* end */ |
| 7037 | }; |
| 7038 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7039 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7040 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7041 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7042 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7043 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7044 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7045 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7046 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7047 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7048 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7049 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7050 | { } /* end */ |
| 7051 | }; |
| 7052 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7053 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7054 | { |
| 7055 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7056 | .name = "Channel Mode", |
| 7057 | .info = alc_ch_mode_info, |
| 7058 | .get = alc_ch_mode_get, |
| 7059 | .put = alc_ch_mode_put, |
| 7060 | }, |
| 7061 | { } /* end */ |
| 7062 | }; |
| 7063 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7064 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7065 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7066 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7067 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7068 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7069 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7070 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7071 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7072 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7073 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7074 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7075 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7076 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7077 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7078 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7079 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7080 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7081 | |
Takashi Iwai | cb63812 | 2009-07-03 10:56:10 +0200 | [diff] [blame] | 7082 | /* mute analog input loopbacks */ |
| 7083 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7084 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7085 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7086 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7087 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7088 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7089 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7090 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7091 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7092 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7093 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7094 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7095 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7096 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7097 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7098 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7099 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7100 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7101 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7102 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7103 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7104 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7105 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7106 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7107 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7108 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7109 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7110 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7111 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7112 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7113 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7114 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7115 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7116 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7117 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7118 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7119 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7120 | |
| 7121 | /* FIXME: use matrix-type input source selection */ |
| 7122 | /* 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] | 7123 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7124 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7125 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7126 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7127 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7128 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7129 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7130 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7131 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7132 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7133 | /* ADC2: mute amp left and right */ |
| 7134 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7135 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7136 | /* ADC3: mute amp left and right */ |
| 7137 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7138 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7139 | |
| 7140 | { } |
| 7141 | }; |
| 7142 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7143 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7144 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7145 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7146 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7147 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7148 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7149 | /* ADC1: mute amp left and right */ |
| 7150 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7151 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7152 | { } |
| 7153 | }; |
| 7154 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7155 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7156 | /* change to EAPD mode */ |
| 7157 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7158 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7159 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7160 | }; |
| 7161 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7162 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7163 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7164 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7165 | { } |
| 7166 | }; |
| 7167 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7168 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7169 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7170 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7171 | {} |
| 7172 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7173 | |
| 7174 | static struct hda_verb alc885_init_verbs[] = { |
| 7175 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7176 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7177 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7178 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7179 | /* Rear mixer */ |
| 7180 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7181 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7182 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7183 | /* CLFE mixer */ |
| 7184 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7185 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7186 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7187 | /* Side mixer */ |
| 7188 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7189 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7190 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7191 | |
| 7192 | /* mute analog input loopbacks */ |
| 7193 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7194 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7195 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7196 | |
| 7197 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7198 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7199 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7200 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7201 | /* Front Pin: output 0 (0x0c) */ |
| 7202 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7203 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7204 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7205 | /* Rear Pin: output 1 (0x0d) */ |
| 7206 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7207 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7208 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7209 | /* CLFE Pin: output 2 (0x0e) */ |
| 7210 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7211 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7212 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7213 | /* Side Pin: output 3 (0x0f) */ |
| 7214 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7215 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7216 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7217 | /* Mic (rear) pin: input vref at 80% */ |
| 7218 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7219 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7220 | /* Front Mic pin: input vref at 80% */ |
| 7221 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7222 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7223 | /* Line In pin: input */ |
| 7224 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7225 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7226 | |
| 7227 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7228 | /* Input mixer1 */ |
| 7229 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7230 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7231 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7232 | /* Input mixer2 */ |
| 7233 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7234 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7235 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7236 | /* Input mixer3 */ |
| 7237 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7238 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7239 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7240 | /* ADC2: mute amp left and right */ |
| 7241 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7242 | /* ADC3: mute amp left and right */ |
| 7243 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7244 | |
| 7245 | { } |
| 7246 | }; |
| 7247 | |
| 7248 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7249 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7250 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7251 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7252 | { } |
| 7253 | }; |
| 7254 | |
| 7255 | |
| 7256 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7257 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7258 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7259 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7260 | { } |
| 7261 | }; |
| 7262 | |
| 7263 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7264 | #define alc883_init_verbs alc882_base_init_verbs |
| 7265 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7266 | /* Mac Pro test */ |
| 7267 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7268 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7269 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7270 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7271 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7272 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7273 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7274 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7275 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7276 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7277 | { } /* end */ |
| 7278 | }; |
| 7279 | |
| 7280 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7281 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7282 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7283 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7284 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7285 | /* Front Pin: output 0 (0x0c) */ |
| 7286 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7287 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7288 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7289 | /* Front Mic pin: input vref at 80% */ |
| 7290 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7291 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7292 | /* Speaker: output */ |
| 7293 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7294 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7295 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7296 | /* Headphone output (output 0 - 0x0c) */ |
| 7297 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7298 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7299 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7300 | |
| 7301 | /* FIXME: use matrix-type input source selection */ |
| 7302 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7303 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7304 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7305 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7306 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7307 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7308 | /* Input mixer2 */ |
| 7309 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7310 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7311 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7312 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7313 | /* Input mixer3 */ |
| 7314 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7315 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7316 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7317 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7318 | /* ADC1: mute amp left and right */ |
| 7319 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7320 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7321 | /* ADC2: mute amp left and right */ |
| 7322 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7323 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7324 | /* ADC3: mute amp left and right */ |
| 7325 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7326 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7327 | |
| 7328 | { } |
| 7329 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7330 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7331 | /* Macbook 5,1 */ |
| 7332 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7333 | /* DACs */ |
| 7334 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7335 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7336 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7337 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7338 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7339 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7340 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7341 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7342 | /* Surround mixer */ |
| 7343 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7344 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7345 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7346 | /* LFE mixer */ |
| 7347 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7348 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7349 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7350 | /* HP mixer */ |
| 7351 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7352 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7353 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7354 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7355 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7356 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7357 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7358 | /* LFE Pin (0x0e) */ |
| 7359 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7360 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7361 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7362 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7363 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7364 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7365 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7366 | /* Front Mic pin: input vref at 80% */ |
| 7367 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7368 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7369 | /* Line In pin */ |
| 7370 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7371 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7372 | |
| 7373 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7374 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7375 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7376 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7377 | { } |
| 7378 | }; |
| 7379 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7380 | /* Macbook Pro rev3 */ |
| 7381 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7382 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7383 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7384 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7385 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7386 | /* Rear mixer */ |
| 7387 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7388 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7389 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7390 | /* Front Pin: output 0 (0x0c) */ |
| 7391 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7392 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7393 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7394 | /* HP Pin: output 0 (0x0d) */ |
| 7395 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 7396 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7397 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7398 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7399 | /* Mic (rear) pin: input vref at 80% */ |
| 7400 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7401 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7402 | /* Front Mic pin: input vref at 80% */ |
| 7403 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7404 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7405 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7406 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7407 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7408 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7409 | |
| 7410 | /* FIXME: use matrix-type input source selection */ |
| 7411 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7412 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7413 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7414 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7415 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7416 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7417 | /* Input mixer2 */ |
| 7418 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7419 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7420 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7421 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7422 | /* Input mixer3 */ |
| 7423 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7424 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7425 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7426 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7427 | /* ADC1: mute amp left and right */ |
| 7428 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7429 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7430 | /* ADC2: mute amp left and right */ |
| 7431 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7432 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7433 | /* ADC3: mute amp left and right */ |
| 7434 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7435 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7436 | |
| 7437 | { } |
| 7438 | }; |
| 7439 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7440 | /* iMac 24 mixer. */ |
| 7441 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7442 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7443 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7444 | { } /* end */ |
| 7445 | }; |
| 7446 | |
| 7447 | /* iMac 24 init verbs. */ |
| 7448 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7449 | /* Internal speakers: output 0 (0x0c) */ |
| 7450 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7451 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7452 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7453 | /* Internal speakers: output 0 (0x0c) */ |
| 7454 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7455 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7456 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7457 | /* Headphone: output 0 (0x0c) */ |
| 7458 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7459 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7460 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7461 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7462 | /* Front Mic: input vref at 80% */ |
| 7463 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7464 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7465 | { } |
| 7466 | }; |
| 7467 | |
| 7468 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7469 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7470 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7471 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7472 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7473 | spec->autocfg.hp_pins[0] = 0x14; |
| 7474 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7475 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7476 | } |
| 7477 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7478 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7479 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7480 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7481 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7482 | spec->autocfg.hp_pins[0] = 0x15; |
| 7483 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7484 | } |
| 7485 | |
| 7486 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7487 | static struct hda_verb alc882_targa_verbs[] = { |
| 7488 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7489 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7490 | |
| 7491 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7492 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7493 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7494 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7495 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7496 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7497 | |
| 7498 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7499 | { } /* end */ |
| 7500 | }; |
| 7501 | |
| 7502 | /* toggle speaker-output according to the hp-jack state */ |
| 7503 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7504 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7505 | struct alc_spec *spec = codec->spec; |
| 7506 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7507 | 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] | 7508 | spec->jack_present ? 1 : 3); |
| 7509 | } |
| 7510 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7511 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7512 | { |
| 7513 | struct alc_spec *spec = codec->spec; |
| 7514 | |
| 7515 | spec->autocfg.hp_pins[0] = 0x14; |
| 7516 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7517 | } |
| 7518 | |
| 7519 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7520 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7521 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7522 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7523 | } |
| 7524 | |
| 7525 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7526 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7527 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7528 | |
| 7529 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7530 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7531 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7532 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7533 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7534 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7535 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7536 | |
| 7537 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7538 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7539 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7540 | { } /* end */ |
| 7541 | }; |
| 7542 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7543 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7544 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7545 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7546 | |
| 7547 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7548 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7549 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7550 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7551 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7552 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7553 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7554 | |
| 7555 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7556 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7557 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7558 | { } /* end */ |
| 7559 | }; |
| 7560 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7561 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7562 | { |
| 7563 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7564 | |
| 7565 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7566 | AC_VERB_GET_GPIO_DATA, 0); |
| 7567 | |
| 7568 | if (!muted) |
| 7569 | gpiostate |= (1 << pin); |
| 7570 | else |
| 7571 | gpiostate &= ~(1 << pin); |
| 7572 | |
| 7573 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7574 | AC_VERB_GET_GPIO_MASK, 0); |
| 7575 | gpiomask |= (1 << pin); |
| 7576 | |
| 7577 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7578 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7579 | gpiodir |= (1 << pin); |
| 7580 | |
| 7581 | |
| 7582 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7583 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7584 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7585 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7586 | |
| 7587 | msleep(1); |
| 7588 | |
| 7589 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7590 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7591 | } |
| 7592 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7593 | /* set up GPIO at initialization */ |
| 7594 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7595 | { |
| 7596 | alc882_gpio_mute(codec, 0, 0); |
| 7597 | alc882_gpio_mute(codec, 1, 0); |
| 7598 | } |
| 7599 | |
| 7600 | /* set up GPIO and update auto-muting at initialization */ |
| 7601 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7602 | { |
| 7603 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7604 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7605 | } |
| 7606 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7607 | /* |
| 7608 | * generic initialization of ADC, input mixers and output mixers |
| 7609 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7610 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7611 | /* |
| 7612 | * Unmute ADC0-2 and set the default input to mic-in |
| 7613 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7614 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7615 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7616 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7617 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7618 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7619 | /* 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] | 7620 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7621 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7622 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7623 | */ |
| 7624 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7625 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7626 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7627 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7628 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7629 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7630 | |
| 7631 | /* |
| 7632 | * Set up output mixers (0x0c - 0x0f) |
| 7633 | */ |
| 7634 | /* set vol=0 to output mixers */ |
| 7635 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7636 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7637 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7638 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7639 | /* set up input amps for analog loopback */ |
| 7640 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7641 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7642 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7643 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7644 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7645 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7646 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7647 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7648 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7649 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7650 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7651 | |
| 7652 | /* FIXME: use matrix-type input source selection */ |
| 7653 | /* 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] | 7654 | /* Input mixer2 */ |
| 7655 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7656 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7657 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7658 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7659 | /* Input mixer3 */ |
| 7660 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7661 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7662 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7663 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7664 | |
| 7665 | { } |
| 7666 | }; |
| 7667 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7668 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7669 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7670 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7671 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7672 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7673 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7674 | { } /* end */ |
| 7675 | }; |
| 7676 | |
| 7677 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7678 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7679 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7680 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7681 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7682 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7683 | { } /* end */ |
| 7684 | }; |
| 7685 | |
| 7686 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7687 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7688 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7689 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7690 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7691 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7692 | { } /* end */ |
| 7693 | }; |
| 7694 | |
| 7695 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7696 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7697 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7698 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7699 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7700 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7701 | { } /* end */ |
| 7702 | }; |
| 7703 | |
| 7704 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7705 | { 2, alc889A_mb31_ch2_init }, |
| 7706 | { 4, alc889A_mb31_ch4_init }, |
| 7707 | { 5, alc889A_mb31_ch5_init }, |
| 7708 | { 6, alc889A_mb31_ch6_init }, |
| 7709 | }; |
| 7710 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7711 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7712 | /* eanable EAPD on medion laptop */ |
| 7713 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7714 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7715 | { } |
| 7716 | }; |
| 7717 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7718 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7719 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7720 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7721 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7722 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7723 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7724 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7725 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7726 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7727 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7728 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7729 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7730 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7731 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7732 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7733 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7734 | { } /* end */ |
| 7735 | }; |
| 7736 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7737 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7738 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7739 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7740 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7741 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7742 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7743 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7744 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7745 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7746 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7747 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7748 | { } /* end */ |
| 7749 | }; |
| 7750 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7751 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7752 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7753 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7754 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7755 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7756 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7757 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7758 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7759 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7760 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7761 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7762 | { } /* end */ |
| 7763 | }; |
| 7764 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7765 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7766 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7767 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7768 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7769 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7770 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7771 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7772 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7773 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7774 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7775 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7776 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7777 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7778 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7779 | { } /* end */ |
| 7780 | }; |
| 7781 | |
| 7782 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7783 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7784 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7785 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7786 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7787 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7788 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7789 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7790 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7791 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7792 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7793 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7794 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7795 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7797 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7798 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7799 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7800 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7801 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7802 | { } /* end */ |
| 7803 | }; |
| 7804 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7805 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7806 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7807 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7808 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7809 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7810 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7811 | HDA_OUTPUT), |
| 7812 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7813 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7814 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7815 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7816 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7817 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7818 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7819 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7820 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7821 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7822 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7823 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7824 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7825 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7826 | { } /* end */ |
| 7827 | }; |
| 7828 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7829 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 7830 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7831 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7832 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7833 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7834 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7835 | HDA_OUTPUT), |
| 7836 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7837 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7838 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7839 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7840 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7841 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7842 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7843 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7844 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 7845 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 7846 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 7847 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7848 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7849 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7850 | { } /* end */ |
| 7851 | }; |
| 7852 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7853 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7854 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7855 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7856 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7857 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7858 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7859 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7860 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7861 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7862 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7863 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7864 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7865 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7866 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7868 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7869 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7870 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7871 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7872 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7873 | { } /* end */ |
| 7874 | }; |
| 7875 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7876 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7877 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7878 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7879 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7880 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7881 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7882 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7883 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7884 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7885 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7886 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7887 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7888 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7889 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7890 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7891 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7892 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7893 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7894 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7895 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7896 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7897 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7898 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7899 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7900 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7901 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7902 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7903 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7904 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7905 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7906 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7907 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7908 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7909 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7910 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7911 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7912 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7913 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7914 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7915 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7916 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7917 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7918 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7919 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7920 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7921 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7922 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7923 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7924 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7925 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7926 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7927 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7928 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7929 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7930 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7931 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7932 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7933 | { } /* end */ |
| 7934 | }; |
| 7935 | |
| 7936 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7937 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7938 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7939 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7940 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7941 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7943 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7944 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7945 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7946 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7947 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7948 | |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7949 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7950 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7951 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7952 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7953 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7954 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7955 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7956 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7957 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7958 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7959 | }; |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7960 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7961 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 7962 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7963 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7964 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7965 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 7966 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7967 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7968 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7969 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7970 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7971 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7972 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7973 | { } /* end */ |
| 7974 | }; |
| 7975 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7976 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7977 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7978 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7979 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7980 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7981 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7982 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7983 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7984 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7985 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7986 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7987 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7988 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7989 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7990 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7991 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7992 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7993 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7995 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7996 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7997 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7998 | { } /* end */ |
| 7999 | }; |
| 8000 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8001 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8002 | /* Output mixers */ |
| 8003 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8004 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8005 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8006 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8007 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8008 | HDA_OUTPUT), |
| 8009 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8010 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8011 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8012 | /* Output switches */ |
| 8013 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8014 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8015 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8016 | /* Boost mixers */ |
| 8017 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8018 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8019 | /* Input mixers */ |
| 8020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8022 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8023 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8024 | { } /* end */ |
| 8025 | }; |
| 8026 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8027 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8028 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8029 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8030 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8031 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8032 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8033 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8034 | { } /* end */ |
| 8035 | }; |
| 8036 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8037 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8038 | .ops = &snd_hda_bind_vol, |
| 8039 | .values = { |
| 8040 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8041 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8042 | 0 |
| 8043 | }, |
| 8044 | }; |
| 8045 | |
| 8046 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8047 | .ops = &snd_hda_bind_sw, |
| 8048 | .values = { |
| 8049 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8050 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8051 | 0 |
| 8052 | }, |
| 8053 | }; |
| 8054 | |
| 8055 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8056 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8057 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8058 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8059 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8060 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8061 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8062 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8064 | { } /* end */ |
| 8065 | }; |
| 8066 | |
| 8067 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8068 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8069 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8070 | { |
| 8071 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8072 | /* .name = "Capture Source", */ |
| 8073 | .name = "Input Source", |
| 8074 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8075 | .info = alc_mux_enum_info, |
| 8076 | .get = alc_mux_enum_get, |
| 8077 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8078 | }, |
| 8079 | { } /* end */ |
| 8080 | }; |
| 8081 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8082 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8083 | { |
| 8084 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8085 | .name = "Channel Mode", |
| 8086 | .info = alc_ch_mode_info, |
| 8087 | .get = alc_ch_mode_get, |
| 8088 | .put = alc_ch_mode_put, |
| 8089 | }, |
| 8090 | { } /* end */ |
| 8091 | }; |
| 8092 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8093 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8094 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8095 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8096 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8097 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8098 | spec->autocfg.hp_pins[0] = 0x15; |
| 8099 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8100 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8101 | } |
| 8102 | |
| 8103 | /* auto-toggle front mic */ |
| 8104 | /* |
| 8105 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8106 | { |
| 8107 | unsigned int present; |
| 8108 | unsigned char bits; |
| 8109 | |
| 8110 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8111 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8112 | bits = present ? HDA_AMP_MUTE : 0; |
| 8113 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8114 | } |
| 8115 | */ |
| 8116 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8117 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8118 | /* HP */ |
| 8119 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8120 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8121 | /* Subwoofer */ |
| 8122 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8123 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8124 | |
| 8125 | /* enable unsolicited event */ |
| 8126 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8127 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8128 | |
| 8129 | { } /* end */ |
| 8130 | }; |
| 8131 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8132 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8133 | /* HP */ |
| 8134 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8135 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8136 | /* Int speaker */ |
| 8137 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8138 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8139 | |
| 8140 | /* enable unsolicited event */ |
| 8141 | {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] | 8142 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8143 | |
| 8144 | { } /* end */ |
| 8145 | }; |
| 8146 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8147 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8148 | /* HP */ |
| 8149 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8150 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8151 | /* Subwoofer */ |
| 8152 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8153 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8154 | |
| 8155 | /* enable unsolicited event */ |
| 8156 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8157 | |
| 8158 | { } /* end */ |
| 8159 | }; |
| 8160 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8161 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8162 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8163 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8164 | |
| 8165 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8166 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8167 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8168 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8169 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8170 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8171 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8172 | /* Connect Mic jack to CLFE */ |
| 8173 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8174 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8175 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8176 | /* Connect Line-in jack to Surround */ |
| 8177 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8178 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8179 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8180 | /* Connect HP out jack to Front */ |
| 8181 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8182 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8183 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8184 | |
| 8185 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8186 | |
| 8187 | { } /* end */ |
| 8188 | }; |
| 8189 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8190 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8191 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8192 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8193 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8194 | { } /* end */ |
| 8195 | }; |
| 8196 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8197 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8198 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8199 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8200 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8201 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8202 | { } /* end */ |
| 8203 | }; |
| 8204 | |
| 8205 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8206 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8207 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8208 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8209 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8210 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8211 | { } /* end */ |
| 8212 | }; |
| 8213 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8214 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8215 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8216 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8217 | |
| 8218 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8219 | |
| 8220 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8221 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8222 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8223 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8224 | { } /* end */ |
| 8225 | }; |
| 8226 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8227 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8228 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8229 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8230 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8231 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8232 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8233 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8234 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8235 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8236 | { } /* end */ |
| 8237 | }; |
| 8238 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8239 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8240 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8241 | { } |
| 8242 | }; |
| 8243 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8244 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8245 | /* HP */ |
| 8246 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8248 | |
| 8249 | /* enable unsolicited event */ |
| 8250 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8251 | |
| 8252 | { } /* end */ |
| 8253 | }; |
| 8254 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8255 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8256 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8257 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8258 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8259 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8260 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8261 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8262 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8263 | } |
| 8264 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8265 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8266 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8267 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8268 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8269 | {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] | 8270 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8271 | }; |
| 8272 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8273 | /* |
| 8274 | * 2ch mode |
| 8275 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8276 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8277 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8278 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8279 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8280 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8281 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8282 | }; |
| 8283 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8284 | /* |
| 8285 | * 4ch mode |
| 8286 | */ |
| 8287 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8288 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8289 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8290 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8291 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8292 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8293 | { } /* end */ |
| 8294 | }; |
| 8295 | |
| 8296 | /* |
| 8297 | * 6ch mode |
| 8298 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8299 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8300 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8301 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8302 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8303 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8304 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8305 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8306 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8307 | }; |
| 8308 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8309 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8310 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8311 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8312 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8313 | }; |
| 8314 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8315 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8316 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8317 | { |
| 8318 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8319 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8320 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8321 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8322 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8323 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8324 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8325 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8326 | } |
| 8327 | |
| 8328 | /* toggle RCA according to the front-jack state */ |
| 8329 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8330 | { |
| 8331 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8332 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8333 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8334 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8335 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8336 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8337 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8338 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8339 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8340 | unsigned int res) |
| 8341 | { |
| 8342 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8343 | alc888_lenovo_ms7195_front_automute(codec); |
| 8344 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8345 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8346 | } |
| 8347 | |
| 8348 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8349 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8350 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8351 | |
| 8352 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8353 | |
| 8354 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8355 | { } /* end */ |
| 8356 | }; |
| 8357 | |
| 8358 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8359 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8360 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8361 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8362 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8363 | spec->autocfg.hp_pins[0] = 0x14; |
| 8364 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8365 | } |
| 8366 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8367 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8368 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8369 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8370 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8371 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8372 | { |
| 8373 | unsigned int present; |
| 8374 | |
| 8375 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8376 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8377 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8378 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8379 | } |
| 8380 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8381 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8382 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8383 | struct alc_spec *spec = codec->spec; |
| 8384 | |
| 8385 | spec->autocfg.hp_pins[0] = 0x15; |
| 8386 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8387 | } |
| 8388 | |
| 8389 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 8390 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8391 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8392 | alc883_clevo_m720_mic_automute(codec); |
| 8393 | } |
| 8394 | |
| 8395 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8396 | unsigned int res) |
| 8397 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8398 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8399 | case ALC880_MIC_EVENT: |
| 8400 | alc883_clevo_m720_mic_automute(codec); |
| 8401 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8402 | default: |
| 8403 | alc_automute_amp_unsol_event(codec, res); |
| 8404 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8405 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8406 | } |
| 8407 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8408 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8409 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8410 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8411 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8412 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8413 | spec->autocfg.hp_pins[0] = 0x14; |
| 8414 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8415 | } |
| 8416 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8417 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8418 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8419 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8420 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8421 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8422 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8423 | } |
| 8424 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8425 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8426 | { |
| 8427 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8428 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8429 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8430 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8431 | & AC_PINSENSE_PRESENCE; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8432 | bits = present ? HDA_AMP_MUTE : 0; |
| 8433 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8434 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8435 | } |
| 8436 | |
| 8437 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8438 | { |
| 8439 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8440 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8441 | |
| 8442 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8443 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8444 | bits = present ? HDA_AMP_MUTE : 0; |
| 8445 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8446 | HDA_AMP_MUTE, bits); |
| 8447 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8448 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8449 | } |
| 8450 | |
| 8451 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8452 | unsigned int res) |
| 8453 | { |
| 8454 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8455 | alc883_lenovo_101e_all_automute(codec); |
| 8456 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8457 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8458 | } |
| 8459 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8460 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8461 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8462 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8463 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8464 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8465 | spec->autocfg.hp_pins[0] = 0x14; |
| 8466 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8467 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8468 | } |
| 8469 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8470 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8471 | /* HP Pin: output 0 (0x0c) */ |
| 8472 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8473 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8474 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8475 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8476 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8477 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8478 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8479 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8480 | /* eanable EAPD on medion laptop */ |
| 8481 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8482 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8483 | /* enable unsolicited event */ |
| 8484 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8485 | { } |
| 8486 | }; |
| 8487 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8488 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 8489 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8490 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8491 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8492 | { } /* end */ |
| 8493 | }; |
| 8494 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8495 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8496 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8497 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8498 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8499 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8500 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8501 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8502 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8503 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8504 | } |
| 8505 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8506 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8507 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8508 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8509 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8510 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8511 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8512 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8513 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8514 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8515 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8516 | } |
| 8517 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8518 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8519 | { |
| 8520 | struct alc_spec *spec = codec->spec; |
| 8521 | |
| 8522 | spec->autocfg.hp_pins[0] = 0x15; |
| 8523 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8524 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8525 | } |
| 8526 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8527 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8528 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8529 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8530 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8531 | /* enable unsolicited event */ |
| 8532 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8533 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8534 | { } /* end */ |
| 8535 | }; |
| 8536 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8537 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8538 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8539 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8540 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8541 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8542 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8543 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8544 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8545 | spec->ext_mic.pin = 0x18; |
| 8546 | spec->int_mic.pin = 0x19; |
| 8547 | spec->ext_mic.mux_idx = 0; |
| 8548 | spec->int_mic.mux_idx = 1; |
| 8549 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8550 | } |
| 8551 | |
| 8552 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8553 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8554 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8555 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8556 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8557 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8558 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8559 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8560 | /* enable unsolicited event */ |
| 8561 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8562 | { } /* end */ |
| 8563 | }; |
| 8564 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8565 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8566 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8567 | struct alc_spec *spec = codec->spec; |
| 8568 | |
| 8569 | spec->autocfg.hp_pins[0] = 0x14; |
| 8570 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8571 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8572 | } |
| 8573 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8574 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8575 | /* Init rear pin (used as headphone output) */ |
| 8576 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8577 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8578 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8579 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8580 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8581 | /* Init line 2 pin (used as headphone out by default) */ |
| 8582 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8583 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8584 | { } /* end */ |
| 8585 | }; |
| 8586 | |
| 8587 | /* Mute speakers according to the headphone jack state */ |
| 8588 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8589 | { |
| 8590 | unsigned int present; |
| 8591 | |
| 8592 | /* Mute only in 2ch or 4ch mode */ |
| 8593 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8594 | == 0x00) { |
| 8595 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8596 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 8597 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8598 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8599 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8600 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8601 | } |
| 8602 | } |
| 8603 | |
| 8604 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8605 | { |
| 8606 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8607 | alc889A_mb31_automute(codec); |
| 8608 | } |
| 8609 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8610 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8611 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8612 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8613 | #endif |
| 8614 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8615 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8616 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8617 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8618 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8619 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8620 | |
| 8621 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8622 | ALC1200_DIGOUT_NID, 0, |
| 8623 | }; |
| 8624 | |
| 8625 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8626 | ALC883_DIGOUT_NID, 0, |
| 8627 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8628 | |
| 8629 | /* |
| 8630 | * configuration and preset |
| 8631 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8632 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 8633 | [ALC882_3ST_DIG] = "3stack-dig", |
| 8634 | [ALC882_6ST_DIG] = "6stack-dig", |
| 8635 | [ALC882_ARIMA] = "arima", |
| 8636 | [ALC882_W2JC] = "w2jc", |
| 8637 | [ALC882_TARGA] = "targa", |
| 8638 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 8639 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 8640 | [ALC885_MACPRO] = "macpro", |
| 8641 | [ALC885_MB5] = "mb5", |
| 8642 | [ALC885_MBP3] = "mbp3", |
| 8643 | [ALC885_IMAC24] = "imac24", |
| 8644 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8645 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8646 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8647 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8648 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8649 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8650 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8651 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8652 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8653 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 8654 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8655 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8656 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8657 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8658 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8659 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8660 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8661 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8662 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8663 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8664 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8665 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8666 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8667 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8668 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8669 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8670 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8671 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8672 | [ALC889A_INTEL] = "intel-alc889a", |
| 8673 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8674 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8675 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8676 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8677 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8678 | }; |
| 8679 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8680 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 8681 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 8682 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8683 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8684 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8685 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8686 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8687 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8688 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8689 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8690 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8691 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8692 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8693 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 8694 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 8695 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 8696 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8697 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 8698 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8699 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 8700 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8701 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8702 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8703 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 8704 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8705 | /* default Acer -- disabled as it causes more problems. |
| 8706 | * model=auto should work fine now |
| 8707 | */ |
| 8708 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8709 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8710 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8711 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8712 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8713 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8714 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8715 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8716 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8717 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8718 | |
| 8719 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 8720 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 8721 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8722 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8723 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 8724 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 8725 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8726 | 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] | 8727 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8728 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8729 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8730 | |
| 8731 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8732 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8733 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8734 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8735 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8736 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8737 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8738 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8739 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 8740 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8741 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8742 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8743 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8744 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8745 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8746 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8747 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8748 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8749 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8750 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8751 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8752 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8753 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8754 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8755 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8756 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8757 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8758 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8759 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8760 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8761 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8762 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8763 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8764 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8765 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8766 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 8767 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8768 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8769 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8770 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8771 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8772 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8773 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8774 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8775 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8776 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8777 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8778 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8779 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8780 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8781 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8782 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8783 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8784 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8785 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8786 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8787 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8788 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8789 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8790 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8791 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8792 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8793 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8794 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8795 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 8796 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 8797 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8798 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8799 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8800 | {} |
| 8801 | }; |
| 8802 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8803 | /* codec SSID table for Intel Mac */ |
| 8804 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 8805 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 8806 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 8807 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 8808 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 8809 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 8810 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 8811 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 8812 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 8813 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 8814 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
| 8815 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
| 8816 | /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently |
| 8817 | * no perfect solution yet |
| 8818 | */ |
| 8819 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
| 8820 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8821 | }; |
| 8822 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8823 | static struct alc_config_preset alc882_presets[] = { |
| 8824 | [ALC882_3ST_DIG] = { |
| 8825 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8826 | .init_verbs = { alc882_base_init_verbs, |
| 8827 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8828 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8829 | .dac_nids = alc882_dac_nids, |
| 8830 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8831 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8832 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8833 | .channel_mode = alc882_ch_modes, |
| 8834 | .need_dac_fix = 1, |
| 8835 | .input_mux = &alc882_capture_source, |
| 8836 | }, |
| 8837 | [ALC882_6ST_DIG] = { |
| 8838 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8839 | .init_verbs = { alc882_base_init_verbs, |
| 8840 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8841 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8842 | .dac_nids = alc882_dac_nids, |
| 8843 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8844 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8845 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8846 | .channel_mode = alc882_sixstack_modes, |
| 8847 | .input_mux = &alc882_capture_source, |
| 8848 | }, |
| 8849 | [ALC882_ARIMA] = { |
| 8850 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8851 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8852 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8853 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8854 | .dac_nids = alc882_dac_nids, |
| 8855 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8856 | .channel_mode = alc882_sixstack_modes, |
| 8857 | .input_mux = &alc882_capture_source, |
| 8858 | }, |
| 8859 | [ALC882_W2JC] = { |
| 8860 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8861 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8862 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8863 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8864 | .dac_nids = alc882_dac_nids, |
| 8865 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8866 | .channel_mode = alc880_threestack_modes, |
| 8867 | .need_dac_fix = 1, |
| 8868 | .input_mux = &alc882_capture_source, |
| 8869 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8870 | }, |
| 8871 | [ALC885_MBP3] = { |
| 8872 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 8873 | .init_verbs = { alc885_mbp3_init_verbs, |
| 8874 | alc880_gpio1_init_verbs }, |
| 8875 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8876 | .dac_nids = alc882_dac_nids, |
| 8877 | .channel_mode = alc885_mbp_6ch_modes, |
| 8878 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 8879 | .input_mux = &alc882_capture_source, |
| 8880 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8881 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8882 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8883 | .setup = alc885_mbp3_setup, |
| 8884 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8885 | }, |
| 8886 | [ALC885_MB5] = { |
| 8887 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 8888 | .init_verbs = { alc885_mb5_init_verbs, |
| 8889 | alc880_gpio1_init_verbs }, |
| 8890 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8891 | .dac_nids = alc882_dac_nids, |
| 8892 | .channel_mode = alc885_mb5_6ch_modes, |
| 8893 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 8894 | .input_mux = &mb5_capture_source, |
| 8895 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8896 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8897 | }, |
| 8898 | [ALC885_MACPRO] = { |
| 8899 | .mixers = { alc882_macpro_mixer }, |
| 8900 | .init_verbs = { alc882_macpro_init_verbs }, |
| 8901 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8902 | .dac_nids = alc882_dac_nids, |
| 8903 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8904 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8905 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8906 | .channel_mode = alc882_ch_modes, |
| 8907 | .input_mux = &alc882_capture_source, |
| 8908 | .init_hook = alc885_macpro_init_hook, |
| 8909 | }, |
| 8910 | [ALC885_IMAC24] = { |
| 8911 | .mixers = { alc885_imac24_mixer }, |
| 8912 | .init_verbs = { alc885_imac24_init_verbs }, |
| 8913 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8914 | .dac_nids = alc882_dac_nids, |
| 8915 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8916 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8917 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8918 | .channel_mode = alc882_ch_modes, |
| 8919 | .input_mux = &alc882_capture_source, |
| 8920 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8921 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8922 | .init_hook = alc885_imac24_init_hook, |
| 8923 | }, |
| 8924 | [ALC882_TARGA] = { |
| 8925 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8926 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 8927 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8928 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8929 | .dac_nids = alc882_dac_nids, |
| 8930 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8931 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8932 | .adc_nids = alc882_adc_nids, |
| 8933 | .capsrc_nids = alc882_capsrc_nids, |
| 8934 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8935 | .channel_mode = alc882_3ST_6ch_modes, |
| 8936 | .need_dac_fix = 1, |
| 8937 | .input_mux = &alc882_capture_source, |
| 8938 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8939 | .setup = alc882_targa_setup, |
| 8940 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8941 | }, |
| 8942 | [ALC882_ASUS_A7J] = { |
| 8943 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8944 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8945 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8946 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8947 | .dac_nids = alc882_dac_nids, |
| 8948 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8949 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8950 | .adc_nids = alc882_adc_nids, |
| 8951 | .capsrc_nids = alc882_capsrc_nids, |
| 8952 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8953 | .channel_mode = alc882_3ST_6ch_modes, |
| 8954 | .need_dac_fix = 1, |
| 8955 | .input_mux = &alc882_capture_source, |
| 8956 | }, |
| 8957 | [ALC882_ASUS_A7M] = { |
| 8958 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8959 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8960 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8961 | alc882_asus_a7m_verbs }, |
| 8962 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8963 | .dac_nids = alc882_dac_nids, |
| 8964 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8965 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8966 | .channel_mode = alc880_threestack_modes, |
| 8967 | .need_dac_fix = 1, |
| 8968 | .input_mux = &alc882_capture_source, |
| 8969 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8970 | [ALC883_3ST_2ch_DIG] = { |
| 8971 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8972 | .init_verbs = { alc883_init_verbs }, |
| 8973 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8974 | .dac_nids = alc883_dac_nids, |
| 8975 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8976 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8977 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8978 | .channel_mode = alc883_3ST_2ch_modes, |
| 8979 | .input_mux = &alc883_capture_source, |
| 8980 | }, |
| 8981 | [ALC883_3ST_6ch_DIG] = { |
| 8982 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8983 | .init_verbs = { alc883_init_verbs }, |
| 8984 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8985 | .dac_nids = alc883_dac_nids, |
| 8986 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8987 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8988 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8989 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8990 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8991 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8992 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8993 | [ALC883_3ST_6ch] = { |
| 8994 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8995 | .init_verbs = { alc883_init_verbs }, |
| 8996 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8997 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8998 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8999 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9000 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9001 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9002 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9003 | [ALC883_3ST_6ch_INTEL] = { |
| 9004 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9005 | .init_verbs = { alc883_init_verbs }, |
| 9006 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9007 | .dac_nids = alc883_dac_nids, |
| 9008 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9009 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9010 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9011 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9012 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9013 | .need_dac_fix = 1, |
| 9014 | .input_mux = &alc883_3stack_6ch_intel, |
| 9015 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9016 | [ALC889A_INTEL] = { |
| 9017 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9018 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9019 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9020 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9021 | .dac_nids = alc883_dac_nids, |
| 9022 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9023 | .adc_nids = alc889_adc_nids, |
| 9024 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9025 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9026 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9027 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9028 | .channel_mode = alc889_8ch_intel_modes, |
| 9029 | .capsrc_nids = alc889_capsrc_nids, |
| 9030 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9031 | .setup = alc889_automute_setup, |
| 9032 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9033 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9034 | .need_dac_fix = 1, |
| 9035 | }, |
| 9036 | [ALC889_INTEL] = { |
| 9037 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9038 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9039 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9040 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9041 | .dac_nids = alc883_dac_nids, |
| 9042 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9043 | .adc_nids = alc889_adc_nids, |
| 9044 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9045 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9046 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9047 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9048 | .channel_mode = alc889_8ch_intel_modes, |
| 9049 | .capsrc_nids = alc889_capsrc_nids, |
| 9050 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9051 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9052 | .init_hook = alc889_intel_init_hook, |
| 9053 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9054 | .need_dac_fix = 1, |
| 9055 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9056 | [ALC883_6ST_DIG] = { |
| 9057 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9058 | .init_verbs = { alc883_init_verbs }, |
| 9059 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9060 | .dac_nids = alc883_dac_nids, |
| 9061 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9062 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9063 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9064 | .channel_mode = alc883_sixstack_modes, |
| 9065 | .input_mux = &alc883_capture_source, |
| 9066 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9067 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9068 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9069 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9070 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9071 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9072 | .dac_nids = alc883_dac_nids, |
| 9073 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9074 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9075 | .channel_mode = alc883_3ST_6ch_modes, |
| 9076 | .need_dac_fix = 1, |
| 9077 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9078 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9079 | .setup = alc882_targa_setup, |
| 9080 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9081 | }, |
| 9082 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9083 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9084 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9085 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9086 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9087 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9088 | .adc_nids = alc883_adc_nids_alt, |
| 9089 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9090 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9091 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9092 | .channel_mode = alc883_3ST_2ch_modes, |
| 9093 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9094 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9095 | .setup = alc882_targa_setup, |
| 9096 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9097 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9098 | [ALC883_TARGA_8ch_DIG] = { |
| 9099 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9100 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9101 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9102 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9103 | .dac_nids = alc883_dac_nids, |
| 9104 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9105 | .adc_nids = alc883_adc_nids_rev, |
| 9106 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9107 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9108 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9109 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9110 | .channel_mode = alc883_4ST_8ch_modes, |
| 9111 | .need_dac_fix = 1, |
| 9112 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9113 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9114 | .setup = alc882_targa_setup, |
| 9115 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9116 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9117 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9118 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9119 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9120 | * and the headphone jack. Turn this on and rely on the |
| 9121 | * standard mute methods whenever the user wants to turn |
| 9122 | * these outputs off. |
| 9123 | */ |
| 9124 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9125 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9126 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9127 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9128 | .channel_mode = alc883_3ST_2ch_modes, |
| 9129 | .input_mux = &alc883_capture_source, |
| 9130 | }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9131 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9132 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9133 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9134 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9135 | .dac_nids = alc883_dac_nids, |
| 9136 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9137 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9138 | .channel_mode = alc883_3ST_2ch_modes, |
| 9139 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9140 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9141 | .setup = alc883_acer_aspire_setup, |
| 9142 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9143 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9144 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9145 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9146 | alc883_chmode_mixer }, |
| 9147 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9148 | alc888_acer_aspire_4930g_verbs }, |
| 9149 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9150 | .dac_nids = alc883_dac_nids, |
| 9151 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9152 | .adc_nids = alc883_adc_nids_rev, |
| 9153 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9154 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9155 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9156 | .channel_mode = alc883_3ST_6ch_modes, |
| 9157 | .need_dac_fix = 1, |
| 9158 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9159 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9160 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9161 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9162 | .setup = alc888_acer_aspire_4930g_setup, |
| 9163 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9164 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9165 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9166 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9167 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9168 | alc888_acer_aspire_6530g_verbs }, |
| 9169 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9170 | .dac_nids = alc883_dac_nids, |
| 9171 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9172 | .adc_nids = alc883_adc_nids_rev, |
| 9173 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9174 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9175 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9176 | .channel_mode = alc883_3ST_2ch_modes, |
| 9177 | .num_mux_defs = |
| 9178 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9179 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9180 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9181 | .setup = alc888_acer_aspire_6530g_setup, |
| 9182 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9183 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9184 | [ALC888_ACER_ASPIRE_8930G] = { |
| 9185 | .mixers = { alc888_base_mixer, |
| 9186 | alc883_chmode_mixer }, |
| 9187 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9188 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9189 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9190 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9191 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9192 | .adc_nids = alc889_adc_nids, |
| 9193 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9194 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9195 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9196 | .channel_mode = alc883_3ST_6ch_modes, |
| 9197 | .need_dac_fix = 1, |
| 9198 | .const_channel_count = 6, |
| 9199 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9200 | ARRAY_SIZE(alc889_capture_sources), |
| 9201 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9202 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9203 | .setup = alc889_acer_aspire_8930g_setup, |
| 9204 | .init_hook = alc_automute_amp, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9205 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9206 | [ALC888_ACER_ASPIRE_7730G] = { |
| 9207 | .mixers = { alc883_3ST_6ch_mixer, |
| 9208 | alc883_chmode_mixer }, |
| 9209 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9210 | alc888_acer_aspire_7730G_verbs }, |
| 9211 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9212 | .dac_nids = alc883_dac_nids, |
| 9213 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9214 | .adc_nids = alc883_adc_nids_rev, |
| 9215 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9216 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9217 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9218 | .channel_mode = alc883_3ST_6ch_modes, |
| 9219 | .need_dac_fix = 1, |
| 9220 | .const_channel_count = 6, |
| 9221 | .input_mux = &alc883_capture_source, |
| 9222 | .unsol_event = alc_automute_amp_unsol_event, |
| 9223 | .setup = alc888_acer_aspire_6530g_setup, |
| 9224 | .init_hook = alc_automute_amp, |
| 9225 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9226 | [ALC883_MEDION] = { |
| 9227 | .mixers = { alc883_fivestack_mixer, |
| 9228 | alc883_chmode_mixer }, |
| 9229 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9230 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9231 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9232 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9233 | .adc_nids = alc883_adc_nids_alt, |
| 9234 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9235 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9236 | .channel_mode = alc883_sixstack_modes, |
| 9237 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9238 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9239 | [ALC883_MEDION_MD2] = { |
| 9240 | .mixers = { alc883_medion_md2_mixer}, |
| 9241 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9242 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9243 | .dac_nids = alc883_dac_nids, |
| 9244 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9245 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9246 | .channel_mode = alc883_3ST_2ch_modes, |
| 9247 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9248 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9249 | .setup = alc883_medion_md2_setup, |
| 9250 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9251 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9252 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9253 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9254 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9255 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9256 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9257 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9258 | .channel_mode = alc883_3ST_2ch_modes, |
| 9259 | .input_mux = &alc883_capture_source, |
| 9260 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9261 | [ALC883_CLEVO_M720] = { |
| 9262 | .mixers = { alc883_clevo_m720_mixer }, |
| 9263 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9264 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9265 | .dac_nids = alc883_dac_nids, |
| 9266 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9267 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9268 | .channel_mode = alc883_3ST_2ch_modes, |
| 9269 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9270 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9271 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9272 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9273 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9274 | [ALC883_LENOVO_101E_2ch] = { |
| 9275 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9276 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9277 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9278 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9279 | .adc_nids = alc883_adc_nids_alt, |
| 9280 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9281 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9282 | .channel_mode = alc883_3ST_2ch_modes, |
| 9283 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9284 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9285 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9286 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9287 | [ALC883_LENOVO_NB0763] = { |
| 9288 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9289 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9290 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9291 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9292 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9293 | .channel_mode = alc883_3ST_2ch_modes, |
| 9294 | .need_dac_fix = 1, |
| 9295 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9296 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9297 | .setup = alc883_medion_md2_setup, |
| 9298 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9299 | }, |
| 9300 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9301 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9302 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9303 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9304 | .dac_nids = alc883_dac_nids, |
| 9305 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9306 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9307 | .channel_mode = alc883_3ST_6ch_modes, |
| 9308 | .need_dac_fix = 1, |
| 9309 | .input_mux = &alc883_capture_source, |
| 9310 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9311 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9312 | }, |
| 9313 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9314 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9315 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9316 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9317 | .dac_nids = alc883_dac_nids, |
| 9318 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9319 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9320 | .channel_mode = alc883_3ST_2ch_modes, |
| 9321 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9322 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9323 | .setup = alc883_haier_w66_setup, |
| 9324 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9325 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9326 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9327 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9328 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9329 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9330 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9331 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9332 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9333 | .need_dac_fix = 1, |
| 9334 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9335 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9336 | .setup = alc888_3st_hp_setup, |
| 9337 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9338 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9339 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9340 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9341 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9342 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9343 | .dac_nids = alc883_dac_nids, |
| 9344 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9345 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9346 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9347 | .channel_mode = alc883_sixstack_modes, |
| 9348 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9349 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9350 | .setup = alc888_6st_dell_setup, |
| 9351 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9352 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9353 | [ALC883_MITAC] = { |
| 9354 | .mixers = { alc883_mitac_mixer }, |
| 9355 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9356 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9357 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9358 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9359 | .channel_mode = alc883_3ST_2ch_modes, |
| 9360 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9361 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9362 | .setup = alc883_mitac_setup, |
| 9363 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9364 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9365 | [ALC883_FUJITSU_PI2515] = { |
| 9366 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9367 | .init_verbs = { alc883_init_verbs, |
| 9368 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9369 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9370 | .dac_nids = alc883_dac_nids, |
| 9371 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9372 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9373 | .channel_mode = alc883_3ST_2ch_modes, |
| 9374 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9375 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9376 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 9377 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9378 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9379 | [ALC888_FUJITSU_XA3530] = { |
| 9380 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9381 | .init_verbs = { alc883_init_verbs, |
| 9382 | alc888_fujitsu_xa3530_verbs }, |
| 9383 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9384 | .dac_nids = alc883_dac_nids, |
| 9385 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9386 | .adc_nids = alc883_adc_nids_rev, |
| 9387 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9388 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9389 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9390 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9391 | .num_mux_defs = |
| 9392 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9393 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9394 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9395 | .setup = alc888_fujitsu_xa3530_setup, |
| 9396 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9397 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9398 | [ALC888_LENOVO_SKY] = { |
| 9399 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9400 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9401 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9402 | .dac_nids = alc883_dac_nids, |
| 9403 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9404 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9405 | .channel_mode = alc883_sixstack_modes, |
| 9406 | .need_dac_fix = 1, |
| 9407 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9408 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9409 | .setup = alc888_lenovo_sky_setup, |
| 9410 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9411 | }, |
| 9412 | [ALC888_ASUS_M90V] = { |
| 9413 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9414 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9415 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9416 | .dac_nids = alc883_dac_nids, |
| 9417 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9418 | .dig_in_nid = ALC883_DIGIN_NID, |
| 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_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9423 | .unsol_event = alc_sku_unsol_event, |
| 9424 | .setup = alc883_mode2_setup, |
| 9425 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9426 | }, |
| 9427 | [ALC888_ASUS_EEE1601] = { |
| 9428 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9429 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9430 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9431 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9432 | .dac_nids = alc883_dac_nids, |
| 9433 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9434 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9435 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9436 | .channel_mode = alc883_3ST_2ch_modes, |
| 9437 | .need_dac_fix = 1, |
| 9438 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9439 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9440 | .init_hook = alc883_eee1601_inithook, |
| 9441 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9442 | [ALC1200_ASUS_P5Q] = { |
| 9443 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9444 | .init_verbs = { alc883_init_verbs }, |
| 9445 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9446 | .dac_nids = alc883_dac_nids, |
| 9447 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9448 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9449 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9450 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9451 | .channel_mode = alc883_sixstack_modes, |
| 9452 | .input_mux = &alc883_capture_source, |
| 9453 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9454 | [ALC889A_MB31] = { |
| 9455 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9456 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9457 | alc880_gpio1_init_verbs }, |
| 9458 | .adc_nids = alc883_adc_nids, |
| 9459 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9460 | .dac_nids = alc883_dac_nids, |
| 9461 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9462 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9463 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9464 | .input_mux = &alc889A_mb31_capture_source, |
| 9465 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9466 | .unsol_event = alc889A_mb31_unsol_event, |
| 9467 | .init_hook = alc889A_mb31_automute, |
| 9468 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9469 | [ALC883_SONY_VAIO_TT] = { |
| 9470 | .mixers = { alc883_vaiott_mixer }, |
| 9471 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9472 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9473 | .dac_nids = alc883_dac_nids, |
| 9474 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9475 | .channel_mode = alc883_3ST_2ch_modes, |
| 9476 | .input_mux = &alc883_capture_source, |
| 9477 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9478 | .setup = alc883_vaiott_setup, |
| 9479 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9480 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9481 | }; |
| 9482 | |
| 9483 | |
| 9484 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9485 | * Pin config fixes |
| 9486 | */ |
| 9487 | enum { |
| 9488 | PINFIX_ABIT_AW9D_MAX |
| 9489 | }; |
| 9490 | |
| 9491 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9492 | { 0x15, 0x01080104 }, /* side */ |
| 9493 | { 0x16, 0x01011012 }, /* rear */ |
| 9494 | { 0x17, 0x01016011 }, /* clfe */ |
| 9495 | { } |
| 9496 | }; |
| 9497 | |
| 9498 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 9499 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 9500 | }; |
| 9501 | |
| 9502 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 9503 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9504 | {} |
| 9505 | }; |
| 9506 | |
| 9507 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9508 | * BIOS auto configuration |
| 9509 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9510 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 9511 | const struct auto_pin_cfg *cfg) |
| 9512 | { |
| 9513 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 9514 | } |
| 9515 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9516 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9517 | hda_nid_t nid, int pin_type, |
| 9518 | int dac_idx) |
| 9519 | { |
| 9520 | /* set as output */ |
| 9521 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9522 | int idx; |
| 9523 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9524 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9525 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9526 | idx = 4; |
| 9527 | else |
| 9528 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9529 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9530 | |
| 9531 | } |
| 9532 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9533 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9534 | { |
| 9535 | struct alc_spec *spec = codec->spec; |
| 9536 | int i; |
| 9537 | |
| 9538 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9539 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9540 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9541 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9542 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9543 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9544 | } |
| 9545 | } |
| 9546 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9547 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9548 | { |
| 9549 | struct alc_spec *spec = codec->spec; |
| 9550 | hda_nid_t pin; |
| 9551 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9552 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9553 | if (pin) /* connect to front */ |
| 9554 | /* use dac 0 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9555 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9556 | pin = spec->autocfg.speaker_pins[0]; |
| 9557 | if (pin) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9558 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9559 | } |
| 9560 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9561 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9562 | { |
| 9563 | struct alc_spec *spec = codec->spec; |
| 9564 | int i; |
| 9565 | |
| 9566 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9567 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9568 | if (!nid) |
| 9569 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 9570 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9571 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 9572 | snd_hda_codec_write(codec, nid, 0, |
| 9573 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9574 | AMP_OUT_MUTE); |
| 9575 | } |
| 9576 | } |
| 9577 | |
| 9578 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 9579 | { |
| 9580 | struct alc_spec *spec = codec->spec; |
| 9581 | int c; |
| 9582 | |
| 9583 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 9584 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 9585 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 9586 | unsigned int mux_idx; |
| 9587 | const struct hda_input_mux *imux; |
| 9588 | int conns, mute, idx, item; |
| 9589 | |
| 9590 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 9591 | ARRAY_SIZE(conn_list)); |
| 9592 | if (conns < 0) |
| 9593 | continue; |
| 9594 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 9595 | imux = &spec->input_mux[mux_idx]; |
| 9596 | for (idx = 0; idx < conns; idx++) { |
| 9597 | /* if the current connection is the selected one, |
| 9598 | * unmute it as default - otherwise mute it |
| 9599 | */ |
| 9600 | mute = AMP_IN_MUTE(idx); |
| 9601 | for (item = 0; item < imux->num_items; item++) { |
| 9602 | if (imux->items[item].index == idx) { |
| 9603 | if (spec->cur_mux[c] == item) |
| 9604 | mute = AMP_IN_UNMUTE(idx); |
| 9605 | break; |
| 9606 | } |
| 9607 | } |
| 9608 | /* check if we have a selector or mixer |
| 9609 | * we could check for the widget type instead, but |
| 9610 | * just check for Amp-In presence (in case of mixer |
| 9611 | * without amp-in there is something wrong, this |
| 9612 | * function shouldn't be used or capsrc nid is wrong) |
| 9613 | */ |
| 9614 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9615 | snd_hda_codec_write(codec, nid, 0, |
| 9616 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9617 | mute); |
| 9618 | else if (mute != AMP_IN_MUTE(idx)) |
| 9619 | snd_hda_codec_write(codec, nid, 0, |
| 9620 | AC_VERB_SET_CONNECT_SEL, |
| 9621 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9622 | } |
| 9623 | } |
| 9624 | } |
| 9625 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9626 | /* add mic boosts if needed */ |
| 9627 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9628 | { |
| 9629 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9630 | int err; |
| 9631 | hda_nid_t nid; |
| 9632 | |
| 9633 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 9634 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9635 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9636 | "Mic Boost", |
| 9637 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9638 | if (err < 0) |
| 9639 | return err; |
| 9640 | } |
| 9641 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 9642 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9643 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9644 | "Front Mic Boost", |
| 9645 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9646 | if (err < 0) |
| 9647 | return err; |
| 9648 | } |
| 9649 | return 0; |
| 9650 | } |
| 9651 | |
| 9652 | /* almost identical with ALC880 parser... */ |
| 9653 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 9654 | { |
| 9655 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9656 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 9657 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9658 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9659 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9660 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9661 | if (err < 0) |
| 9662 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9663 | if (!spec->autocfg.line_outs) |
| 9664 | return 0; /* can't find valid BIOS pin config */ |
| 9665 | |
| 9666 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 9667 | if (err < 0) |
| 9668 | return err; |
| 9669 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9670 | if (err < 0) |
| 9671 | return err; |
| 9672 | err = alc880_auto_create_extra_out(spec, |
| 9673 | spec->autocfg.speaker_pins[0], |
| 9674 | "Speaker"); |
| 9675 | if (err < 0) |
| 9676 | return err; |
| 9677 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 9678 | "Headphone"); |
| 9679 | if (err < 0) |
| 9680 | return err; |
| 9681 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 9682 | if (err < 0) |
| 9683 | return err; |
| 9684 | |
| 9685 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9686 | |
| 9687 | /* check multiple SPDIF-out (for recent codecs) */ |
| 9688 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 9689 | hda_nid_t dig_nid; |
| 9690 | err = snd_hda_get_connections(codec, |
| 9691 | spec->autocfg.dig_out_pins[i], |
| 9692 | &dig_nid, 1); |
| 9693 | if (err < 0) |
| 9694 | continue; |
| 9695 | if (!i) |
| 9696 | spec->multiout.dig_out_nid = dig_nid; |
| 9697 | else { |
| 9698 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 9699 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 9700 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 9701 | break; |
| 9702 | } |
| 9703 | } |
| 9704 | if (spec->autocfg.dig_in_pin) |
| 9705 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 9706 | |
| 9707 | if (spec->kctls.list) |
| 9708 | add_mixer(spec, spec->kctls.list); |
| 9709 | |
| 9710 | add_verb(spec, alc883_auto_init_verbs); |
| 9711 | /* if ADC 0x07 is available, initialize it, too */ |
| 9712 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 9713 | add_verb(spec, alc882_adc1_init_verbs); |
| 9714 | |
| 9715 | spec->num_mux_defs = 1; |
| 9716 | spec->input_mux = &spec->private_imux[0]; |
| 9717 | |
| 9718 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9719 | |
| 9720 | err = alc_auto_add_mic_boost(codec); |
| 9721 | if (err < 0) |
| 9722 | return err; |
| 9723 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9724 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9725 | } |
| 9726 | |
| 9727 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9728 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9729 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9730 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9731 | alc882_auto_init_multi_out(codec); |
| 9732 | alc882_auto_init_hp_out(codec); |
| 9733 | alc882_auto_init_analog_input(codec); |
| 9734 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9735 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9736 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9737 | } |
| 9738 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9739 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9740 | { |
| 9741 | struct alc_spec *spec; |
| 9742 | int err, board_config; |
| 9743 | |
| 9744 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9745 | if (spec == NULL) |
| 9746 | return -ENOMEM; |
| 9747 | |
| 9748 | codec->spec = spec; |
| 9749 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9750 | switch (codec->vendor_id) { |
| 9751 | case 0x10ec0882: |
| 9752 | case 0x10ec0885: |
| 9753 | break; |
| 9754 | default: |
| 9755 | /* ALC883 and variants */ |
| 9756 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9757 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9758 | } |
| 9759 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9760 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 9761 | alc882_models, |
| 9762 | alc882_cfg_tbl); |
| 9763 | |
| 9764 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 9765 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 9766 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 9767 | |
| 9768 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 9769 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9770 | codec->chip_name); |
| 9771 | board_config = ALC882_AUTO; |
| 9772 | } |
| 9773 | |
| 9774 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 9775 | |
| 9776 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9777 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9778 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9779 | if (err < 0) { |
| 9780 | alc_free(codec); |
| 9781 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9782 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9783 | printk(KERN_INFO |
| 9784 | "hda_codec: Cannot set up configuration " |
| 9785 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9786 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9787 | } |
| 9788 | } |
| 9789 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9790 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9791 | if (err < 0) { |
| 9792 | alc_free(codec); |
| 9793 | return err; |
| 9794 | } |
| 9795 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9796 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 9797 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9798 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9799 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 9800 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 9801 | /* FIXME: setup DAC5 */ |
| 9802 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 9803 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 9804 | |
| 9805 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 9806 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 9807 | |
| 9808 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9809 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9810 | |
| 9811 | if (!spec->adc_nids && spec->input_mux) { |
| 9812 | int i; |
| 9813 | spec->num_adc_nids = 0; |
| 9814 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
| 9815 | hda_nid_t cap; |
| 9816 | hda_nid_t nid = alc882_adc_nids[i]; |
| 9817 | unsigned int wcap = get_wcaps(codec, nid); |
| 9818 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 9819 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9820 | if (wcap != AC_WID_AUD_IN) |
| 9821 | continue; |
| 9822 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 9823 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 9824 | if (err < 0) |
| 9825 | continue; |
| 9826 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 9827 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9828 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9829 | spec->adc_nids = spec->private_adc_nids; |
| 9830 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9831 | } |
| 9832 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 9833 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9834 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9835 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9836 | spec->vmaster_nid = 0x0c; |
| 9837 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9838 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9839 | if (board_config == ALC882_AUTO) |
| 9840 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9841 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9842 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9843 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9844 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9845 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9846 | |
| 9847 | return 0; |
| 9848 | } |
| 9849 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9850 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9851 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9852 | * ALC262 support |
| 9853 | */ |
| 9854 | |
| 9855 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9856 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9857 | |
| 9858 | #define alc262_dac_nids alc260_dac_nids |
| 9859 | #define alc262_adc_nids alc882_adc_nids |
| 9860 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9861 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9862 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9863 | |
| 9864 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9865 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9866 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9867 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9868 | /* ADC0 */ |
| 9869 | 0x09 |
| 9870 | }; |
| 9871 | |
| 9872 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9873 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9874 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9875 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9876 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9877 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9878 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9879 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9880 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9881 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9882 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9883 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9884 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9885 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9886 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9887 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9888 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9889 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9890 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9891 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9892 | }; |
| 9893 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9894 | /* update HP, line and mono-out pins according to the master switch */ |
| 9895 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9896 | { |
| 9897 | struct alc_spec *spec = codec->spec; |
| 9898 | int val = spec->master_sw; |
| 9899 | |
| 9900 | /* HP & line-out */ |
| 9901 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9902 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9903 | val ? PIN_HP : 0); |
| 9904 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9905 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9906 | val ? PIN_HP : 0); |
| 9907 | /* mono (speaker) depending on the HP jack sense */ |
| 9908 | val = val && !spec->jack_present; |
| 9909 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9910 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9911 | val ? PIN_OUT : 0); |
| 9912 | } |
| 9913 | |
| 9914 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9915 | { |
| 9916 | struct alc_spec *spec = codec->spec; |
| 9917 | unsigned int presence; |
| 9918 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9919 | AC_VERB_GET_PIN_SENSE, 0); |
| 9920 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9921 | alc262_hp_master_update(codec); |
| 9922 | } |
| 9923 | |
| 9924 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9925 | { |
| 9926 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9927 | return; |
| 9928 | alc262_hp_bpc_automute(codec); |
| 9929 | } |
| 9930 | |
| 9931 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9932 | { |
| 9933 | struct alc_spec *spec = codec->spec; |
| 9934 | unsigned int presence; |
| 9935 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9936 | AC_VERB_GET_PIN_SENSE, 0); |
| 9937 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9938 | alc262_hp_master_update(codec); |
| 9939 | } |
| 9940 | |
| 9941 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9942 | unsigned int res) |
| 9943 | { |
| 9944 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9945 | return; |
| 9946 | alc262_hp_wildwest_automute(codec); |
| 9947 | } |
| 9948 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9949 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9950 | |
| 9951 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9952 | struct snd_ctl_elem_value *ucontrol) |
| 9953 | { |
| 9954 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9955 | struct alc_spec *spec = codec->spec; |
| 9956 | int val = !!*ucontrol->value.integer.value; |
| 9957 | |
| 9958 | if (val == spec->master_sw) |
| 9959 | return 0; |
| 9960 | spec->master_sw = val; |
| 9961 | alc262_hp_master_update(codec); |
| 9962 | return 1; |
| 9963 | } |
| 9964 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9965 | #define ALC262_HP_MASTER_SWITCH \ |
| 9966 | { \ |
| 9967 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9968 | .name = "Master Playback Switch", \ |
| 9969 | .info = snd_ctl_boolean_mono_info, \ |
| 9970 | .get = alc262_hp_master_sw_get, \ |
| 9971 | .put = alc262_hp_master_sw_put, \ |
| 9972 | } |
| 9973 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9974 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9975 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9976 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9977 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9978 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9979 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9980 | HDA_OUTPUT), |
| 9981 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9982 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9983 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9984 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9985 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9986 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9987 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9988 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9989 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9990 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9991 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9992 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9993 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9994 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9995 | { } /* end */ |
| 9996 | }; |
| 9997 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9998 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9999 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10000 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10001 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10002 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10003 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10004 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10005 | HDA_OUTPUT), |
| 10006 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10007 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10008 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10009 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10010 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10011 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10012 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10013 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10014 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10015 | { } /* end */ |
| 10016 | }; |
| 10017 | |
| 10018 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10019 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10020 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10021 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10022 | { } /* end */ |
| 10023 | }; |
| 10024 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10025 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10026 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10027 | { |
| 10028 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10029 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10030 | spec->autocfg.hp_pins[0] = 0x15; |
| 10031 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10032 | } |
| 10033 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10034 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10035 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10036 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10037 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10038 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10039 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10040 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10041 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10042 | { } /* end */ |
| 10043 | }; |
| 10044 | |
| 10045 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10046 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10047 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10048 | |
| 10049 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10050 | { } |
| 10051 | }; |
| 10052 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10053 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10054 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10055 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10056 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10057 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10058 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10059 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10060 | { } /* end */ |
| 10061 | }; |
| 10062 | |
| 10063 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10064 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10065 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10066 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10067 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10068 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10069 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10070 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10071 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10072 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10073 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10074 | {} |
| 10075 | }; |
| 10076 | |
| 10077 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10078 | .num_items = 1, |
| 10079 | .items = { |
| 10080 | { "Line", 0x1 }, |
| 10081 | }, |
| 10082 | }; |
| 10083 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10084 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10085 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10086 | { |
| 10087 | struct alc_spec *spec = codec->spec; |
| 10088 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10089 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10090 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10091 | unsigned int mute; |
| 10092 | |
| 10093 | /* HP */ |
| 10094 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10095 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10096 | HDA_AMP_MUTE, mute); |
| 10097 | /* mute internal speaker per jack sense */ |
| 10098 | if (spec->jack_present) |
| 10099 | mute = HDA_AMP_MUTE; |
| 10100 | if (line_nid) |
| 10101 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10102 | HDA_AMP_MUTE, mute); |
| 10103 | if (speaker_nid && speaker_nid != line_nid) |
| 10104 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10105 | HDA_AMP_MUTE, mute); |
| 10106 | } |
| 10107 | |
| 10108 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10109 | |
| 10110 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10111 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10112 | { |
| 10113 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10114 | struct alc_spec *spec = codec->spec; |
| 10115 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10116 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10117 | if (val == spec->master_sw) |
| 10118 | return 0; |
| 10119 | spec->master_sw = val; |
| 10120 | alc262_hippo_master_update(codec); |
| 10121 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10122 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10123 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10124 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10125 | { \ |
| 10126 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10127 | .name = "Master Playback Switch", \ |
| 10128 | .info = snd_ctl_boolean_mono_info, \ |
| 10129 | .get = alc262_hippo_master_sw_get, \ |
| 10130 | .put = alc262_hippo_master_sw_put, \ |
| 10131 | } |
| 10132 | |
| 10133 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10134 | ALC262_HIPPO_MASTER_SWITCH, |
| 10135 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10136 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10137 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10138 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10139 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10140 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10141 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10142 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10143 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10144 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10145 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10146 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10147 | { } /* end */ |
| 10148 | }; |
| 10149 | |
| 10150 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10151 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10152 | ALC262_HIPPO_MASTER_SWITCH, |
| 10153 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10154 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10155 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10156 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10157 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10158 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10159 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10160 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10161 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10162 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10163 | { } /* end */ |
| 10164 | }; |
| 10165 | |
| 10166 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10167 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10168 | { |
| 10169 | struct alc_spec *spec = codec->spec; |
| 10170 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10171 | unsigned int present; |
| 10172 | |
| 10173 | /* need to execute and sync at first */ |
| 10174 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10175 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 10176 | AC_VERB_GET_PIN_SENSE, 0); |
| 10177 | spec->jack_present = (present & 0x80000000) != 0; |
| 10178 | alc262_hippo_master_update(codec); |
| 10179 | } |
| 10180 | |
| 10181 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10182 | { |
| 10183 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10184 | return; |
| 10185 | alc262_hippo_automute(codec); |
| 10186 | } |
| 10187 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10188 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10189 | { |
| 10190 | struct alc_spec *spec = codec->spec; |
| 10191 | |
| 10192 | spec->autocfg.hp_pins[0] = 0x15; |
| 10193 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10194 | } |
| 10195 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10196 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10197 | { |
| 10198 | struct alc_spec *spec = codec->spec; |
| 10199 | |
| 10200 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10201 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10202 | } |
| 10203 | |
| 10204 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10205 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10206 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10207 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10208 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10209 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10210 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10211 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10212 | { } /* end */ |
| 10213 | }; |
| 10214 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10215 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10216 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10217 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10218 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10219 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10220 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10221 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10222 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10223 | { } /* end */ |
| 10224 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10225 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10226 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10227 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10228 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10229 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10230 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10231 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10232 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10233 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10234 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10235 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10236 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10237 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10238 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10239 | { } /* end */ |
| 10240 | }; |
| 10241 | |
| 10242 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10243 | /* Headphone automute */ |
| 10244 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10245 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10246 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10247 | |
| 10248 | /* P11 AUX_IN, white 4-pin connector */ |
| 10249 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10250 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10251 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10252 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10253 | |
| 10254 | {} |
| 10255 | }; |
| 10256 | |
| 10257 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10258 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10259 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10260 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10261 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10262 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10263 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10264 | } |
| 10265 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10267 | #define alc262_capture_mixer alc882_capture_mixer |
| 10268 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10269 | |
| 10270 | /* |
| 10271 | * generic initialization of ADC, input mixers and output mixers |
| 10272 | */ |
| 10273 | static struct hda_verb alc262_init_verbs[] = { |
| 10274 | /* |
| 10275 | * Unmute ADC0-2 and set the default input to mic-in |
| 10276 | */ |
| 10277 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10278 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10279 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10280 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10281 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10282 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10283 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10284 | /* 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] | 10285 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10286 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10287 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10288 | */ |
| 10289 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10290 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10291 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10292 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10295 | |
| 10296 | /* |
| 10297 | * Set up output mixers (0x0c - 0x0e) |
| 10298 | */ |
| 10299 | /* set vol=0 to output mixers */ |
| 10300 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10301 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10302 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10303 | /* set up input amps for analog loopback */ |
| 10304 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10305 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10307 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10308 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10309 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10310 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10311 | |
| 10312 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10313 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10314 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10315 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10316 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10317 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10318 | |
| 10319 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10320 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10321 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10322 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10323 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10324 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10325 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10326 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10327 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10328 | /* FIXME: use matrix-type input source selection */ |
| 10329 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10330 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10331 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10332 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10333 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10334 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10335 | /* Input mixer2 */ |
| 10336 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10337 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10338 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10339 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10340 | /* Input mixer3 */ |
| 10341 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10342 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10343 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10344 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10345 | |
| 10346 | { } |
| 10347 | }; |
| 10348 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10349 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10350 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10351 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10352 | { } |
| 10353 | }; |
| 10354 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10355 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10356 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10357 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10358 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10359 | |
| 10360 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10361 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10362 | {} |
| 10363 | }; |
| 10364 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10365 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10366 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10367 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10368 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10369 | |
| 10370 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10371 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10372 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10373 | }; |
| 10374 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10375 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10376 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10377 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10378 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10379 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10380 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10381 | { } /* end */ |
| 10382 | }; |
| 10383 | |
| 10384 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10385 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10386 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10387 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10388 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10389 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10390 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10391 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10392 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10393 | {} |
| 10394 | }; |
| 10395 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10396 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10397 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10398 | struct alc_spec *spec = codec->spec; |
| 10399 | |
| 10400 | spec->autocfg.hp_pins[0] = 0x15; |
| 10401 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10402 | spec->ext_mic.pin = 0x18; |
| 10403 | spec->ext_mic.mux_idx = 0; |
| 10404 | spec->int_mic.pin = 0x12; |
| 10405 | spec->int_mic.mux_idx = 9; |
| 10406 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10407 | } |
| 10408 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10409 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10410 | * nec model |
| 10411 | * 0x15 = headphone |
| 10412 | * 0x16 = internal speaker |
| 10413 | * 0x18 = external mic |
| 10414 | */ |
| 10415 | |
| 10416 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10417 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10418 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10419 | |
| 10420 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10421 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10422 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10423 | |
| 10424 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10425 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10426 | { } /* end */ |
| 10427 | }; |
| 10428 | |
| 10429 | static struct hda_verb alc262_nec_verbs[] = { |
| 10430 | /* Unmute Speaker */ |
| 10431 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10432 | |
| 10433 | /* Headphone */ |
| 10434 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10435 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10436 | |
| 10437 | /* External mic to headphone */ |
| 10438 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10439 | /* External mic to speaker */ |
| 10440 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10441 | {} |
| 10442 | }; |
| 10443 | |
| 10444 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10445 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10446 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10447 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10448 | */ |
| 10449 | |
| 10450 | #define ALC_HP_EVENT 0x37 |
| 10451 | |
| 10452 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10453 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10454 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10455 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10456 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10457 | {} |
| 10458 | }; |
| 10459 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10460 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10461 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10462 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10463 | {} |
| 10464 | }; |
| 10465 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10466 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10467 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10468 | .items = { |
| 10469 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10470 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10471 | { "CD", 0x4 }, |
| 10472 | }, |
| 10473 | }; |
| 10474 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10475 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10476 | .num_items = 5, |
| 10477 | .items = { |
| 10478 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10479 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10480 | { "Line", 0x2 }, |
| 10481 | { "CD", 0x4 }, |
| 10482 | { "AUX IN", 0x6 }, |
| 10483 | }, |
| 10484 | }; |
| 10485 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10486 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10487 | .num_items = 4, |
| 10488 | .items = { |
| 10489 | { "Mic", 0x0 }, |
| 10490 | { "Front Mic", 0x2 }, |
| 10491 | { "Line", 0x1 }, |
| 10492 | { "CD", 0x4 }, |
| 10493 | }, |
| 10494 | }; |
| 10495 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10496 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10497 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10498 | { |
| 10499 | struct alc_spec *spec = codec->spec; |
| 10500 | unsigned int mute; |
| 10501 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10502 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10503 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10504 | /* need to execute and sync at first */ |
| 10505 | 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] | 10506 | /* check laptop HP jack */ |
| 10507 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10508 | AC_VERB_GET_PIN_SENSE, 0); |
| 10509 | /* need to execute and sync at first */ |
| 10510 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10511 | /* check docking HP jack */ |
| 10512 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10513 | AC_VERB_GET_PIN_SENSE, 0); |
| 10514 | if (present & AC_PINSENSE_PRESENCE) |
| 10515 | spec->jack_present = 1; |
| 10516 | else |
| 10517 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10518 | spec->sense_updated = 1; |
| 10519 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10520 | /* unmute internal speaker only if both HPs are unplugged and |
| 10521 | * master switch is on |
| 10522 | */ |
| 10523 | if (spec->jack_present) |
| 10524 | mute = HDA_AMP_MUTE; |
| 10525 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10526 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10527 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10528 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10529 | } |
| 10530 | |
| 10531 | /* unsolicited event for HP jack sensing */ |
| 10532 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10533 | unsigned int res) |
| 10534 | { |
| 10535 | if ((res >> 26) != ALC_HP_EVENT) |
| 10536 | return; |
| 10537 | alc262_fujitsu_automute(codec, 1); |
| 10538 | } |
| 10539 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10540 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10541 | { |
| 10542 | alc262_fujitsu_automute(codec, 1); |
| 10543 | } |
| 10544 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10545 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10546 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10547 | .ops = &snd_hda_bind_vol, |
| 10548 | .values = { |
| 10549 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10550 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10551 | 0 |
| 10552 | }, |
| 10553 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10554 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10555 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10556 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10557 | { |
| 10558 | struct alc_spec *spec = codec->spec; |
| 10559 | unsigned int mute; |
| 10560 | |
| 10561 | if (force || !spec->sense_updated) { |
| 10562 | unsigned int present_int_hp; |
| 10563 | /* need to execute and sync at first */ |
| 10564 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10565 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10566 | AC_VERB_GET_PIN_SENSE, 0); |
| 10567 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10568 | spec->sense_updated = 1; |
| 10569 | } |
| 10570 | if (spec->jack_present) { |
| 10571 | /* mute internal speaker */ |
| 10572 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10573 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10574 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10575 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10576 | } else { |
| 10577 | /* unmute internal speaker if necessary */ |
| 10578 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10579 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10580 | HDA_AMP_MUTE, mute); |
| 10581 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10582 | HDA_AMP_MUTE, mute); |
| 10583 | } |
| 10584 | } |
| 10585 | |
| 10586 | /* unsolicited event for HP jack sensing */ |
| 10587 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10588 | unsigned int res) |
| 10589 | { |
| 10590 | if ((res >> 26) != ALC_HP_EVENT) |
| 10591 | return; |
| 10592 | alc262_lenovo_3000_automute(codec, 1); |
| 10593 | } |
| 10594 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10595 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 10596 | int dir, int idx, long *valp) |
| 10597 | { |
| 10598 | int i, change = 0; |
| 10599 | |
| 10600 | for (i = 0; i < 2; i++, valp++) |
| 10601 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 10602 | HDA_AMP_MUTE, |
| 10603 | *valp ? 0 : HDA_AMP_MUTE); |
| 10604 | return change; |
| 10605 | } |
| 10606 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10607 | /* bind hp and internal speaker mute (with plug check) */ |
| 10608 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10609 | struct snd_ctl_elem_value *ucontrol) |
| 10610 | { |
| 10611 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10612 | long *valp = ucontrol->value.integer.value; |
| 10613 | int change; |
| 10614 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10615 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 10616 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10617 | if (change) |
| 10618 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10619 | return change; |
| 10620 | } |
| 10621 | |
| 10622 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10623 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10624 | { |
| 10625 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10626 | .name = "Master Playback Switch", |
| 10627 | .info = snd_hda_mixer_amp_switch_info, |
| 10628 | .get = snd_hda_mixer_amp_switch_get, |
| 10629 | .put = alc262_fujitsu_master_sw_put, |
| 10630 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10631 | }, |
| 10632 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10633 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10634 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10635 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10636 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10637 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10638 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10639 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10640 | { } /* end */ |
| 10641 | }; |
| 10642 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10643 | /* bind hp and internal speaker mute (with plug check) */ |
| 10644 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10645 | struct snd_ctl_elem_value *ucontrol) |
| 10646 | { |
| 10647 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10648 | long *valp = ucontrol->value.integer.value; |
| 10649 | int change; |
| 10650 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10651 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10652 | if (change) |
| 10653 | alc262_lenovo_3000_automute(codec, 0); |
| 10654 | return change; |
| 10655 | } |
| 10656 | |
| 10657 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10658 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10659 | { |
| 10660 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10661 | .name = "Master Playback Switch", |
| 10662 | .info = snd_hda_mixer_amp_switch_info, |
| 10663 | .get = snd_hda_mixer_amp_switch_get, |
| 10664 | .put = alc262_lenovo_3000_master_sw_put, |
| 10665 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10666 | }, |
| 10667 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10668 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10669 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10670 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10671 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10672 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10673 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10674 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10675 | { } /* end */ |
| 10676 | }; |
| 10677 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10678 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10679 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10680 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10681 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10682 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10683 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10684 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10685 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10686 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10687 | { } /* end */ |
| 10688 | }; |
| 10689 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10690 | /* additional init verbs for Benq laptops */ |
| 10691 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10692 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10693 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10694 | {} |
| 10695 | }; |
| 10696 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10697 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10698 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10699 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10700 | |
| 10701 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10702 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10703 | {} |
| 10704 | }; |
| 10705 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10706 | /* Samsung Q1 Ultra Vista model setup */ |
| 10707 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10708 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10709 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10710 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10711 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10712 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10713 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10714 | { } /* end */ |
| 10715 | }; |
| 10716 | |
| 10717 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10718 | /* output mixer */ |
| 10719 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10720 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10721 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10722 | /* speaker */ |
| 10723 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10724 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10725 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10726 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10727 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10728 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10729 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10730 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10731 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10732 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10733 | /* internal mic */ |
| 10734 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10735 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10736 | /* ADC, choose mic */ |
| 10737 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10738 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10739 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10740 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10741 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10742 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10743 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10744 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10745 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10746 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10747 | {} |
| 10748 | }; |
| 10749 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10750 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10751 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10752 | { |
| 10753 | struct alc_spec *spec = codec->spec; |
| 10754 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10755 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10756 | mute = 0; |
| 10757 | /* auto-mute only when HP is used as HP */ |
| 10758 | if (!spec->cur_mux[0]) { |
| 10759 | unsigned int present; |
| 10760 | /* need to execute and sync at first */ |
| 10761 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10762 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10763 | AC_VERB_GET_PIN_SENSE, 0); |
| 10764 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10765 | if (spec->jack_present) |
| 10766 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10767 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10768 | /* mute/unmute internal speaker */ |
| 10769 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10770 | HDA_AMP_MUTE, mute); |
| 10771 | /* mute/unmute HP */ |
| 10772 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10773 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10774 | } |
| 10775 | |
| 10776 | /* unsolicited event for HP jack sensing */ |
| 10777 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10778 | unsigned int res) |
| 10779 | { |
| 10780 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10781 | return; |
| 10782 | alc262_ultra_automute(codec); |
| 10783 | } |
| 10784 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10785 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10786 | .num_items = 2, |
| 10787 | .items = { |
| 10788 | { "Mic", 0x1 }, |
| 10789 | { "Headphone", 0x7 }, |
| 10790 | }, |
| 10791 | }; |
| 10792 | |
| 10793 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10794 | struct snd_ctl_elem_value *ucontrol) |
| 10795 | { |
| 10796 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10797 | struct alc_spec *spec = codec->spec; |
| 10798 | int ret; |
| 10799 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10800 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10801 | if (!ret) |
| 10802 | return 0; |
| 10803 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10804 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10805 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10806 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10807 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10808 | return ret; |
| 10809 | } |
| 10810 | |
| 10811 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10812 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10813 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10814 | { |
| 10815 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10816 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10817 | .info = alc_mux_enum_info, |
| 10818 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10819 | .put = alc262_ultra_mux_enum_put, |
| 10820 | }, |
| 10821 | { } /* end */ |
| 10822 | }; |
| 10823 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 10824 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 10825 | * and thus it's bound with a different mixer. |
| 10826 | * This function returns which mixer amp should be used. |
| 10827 | */ |
| 10828 | static int alc262_check_volbit(hda_nid_t nid) |
| 10829 | { |
| 10830 | if (!nid) |
| 10831 | return 0; |
| 10832 | else if (nid == 0x16) |
| 10833 | return 2; |
| 10834 | else |
| 10835 | return 1; |
| 10836 | } |
| 10837 | |
| 10838 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 10839 | const char *pfx, int *vbits) |
| 10840 | { |
| 10841 | char name[32]; |
| 10842 | unsigned long val; |
| 10843 | int vbit; |
| 10844 | |
| 10845 | vbit = alc262_check_volbit(nid); |
| 10846 | if (!vbit) |
| 10847 | return 0; |
| 10848 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 10849 | return 0; |
| 10850 | *vbits |= vbit; |
| 10851 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 10852 | if (vbit == 2) |
| 10853 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 10854 | else |
| 10855 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
| 10856 | return add_control(spec, ALC_CTL_WIDGET_VOL, name, val); |
| 10857 | } |
| 10858 | |
| 10859 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 10860 | const char *pfx) |
| 10861 | { |
| 10862 | char name[32]; |
| 10863 | unsigned long val; |
| 10864 | |
| 10865 | if (!nid) |
| 10866 | return 0; |
| 10867 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 10868 | if (nid == 0x16) |
| 10869 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 10870 | else |
| 10871 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 10872 | return add_control(spec, ALC_CTL_WIDGET_MUTE, name, val); |
| 10873 | } |
| 10874 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10875 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10876 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10877 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10878 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 10879 | const char *pfx; |
| 10880 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10881 | int err; |
| 10882 | |
| 10883 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10884 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10885 | spec->multiout.dac_nids[0] = 2; |
| 10886 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 10887 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 10888 | pfx = "Master"; |
| 10889 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 10890 | pfx = "Speaker"; |
| 10891 | else |
| 10892 | pfx = "Front"; |
| 10893 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 10894 | if (err < 0) |
| 10895 | return err; |
| 10896 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 10897 | if (err < 0) |
| 10898 | return err; |
| 10899 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 10900 | if (err < 0) |
| 10901 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10902 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 10903 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 10904 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 10905 | alc262_check_volbit(cfg->hp_pins[0]); |
| 10906 | if (vbits == 1 || vbits == 2) |
| 10907 | pfx = "Master"; /* only one mixer is used */ |
| 10908 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 10909 | pfx = "Speaker"; |
| 10910 | else |
| 10911 | pfx = "Front"; |
| 10912 | vbits = 0; |
| 10913 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 10914 | if (err < 0) |
| 10915 | return err; |
| 10916 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 10917 | &vbits); |
| 10918 | if (err < 0) |
| 10919 | return err; |
| 10920 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 10921 | &vbits); |
| 10922 | if (err < 0) |
| 10923 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10924 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10925 | } |
| 10926 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10927 | #define alc262_auto_create_input_ctls \ |
| 10928 | alc880_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10929 | |
| 10930 | /* |
| 10931 | * generic initialization of ADC, input mixers and output mixers |
| 10932 | */ |
| 10933 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10934 | /* |
| 10935 | * Unmute ADC0-2 and set the default input to mic-in |
| 10936 | */ |
| 10937 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10938 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10939 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10940 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10941 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10942 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10943 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10944 | /* 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] | 10945 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10946 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10947 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10948 | */ |
| 10949 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10950 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10951 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10952 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10953 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10954 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10955 | |
| 10956 | /* |
| 10957 | * Set up output mixers (0x0c - 0x0f) |
| 10958 | */ |
| 10959 | /* set vol=0 to output mixers */ |
| 10960 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10961 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10962 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10963 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10964 | /* set up input amps for analog loopback */ |
| 10965 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10966 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10967 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10968 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10969 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10970 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10971 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10972 | |
| 10973 | /* FIXME: use matrix-type input source selection */ |
| 10974 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10975 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10976 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10977 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10978 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10979 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10980 | /* Input mixer2 */ |
| 10981 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10982 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10983 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10984 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10985 | /* Input mixer3 */ |
| 10986 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10987 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10988 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10989 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10990 | |
| 10991 | { } |
| 10992 | }; |
| 10993 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10994 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10995 | /* |
| 10996 | * Unmute ADC0-2 and set the default input to mic-in |
| 10997 | */ |
| 10998 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10999 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11000 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11001 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11002 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11003 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11004 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11005 | /* 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] | 11006 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11007 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11008 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11009 | */ |
| 11010 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11011 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11012 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11013 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11014 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11015 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11016 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11017 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11018 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11019 | /* |
| 11020 | * Set up output mixers (0x0c - 0x0e) |
| 11021 | */ |
| 11022 | /* set vol=0 to output mixers */ |
| 11023 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11024 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11025 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11026 | |
| 11027 | /* set up input amps for analog loopback */ |
| 11028 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11029 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11030 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11031 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11032 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11033 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11034 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11035 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11036 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11037 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11038 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11039 | |
| 11040 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11041 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11042 | |
| 11043 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11044 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11045 | |
| 11046 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11047 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11048 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11049 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11050 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11051 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11052 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11053 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11054 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11055 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11056 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11057 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11058 | |
| 11059 | |
| 11060 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11061 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11062 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11063 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11064 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11065 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11066 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11067 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11068 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11069 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11070 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11071 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11072 | /* Input mixer2 */ |
| 11073 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11074 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11075 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11076 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11077 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11078 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11079 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11080 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11081 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11082 | /* Input mixer3 */ |
| 11083 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11084 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11087 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11088 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11089 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11090 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11091 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11092 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11093 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11094 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11095 | { } |
| 11096 | }; |
| 11097 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11098 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11099 | /* |
| 11100 | * Unmute ADC0-2 and set the default input to mic-in |
| 11101 | */ |
| 11102 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11103 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11104 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11105 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11106 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11107 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11108 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11109 | /* 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] | 11110 | * mixer widget |
| 11111 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11112 | * panel mic (mic 2) |
| 11113 | */ |
| 11114 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11118 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11119 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11120 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11121 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11122 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11123 | /* |
| 11124 | * Set up output mixers (0x0c - 0x0e) |
| 11125 | */ |
| 11126 | /* set vol=0 to output mixers */ |
| 11127 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11128 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11129 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11130 | |
| 11131 | /* set up input amps for analog loopback */ |
| 11132 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11133 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11134 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11135 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11136 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11137 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11138 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11139 | |
| 11140 | |
| 11141 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11142 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11143 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11144 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11145 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11146 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11147 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11148 | |
| 11149 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11150 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11151 | |
| 11152 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11153 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11154 | |
| 11155 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11156 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11157 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11158 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11159 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11160 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11161 | |
| 11162 | /* FIXME: use matrix-type input source selection */ |
| 11163 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11164 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11165 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11166 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11167 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11168 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11169 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11170 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11171 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11172 | /* Input mixer2 */ |
| 11173 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11174 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11175 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11176 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11177 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11178 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11179 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11180 | /* Input mixer3 */ |
| 11181 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11182 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11183 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11185 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11186 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11187 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11188 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11189 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11190 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11191 | { } |
| 11192 | }; |
| 11193 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11194 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11195 | |
| 11196 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11197 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11198 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11199 | |
| 11200 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11201 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11202 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11203 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11204 | |
| 11205 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11206 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11207 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11208 | {} |
| 11209 | }; |
| 11210 | |
| 11211 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11212 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11213 | #define alc262_loopbacks alc880_loopbacks |
| 11214 | #endif |
| 11215 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11216 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11217 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11218 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11219 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11220 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11221 | |
| 11222 | /* |
| 11223 | * BIOS auto configuration |
| 11224 | */ |
| 11225 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11226 | { |
| 11227 | struct alc_spec *spec = codec->spec; |
| 11228 | int err; |
| 11229 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11230 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11231 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11232 | alc262_ignore); |
| 11233 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11234 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11235 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11236 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11237 | spec->multiout.max_channels = 2; |
| 11238 | spec->no_analog = 1; |
| 11239 | goto dig_only; |
| 11240 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11241 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11242 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11243 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11244 | if (err < 0) |
| 11245 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11246 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11247 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11248 | return err; |
| 11249 | |
| 11250 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11251 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11252 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11253 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11254 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11255 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11256 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11257 | if (spec->autocfg.dig_in_pin) |
| 11258 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11259 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11260 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11261 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11262 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11263 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11264 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11265 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11266 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11267 | err = alc_auto_add_mic_boost(codec); |
| 11268 | if (err < 0) |
| 11269 | return err; |
| 11270 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11271 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11272 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11273 | return 1; |
| 11274 | } |
| 11275 | |
| 11276 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11277 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11278 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11279 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11280 | |
| 11281 | |
| 11282 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11283 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11284 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11285 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11286 | alc262_auto_init_multi_out(codec); |
| 11287 | alc262_auto_init_hp_out(codec); |
| 11288 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11289 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11290 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11291 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11292 | } |
| 11293 | |
| 11294 | /* |
| 11295 | * configuration and preset |
| 11296 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11297 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11298 | [ALC262_BASIC] = "basic", |
| 11299 | [ALC262_HIPPO] = "hippo", |
| 11300 | [ALC262_HIPPO_1] = "hippo_1", |
| 11301 | [ALC262_FUJITSU] = "fujitsu", |
| 11302 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11303 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11304 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11305 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11306 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11307 | [ALC262_BENQ_T31] = "benq-t31", |
| 11308 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11309 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11310 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11311 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11312 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11313 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11314 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11315 | [ALC262_AUTO] = "auto", |
| 11316 | }; |
| 11317 | |
| 11318 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11319 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11320 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11321 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11322 | ALC262_HP_BPC), |
| 11323 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11324 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11325 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11326 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11327 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11328 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11329 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11330 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11331 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11332 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11333 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11334 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11335 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11336 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11337 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11338 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11339 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11340 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11341 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11342 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11343 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11344 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11345 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11346 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11347 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11348 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11349 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11350 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11351 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11352 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11353 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11354 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11355 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11356 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11357 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11358 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11359 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11360 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11361 | {} |
| 11362 | }; |
| 11363 | |
| 11364 | static struct alc_config_preset alc262_presets[] = { |
| 11365 | [ALC262_BASIC] = { |
| 11366 | .mixers = { alc262_base_mixer }, |
| 11367 | .init_verbs = { alc262_init_verbs }, |
| 11368 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11369 | .dac_nids = alc262_dac_nids, |
| 11370 | .hp_nid = 0x03, |
| 11371 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11372 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11373 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11374 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11375 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11376 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11377 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11378 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11379 | .dac_nids = alc262_dac_nids, |
| 11380 | .hp_nid = 0x03, |
| 11381 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11382 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11383 | .channel_mode = alc262_modes, |
| 11384 | .input_mux = &alc262_capture_source, |
| 11385 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11386 | .setup = alc262_hippo_setup, |
| 11387 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11388 | }, |
| 11389 | [ALC262_HIPPO_1] = { |
| 11390 | .mixers = { alc262_hippo1_mixer }, |
| 11391 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11392 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11393 | .dac_nids = alc262_dac_nids, |
| 11394 | .hp_nid = 0x02, |
| 11395 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11396 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11397 | .channel_mode = alc262_modes, |
| 11398 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11399 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11400 | .setup = alc262_hippo1_setup, |
| 11401 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11402 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11403 | [ALC262_FUJITSU] = { |
| 11404 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11405 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11406 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11407 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11408 | .dac_nids = alc262_dac_nids, |
| 11409 | .hp_nid = 0x03, |
| 11410 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11411 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11412 | .channel_mode = alc262_modes, |
| 11413 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11414 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11415 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11416 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11417 | [ALC262_HP_BPC] = { |
| 11418 | .mixers = { alc262_HP_BPC_mixer }, |
| 11419 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11420 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11421 | .dac_nids = alc262_dac_nids, |
| 11422 | .hp_nid = 0x03, |
| 11423 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11424 | .channel_mode = alc262_modes, |
| 11425 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11426 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11427 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11428 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11429 | [ALC262_HP_BPC_D7000_WF] = { |
| 11430 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11431 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11432 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11433 | .dac_nids = alc262_dac_nids, |
| 11434 | .hp_nid = 0x03, |
| 11435 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11436 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11437 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11438 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11439 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11440 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11441 | [ALC262_HP_BPC_D7000_WL] = { |
| 11442 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11443 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11444 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11445 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11446 | .dac_nids = alc262_dac_nids, |
| 11447 | .hp_nid = 0x03, |
| 11448 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11449 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11450 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11451 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11452 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11453 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11454 | [ALC262_HP_TC_T5735] = { |
| 11455 | .mixers = { alc262_hp_t5735_mixer }, |
| 11456 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11457 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11458 | .dac_nids = alc262_dac_nids, |
| 11459 | .hp_nid = 0x03, |
| 11460 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11461 | .channel_mode = alc262_modes, |
| 11462 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11463 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11464 | .setup = alc262_hp_t5735_setup, |
| 11465 | .init_hook = alc_automute_amp, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11466 | }, |
| 11467 | [ALC262_HP_RP5700] = { |
| 11468 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11469 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11470 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11471 | .dac_nids = alc262_dac_nids, |
| 11472 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11473 | .channel_mode = alc262_modes, |
| 11474 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11475 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11476 | [ALC262_BENQ_ED8] = { |
| 11477 | .mixers = { alc262_base_mixer }, |
| 11478 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11479 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11480 | .dac_nids = alc262_dac_nids, |
| 11481 | .hp_nid = 0x03, |
| 11482 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11483 | .channel_mode = alc262_modes, |
| 11484 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11485 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11486 | [ALC262_SONY_ASSAMD] = { |
| 11487 | .mixers = { alc262_sony_mixer }, |
| 11488 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11489 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11490 | .dac_nids = alc262_dac_nids, |
| 11491 | .hp_nid = 0x02, |
| 11492 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11493 | .channel_mode = alc262_modes, |
| 11494 | .input_mux = &alc262_capture_source, |
| 11495 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11496 | .setup = alc262_hippo_setup, |
| 11497 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11498 | }, |
| 11499 | [ALC262_BENQ_T31] = { |
| 11500 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11501 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 11502 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11503 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11504 | .dac_nids = alc262_dac_nids, |
| 11505 | .hp_nid = 0x03, |
| 11506 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11507 | .channel_mode = alc262_modes, |
| 11508 | .input_mux = &alc262_capture_source, |
| 11509 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11510 | .setup = alc262_hippo_setup, |
| 11511 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11512 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11513 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11514 | .mixers = { alc262_ultra_mixer }, |
| 11515 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11516 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11517 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11518 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11519 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11520 | .channel_mode = alc262_modes, |
| 11521 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11522 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11523 | .capsrc_nids = alc262_capsrc_nids, |
| 11524 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11525 | .unsol_event = alc262_ultra_unsol_event, |
| 11526 | .init_hook = alc262_ultra_automute, |
| 11527 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11528 | [ALC262_LENOVO_3000] = { |
| 11529 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11530 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11531 | alc262_lenovo_3000_unsol_verbs }, |
| 11532 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11533 | .dac_nids = alc262_dac_nids, |
| 11534 | .hp_nid = 0x03, |
| 11535 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11536 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11537 | .channel_mode = alc262_modes, |
| 11538 | .input_mux = &alc262_fujitsu_capture_source, |
| 11539 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11540 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11541 | [ALC262_NEC] = { |
| 11542 | .mixers = { alc262_nec_mixer }, |
| 11543 | .init_verbs = { alc262_nec_verbs }, |
| 11544 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11545 | .dac_nids = alc262_dac_nids, |
| 11546 | .hp_nid = 0x03, |
| 11547 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11548 | .channel_mode = alc262_modes, |
| 11549 | .input_mux = &alc262_capture_source, |
| 11550 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11551 | [ALC262_TOSHIBA_S06] = { |
| 11552 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11553 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11554 | alc262_eapd_verbs }, |
| 11555 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11556 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11557 | .dac_nids = alc262_dac_nids, |
| 11558 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11559 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11560 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11561 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11562 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11563 | .unsol_event = alc_sku_unsol_event, |
| 11564 | .setup = alc262_toshiba_s06_setup, |
| 11565 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11566 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11567 | [ALC262_TOSHIBA_RX1] = { |
| 11568 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11569 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11570 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11571 | .dac_nids = alc262_dac_nids, |
| 11572 | .hp_nid = 0x03, |
| 11573 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11574 | .channel_mode = alc262_modes, |
| 11575 | .input_mux = &alc262_capture_source, |
| 11576 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11577 | .setup = alc262_hippo_setup, |
| 11578 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11579 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11580 | [ALC262_TYAN] = { |
| 11581 | .mixers = { alc262_tyan_mixer }, |
| 11582 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11583 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11584 | .dac_nids = alc262_dac_nids, |
| 11585 | .hp_nid = 0x02, |
| 11586 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11587 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11588 | .channel_mode = alc262_modes, |
| 11589 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11590 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11591 | .setup = alc262_tyan_setup, |
| 11592 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11593 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11594 | }; |
| 11595 | |
| 11596 | static int patch_alc262(struct hda_codec *codec) |
| 11597 | { |
| 11598 | struct alc_spec *spec; |
| 11599 | int board_config; |
| 11600 | int err; |
| 11601 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11602 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11603 | if (spec == NULL) |
| 11604 | return -ENOMEM; |
| 11605 | |
| 11606 | codec->spec = spec; |
| 11607 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11608 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11609 | * under-run |
| 11610 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11611 | { |
| 11612 | int tmp; |
| 11613 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11614 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11615 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11616 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11617 | } |
| 11618 | #endif |
| 11619 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11620 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11621 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11622 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11623 | alc262_models, |
| 11624 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11625 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11626 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11627 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 11628 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11629 | board_config = ALC262_AUTO; |
| 11630 | } |
| 11631 | |
| 11632 | if (board_config == ALC262_AUTO) { |
| 11633 | /* automatic parse from the BIOS config */ |
| 11634 | err = alc262_parse_auto_config(codec); |
| 11635 | if (err < 0) { |
| 11636 | alc_free(codec); |
| 11637 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11638 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11639 | printk(KERN_INFO |
| 11640 | "hda_codec: Cannot set up configuration " |
| 11641 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11642 | board_config = ALC262_BASIC; |
| 11643 | } |
| 11644 | } |
| 11645 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11646 | if (!spec->no_analog) { |
| 11647 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11648 | if (err < 0) { |
| 11649 | alc_free(codec); |
| 11650 | return err; |
| 11651 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11652 | } |
| 11653 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11654 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11655 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11656 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11657 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11658 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11659 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11660 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11661 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11662 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11663 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11664 | int i; |
| 11665 | /* check whether the digital-mic has to be supported */ |
| 11666 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11667 | if (spec->input_mux->items[i].index >= 9) |
| 11668 | break; |
| 11669 | } |
| 11670 | if (i < spec->input_mux->num_items) { |
| 11671 | /* use only ADC0 */ |
| 11672 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11673 | spec->num_adc_nids = 1; |
| 11674 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11675 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11676 | /* all analog inputs */ |
| 11677 | /* check whether NID 0x07 is valid */ |
| 11678 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11679 | |
| 11680 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11681 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11682 | if (wcap != AC_WID_AUD_IN) { |
| 11683 | spec->adc_nids = alc262_adc_nids_alt; |
| 11684 | spec->num_adc_nids = |
| 11685 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11686 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11687 | } else { |
| 11688 | spec->adc_nids = alc262_adc_nids; |
| 11689 | spec->num_adc_nids = |
| 11690 | ARRAY_SIZE(alc262_adc_nids); |
| 11691 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11692 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11693 | } |
| 11694 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11695 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11696 | set_capture_mixer(codec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11697 | if (!spec->no_analog) |
| 11698 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11699 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11700 | spec->vmaster_nid = 0x0c; |
| 11701 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11702 | codec->patch_ops = alc_patch_ops; |
| 11703 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11704 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11705 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11706 | if (!spec->loopback.amplist) |
| 11707 | spec->loopback.amplist = alc262_loopbacks; |
| 11708 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11709 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11710 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11711 | return 0; |
| 11712 | } |
| 11713 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11714 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11715 | * ALC268 channel source setting (2 channel) |
| 11716 | */ |
| 11717 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11718 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11719 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11720 | static hda_nid_t alc268_dac_nids[2] = { |
| 11721 | /* front, hp */ |
| 11722 | 0x02, 0x03 |
| 11723 | }; |
| 11724 | |
| 11725 | static hda_nid_t alc268_adc_nids[2] = { |
| 11726 | /* ADC0-1 */ |
| 11727 | 0x08, 0x07 |
| 11728 | }; |
| 11729 | |
| 11730 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11731 | /* ADC0 */ |
| 11732 | 0x08 |
| 11733 | }; |
| 11734 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11735 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11736 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11737 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11738 | /* output mixer control */ |
| 11739 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11740 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11741 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11742 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11743 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11744 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11745 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11746 | { } |
| 11747 | }; |
| 11748 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11749 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11750 | /* output mixer control */ |
| 11751 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11752 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11753 | ALC262_HIPPO_MASTER_SWITCH, |
| 11754 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11755 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11756 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11757 | { } |
| 11758 | }; |
| 11759 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11760 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11761 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11762 | .ops = &snd_hda_bind_sw, |
| 11763 | .values = { |
| 11764 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11765 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11766 | 0 |
| 11767 | }, |
| 11768 | }; |
| 11769 | |
| 11770 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11771 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11772 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11773 | { } |
| 11774 | }; |
| 11775 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11776 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11777 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11778 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11779 | { } |
| 11780 | }; |
| 11781 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11782 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11783 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11784 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11785 | { } /* end */ |
| 11786 | }; |
| 11787 | |
| 11788 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11789 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11790 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11791 | .ops = &snd_hda_bind_vol, |
| 11792 | .values = { |
| 11793 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11794 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11795 | 0 |
| 11796 | }, |
| 11797 | }; |
| 11798 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11799 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11800 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11801 | { |
| 11802 | struct alc_spec *spec = codec->spec; |
| 11803 | unsigned int mute; |
| 11804 | |
| 11805 | if (force || !spec->sense_updated) { |
| 11806 | unsigned int present; |
| 11807 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11808 | AC_VERB_GET_PIN_SENSE, 0); |
| 11809 | spec->jack_present = (present & 0x80000000) != 0; |
| 11810 | spec->sense_updated = 1; |
| 11811 | } |
| 11812 | if (spec->jack_present) |
| 11813 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11814 | else /* unmute internal speaker if necessary */ |
| 11815 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11816 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11817 | HDA_AMP_MUTE, mute); |
| 11818 | } |
| 11819 | |
| 11820 | |
| 11821 | /* bind hp and internal speaker mute (with plug check) */ |
| 11822 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11823 | struct snd_ctl_elem_value *ucontrol) |
| 11824 | { |
| 11825 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11826 | long *valp = ucontrol->value.integer.value; |
| 11827 | int change; |
| 11828 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11829 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11830 | if (change) |
| 11831 | alc268_acer_automute(codec, 0); |
| 11832 | return change; |
| 11833 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11834 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11835 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11836 | /* output mixer control */ |
| 11837 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11838 | { |
| 11839 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11840 | .name = "Master Playback Switch", |
| 11841 | .info = snd_hda_mixer_amp_switch_info, |
| 11842 | .get = snd_hda_mixer_amp_switch_get, |
| 11843 | .put = alc268_acer_master_sw_put, |
| 11844 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11845 | }, |
| 11846 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11847 | { } |
| 11848 | }; |
| 11849 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11850 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11851 | /* output mixer control */ |
| 11852 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11853 | { |
| 11854 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11855 | .name = "Master Playback Switch", |
| 11856 | .info = snd_hda_mixer_amp_switch_info, |
| 11857 | .get = snd_hda_mixer_amp_switch_get, |
| 11858 | .put = alc268_acer_master_sw_put, |
| 11859 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11860 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11861 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11862 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11863 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11864 | { } |
| 11865 | }; |
| 11866 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11867 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11868 | /* output mixer control */ |
| 11869 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11870 | { |
| 11871 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11872 | .name = "Master Playback Switch", |
| 11873 | .info = snd_hda_mixer_amp_switch_info, |
| 11874 | .get = snd_hda_mixer_amp_switch_get, |
| 11875 | .put = alc268_acer_master_sw_put, |
| 11876 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11877 | }, |
| 11878 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11879 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11880 | { } |
| 11881 | }; |
| 11882 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11883 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11884 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11885 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11886 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11887 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11888 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11889 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11890 | { } |
| 11891 | }; |
| 11892 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11893 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11894 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11895 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11896 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11897 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11898 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11899 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11900 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11901 | { } |
| 11902 | }; |
| 11903 | |
| 11904 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11905 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11906 | #define alc268_toshiba_setup alc262_hippo_setup |
| 11907 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11908 | |
| 11909 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11910 | unsigned int res) |
| 11911 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11912 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11913 | return; |
| 11914 | alc268_acer_automute(codec, 1); |
| 11915 | } |
| 11916 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11917 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11918 | { |
| 11919 | alc268_acer_automute(codec, 1); |
| 11920 | } |
| 11921 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11922 | /* toggle speaker-output according to the hp-jack state */ |
| 11923 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11924 | { |
| 11925 | unsigned int present; |
| 11926 | unsigned char bits; |
| 11927 | |
| 11928 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11929 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11930 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11931 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11932 | AMP_IN_MUTE(0), bits); |
| 11933 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11934 | AMP_IN_MUTE(0), bits); |
| 11935 | } |
| 11936 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11937 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11938 | unsigned int res) |
| 11939 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11940 | switch (res >> 26) { |
| 11941 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11942 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11943 | break; |
| 11944 | case ALC880_MIC_EVENT: |
| 11945 | alc_mic_automute(codec); |
| 11946 | break; |
| 11947 | } |
| 11948 | } |
| 11949 | |
| 11950 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 11951 | { |
| 11952 | struct alc_spec *spec = codec->spec; |
| 11953 | spec->ext_mic.pin = 0x18; |
| 11954 | spec->ext_mic.mux_idx = 0; |
| 11955 | spec->int_mic.pin = 0x12; |
| 11956 | spec->int_mic.mux_idx = 6; |
| 11957 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11958 | } |
| 11959 | |
| 11960 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11961 | { |
| 11962 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11963 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11964 | } |
| 11965 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11966 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11967 | /* output mixer control */ |
| 11968 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11969 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11970 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11971 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11972 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11973 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11974 | { } |
| 11975 | }; |
| 11976 | |
| 11977 | static struct hda_verb alc268_dell_verbs[] = { |
| 11978 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11979 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11980 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11981 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11982 | { } |
| 11983 | }; |
| 11984 | |
| 11985 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11986 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11987 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11988 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11989 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11990 | spec->autocfg.hp_pins[0] = 0x15; |
| 11991 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11992 | spec->ext_mic.pin = 0x18; |
| 11993 | spec->ext_mic.mux_idx = 0; |
| 11994 | spec->int_mic.pin = 0x19; |
| 11995 | spec->int_mic.mux_idx = 1; |
| 11996 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11997 | } |
| 11998 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11999 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12000 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12001 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12002 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12003 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12004 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12005 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12006 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12007 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12008 | { } |
| 12009 | }; |
| 12010 | |
| 12011 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12012 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12013 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12014 | { } |
| 12015 | }; |
| 12016 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12017 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12018 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12019 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12020 | spec->autocfg.hp_pins[0] = 0x15; |
| 12021 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12022 | spec->ext_mic.pin = 0x18; |
| 12023 | spec->ext_mic.mux_idx = 0; |
| 12024 | spec->int_mic.pin = 0x19; |
| 12025 | spec->int_mic.mux_idx = 1; |
| 12026 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12027 | } |
| 12028 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12029 | /* |
| 12030 | * generic initialization of ADC, input mixers and output mixers |
| 12031 | */ |
| 12032 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12033 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12034 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12035 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12036 | |
| 12037 | /* |
| 12038 | * Set up output mixers (0x0c - 0x0e) |
| 12039 | */ |
| 12040 | /* set vol=0 to output mixers */ |
| 12041 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12042 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12043 | |
| 12044 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12045 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12046 | |
| 12047 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12048 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12049 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12050 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12051 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12052 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12053 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12054 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12055 | |
| 12056 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12057 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12058 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12059 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12060 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12061 | |
| 12062 | /* set PCBEEP vol = 0, mute connections */ |
| 12063 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12064 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12065 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12066 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12067 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12068 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12069 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12070 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12071 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12072 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12073 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12074 | { } |
| 12075 | }; |
| 12076 | |
| 12077 | /* |
| 12078 | * generic initialization of ADC, input mixers and output mixers |
| 12079 | */ |
| 12080 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12081 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12082 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12083 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12084 | |
| 12085 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12086 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12087 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12088 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12089 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12090 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12091 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12092 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12093 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12094 | |
| 12095 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12096 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12097 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12098 | /* set PCBEEP vol = 0, mute connections */ |
| 12099 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12100 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12101 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12102 | |
| 12103 | { } |
| 12104 | }; |
| 12105 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12106 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12107 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12108 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12109 | { } /* end */ |
| 12110 | }; |
| 12111 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12112 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12113 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12114 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12115 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12116 | { } /* end */ |
| 12117 | }; |
| 12118 | |
| 12119 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12120 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12121 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12122 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12123 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12124 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12125 | { } /* end */ |
| 12126 | }; |
| 12127 | |
| 12128 | static struct hda_input_mux alc268_capture_source = { |
| 12129 | .num_items = 4, |
| 12130 | .items = { |
| 12131 | { "Mic", 0x0 }, |
| 12132 | { "Front Mic", 0x1 }, |
| 12133 | { "Line", 0x2 }, |
| 12134 | { "CD", 0x3 }, |
| 12135 | }, |
| 12136 | }; |
| 12137 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12138 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12139 | .num_items = 3, |
| 12140 | .items = { |
| 12141 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12142 | { "Internal Mic", 0x1 }, |
| 12143 | { "Line", 0x2 }, |
| 12144 | }, |
| 12145 | }; |
| 12146 | |
| 12147 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12148 | .num_items = 3, |
| 12149 | .items = { |
| 12150 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12151 | { "Internal Mic", 0x6 }, |
| 12152 | { "Line", 0x2 }, |
| 12153 | }, |
| 12154 | }; |
| 12155 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12156 | #ifdef CONFIG_SND_DEBUG |
| 12157 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12158 | /* Volume widgets */ |
| 12159 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12160 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12161 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12162 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12163 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12164 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12165 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12166 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12167 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12168 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12169 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12170 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12171 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12172 | /* The below appears problematic on some hardwares */ |
| 12173 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12174 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12175 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12176 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12177 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12178 | |
| 12179 | /* Modes for retasking pin widgets */ |
| 12180 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12181 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12182 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12183 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12184 | |
| 12185 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12186 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12187 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12188 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12189 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12190 | |
| 12191 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12192 | * The ALC268 does not have an SPDIF input. |
| 12193 | */ |
| 12194 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12195 | |
| 12196 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12197 | * this output to turn on an external amplifier. |
| 12198 | */ |
| 12199 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12200 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12201 | |
| 12202 | { } /* end */ |
| 12203 | }; |
| 12204 | #endif |
| 12205 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12206 | /* create input playback/capture controls for the given pin */ |
| 12207 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12208 | const char *ctlname, int idx) |
| 12209 | { |
| 12210 | char name[32]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12211 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12212 | int err; |
| 12213 | |
| 12214 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12215 | switch (nid) { |
| 12216 | case 0x14: |
| 12217 | case 0x16: |
| 12218 | dac = 0x02; |
| 12219 | break; |
| 12220 | case 0x15: |
| 12221 | dac = 0x03; |
| 12222 | break; |
| 12223 | default: |
| 12224 | return 0; |
| 12225 | } |
| 12226 | if (spec->multiout.dac_nids[0] != dac && |
| 12227 | spec->multiout.dac_nids[1] != dac) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12228 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12229 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12230 | HDA_OUTPUT)); |
| 12231 | if (err < 0) |
| 12232 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12233 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12234 | } |
| 12235 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12236 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12237 | if (nid != 0x16) |
| 12238 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12239 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12240 | else /* mono */ |
| 12241 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12242 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12243 | if (err < 0) |
| 12244 | return err; |
| 12245 | return 0; |
| 12246 | } |
| 12247 | |
| 12248 | /* add playback controls from the parsed DAC table */ |
| 12249 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12250 | const struct auto_pin_cfg *cfg) |
| 12251 | { |
| 12252 | hda_nid_t nid; |
| 12253 | int err; |
| 12254 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12255 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12256 | |
| 12257 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12258 | if (nid) { |
| 12259 | const char *name; |
| 12260 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12261 | name = "Speaker"; |
| 12262 | else |
| 12263 | name = "Front"; |
| 12264 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12265 | if (err < 0) |
| 12266 | return err; |
| 12267 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12268 | |
| 12269 | nid = cfg->speaker_pins[0]; |
| 12270 | if (nid == 0x1d) { |
| 12271 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12272 | "Speaker Playback Volume", |
| 12273 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12274 | if (err < 0) |
| 12275 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12276 | } else { |
| 12277 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12278 | if (err < 0) |
| 12279 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12280 | } |
| 12281 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12282 | if (nid) { |
| 12283 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12284 | if (err < 0) |
| 12285 | return err; |
| 12286 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12287 | |
| 12288 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12289 | if (nid == 0x16) { |
| 12290 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12291 | "Mono Playback Switch", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12292 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12293 | if (err < 0) |
| 12294 | return err; |
| 12295 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12296 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12297 | } |
| 12298 | |
| 12299 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12300 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12301 | const struct auto_pin_cfg *cfg) |
| 12302 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12303 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12304 | } |
| 12305 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame^] | 12306 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12307 | hda_nid_t nid, int pin_type) |
| 12308 | { |
| 12309 | int idx; |
| 12310 | |
| 12311 | alc_set_pin_output(codec, nid, pin_type); |
| 12312 | if (nid == 0x14 || nid == 0x16) |
| 12313 | idx = 0; |
| 12314 | else |
| 12315 | idx = 1; |
| 12316 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 12317 | } |
| 12318 | |
| 12319 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 12320 | { |
| 12321 | struct alc_spec *spec = codec->spec; |
| 12322 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 12323 | if (nid) { |
| 12324 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 12325 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 12326 | } |
| 12327 | } |
| 12328 | |
| 12329 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 12330 | { |
| 12331 | struct alc_spec *spec = codec->spec; |
| 12332 | hda_nid_t pin; |
| 12333 | |
| 12334 | pin = spec->autocfg.hp_pins[0]; |
| 12335 | if (pin) |
| 12336 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 12337 | pin = spec->autocfg.speaker_pins[0]; |
| 12338 | if (pin) |
| 12339 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 12340 | } |
| 12341 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12342 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12343 | { |
| 12344 | struct alc_spec *spec = codec->spec; |
| 12345 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12346 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12347 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12348 | unsigned int dac_vol1, dac_vol2; |
| 12349 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame^] | 12350 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12351 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12352 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame^] | 12353 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12354 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12355 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12356 | AMP_IN_UNMUTE(1)); |
| 12357 | snd_hda_codec_write(codec, 0x10, 0, |
| 12358 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12359 | AMP_IN_UNMUTE(1)); |
| 12360 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame^] | 12361 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12362 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12363 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12364 | snd_hda_codec_write(codec, 0x10, 0, |
| 12365 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12366 | } |
| 12367 | |
| 12368 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12369 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12370 | dac_vol2 = AMP_OUT_ZERO; |
| 12371 | else if (line_nid == 0x15) |
| 12372 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12373 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12374 | dac_vol2 = AMP_OUT_ZERO; |
| 12375 | else if (hp_nid == 0x15) |
| 12376 | dac_vol1 = AMP_OUT_ZERO; |
| 12377 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12378 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12379 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12380 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12381 | |
| 12382 | snd_hda_codec_write(codec, 0x02, 0, |
| 12383 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12384 | snd_hda_codec_write(codec, 0x03, 0, |
| 12385 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12386 | } |
| 12387 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12388 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12389 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12390 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12391 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12392 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12393 | |
| 12394 | /* |
| 12395 | * BIOS auto configuration |
| 12396 | */ |
| 12397 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12398 | { |
| 12399 | struct alc_spec *spec = codec->spec; |
| 12400 | int err; |
| 12401 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12402 | |
| 12403 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12404 | alc268_ignore); |
| 12405 | if (err < 0) |
| 12406 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12407 | if (!spec->autocfg.line_outs) { |
| 12408 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12409 | spec->multiout.max_channels = 2; |
| 12410 | spec->no_analog = 1; |
| 12411 | goto dig_only; |
| 12412 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12413 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12414 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12415 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12416 | if (err < 0) |
| 12417 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12418 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12419 | if (err < 0) |
| 12420 | return err; |
| 12421 | |
| 12422 | spec->multiout.max_channels = 2; |
| 12423 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12424 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12425 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12426 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12427 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12428 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12429 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12430 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12431 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12432 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12433 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12434 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12435 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12436 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12437 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12438 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12439 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12440 | err = alc_auto_add_mic_boost(codec); |
| 12441 | if (err < 0) |
| 12442 | return err; |
| 12443 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12444 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12445 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12446 | return 1; |
| 12447 | } |
| 12448 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12449 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12450 | |
| 12451 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12452 | static void alc268_auto_init(struct hda_codec *codec) |
| 12453 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12454 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12455 | alc268_auto_init_multi_out(codec); |
| 12456 | alc268_auto_init_hp_out(codec); |
| 12457 | alc268_auto_init_mono_speaker_out(codec); |
| 12458 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12459 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12460 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12461 | } |
| 12462 | |
| 12463 | /* |
| 12464 | * configuration and preset |
| 12465 | */ |
| 12466 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12467 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12468 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12469 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12470 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12471 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12472 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12473 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12474 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12475 | #ifdef CONFIG_SND_DEBUG |
| 12476 | [ALC268_TEST] = "test", |
| 12477 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12478 | [ALC268_AUTO] = "auto", |
| 12479 | }; |
| 12480 | |
| 12481 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12482 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12483 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12484 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12485 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12486 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12487 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12488 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12489 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12490 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12491 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
| 12492 | ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12493 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12494 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12495 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12496 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12497 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12498 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12499 | {} |
| 12500 | }; |
| 12501 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12502 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 12503 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 12504 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 12505 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 12506 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12507 | ALC268_TOSHIBA), |
| 12508 | {} |
| 12509 | }; |
| 12510 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12511 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12512 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12513 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 12514 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12515 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12516 | alc267_quanta_il1_verbs }, |
| 12517 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12518 | .dac_nids = alc268_dac_nids, |
| 12519 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12520 | .adc_nids = alc268_adc_nids_alt, |
| 12521 | .hp_nid = 0x03, |
| 12522 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12523 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12524 | .unsol_event = alc_sku_unsol_event, |
| 12525 | .setup = alc267_quanta_il1_setup, |
| 12526 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12527 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12528 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12529 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12530 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12531 | .init_verbs = { alc268_base_init_verbs }, |
| 12532 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12533 | .dac_nids = alc268_dac_nids, |
| 12534 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12535 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12536 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12537 | .hp_nid = 0x03, |
| 12538 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12539 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12540 | .channel_mode = alc268_modes, |
| 12541 | .input_mux = &alc268_capture_source, |
| 12542 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12543 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12544 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12545 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12546 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12547 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12548 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12549 | .dac_nids = alc268_dac_nids, |
| 12550 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12551 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12552 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12553 | .hp_nid = 0x03, |
| 12554 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12555 | .channel_mode = alc268_modes, |
| 12556 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12557 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12558 | .setup = alc268_toshiba_setup, |
| 12559 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12560 | }, |
| 12561 | [ALC268_ACER] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12562 | .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12563 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12564 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12565 | alc268_acer_verbs }, |
| 12566 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12567 | .dac_nids = alc268_dac_nids, |
| 12568 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12569 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12570 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12571 | .hp_nid = 0x02, |
| 12572 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12573 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12574 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12575 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12576 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12577 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12578 | [ALC268_ACER_DMIC] = { |
| 12579 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12580 | alc268_beep_mixer }, |
| 12581 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12582 | alc268_acer_verbs }, |
| 12583 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12584 | .dac_nids = alc268_dac_nids, |
| 12585 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12586 | .adc_nids = alc268_adc_nids_alt, |
| 12587 | .capsrc_nids = alc268_capsrc_nids, |
| 12588 | .hp_nid = 0x02, |
| 12589 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12590 | .channel_mode = alc268_modes, |
| 12591 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12592 | .unsol_event = alc268_acer_unsol_event, |
| 12593 | .init_hook = alc268_acer_init_hook, |
| 12594 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12595 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12596 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12597 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12598 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12599 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12600 | alc268_acer_aspire_one_verbs }, |
| 12601 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12602 | .dac_nids = alc268_dac_nids, |
| 12603 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12604 | .adc_nids = alc268_adc_nids_alt, |
| 12605 | .capsrc_nids = alc268_capsrc_nids, |
| 12606 | .hp_nid = 0x03, |
| 12607 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12608 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12609 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12610 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12611 | .init_hook = alc268_acer_lc_init_hook, |
| 12612 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12613 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12614 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 12615 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12616 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12617 | alc268_dell_verbs }, |
| 12618 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12619 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12620 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12621 | .adc_nids = alc268_adc_nids_alt, |
| 12622 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12623 | .hp_nid = 0x02, |
| 12624 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12625 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12626 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12627 | .setup = alc268_dell_setup, |
| 12628 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12629 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12630 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12631 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12632 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12633 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12634 | alc268_toshiba_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, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12639 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12640 | .hp_nid = 0x03, |
| 12641 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12642 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12643 | .channel_mode = alc268_modes, |
| 12644 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12645 | .setup = alc268_toshiba_setup, |
| 12646 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12647 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12648 | #ifdef CONFIG_SND_DEBUG |
| 12649 | [ALC268_TEST] = { |
| 12650 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12651 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12652 | alc268_volume_init_verbs }, |
| 12653 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12654 | .dac_nids = alc268_dac_nids, |
| 12655 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12656 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12657 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12658 | .hp_nid = 0x03, |
| 12659 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12660 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12661 | .channel_mode = alc268_modes, |
| 12662 | .input_mux = &alc268_capture_source, |
| 12663 | }, |
| 12664 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12665 | }; |
| 12666 | |
| 12667 | static int patch_alc268(struct hda_codec *codec) |
| 12668 | { |
| 12669 | struct alc_spec *spec; |
| 12670 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12671 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12672 | |
| 12673 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12674 | if (spec == NULL) |
| 12675 | return -ENOMEM; |
| 12676 | |
| 12677 | codec->spec = spec; |
| 12678 | |
| 12679 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12680 | alc268_models, |
| 12681 | alc268_cfg_tbl); |
| 12682 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12683 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 12684 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 12685 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
| 12686 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12687 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12688 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12689 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12690 | board_config = ALC268_AUTO; |
| 12691 | } |
| 12692 | |
| 12693 | if (board_config == ALC268_AUTO) { |
| 12694 | /* automatic parse from the BIOS config */ |
| 12695 | err = alc268_parse_auto_config(codec); |
| 12696 | if (err < 0) { |
| 12697 | alc_free(codec); |
| 12698 | return err; |
| 12699 | } else if (!err) { |
| 12700 | printk(KERN_INFO |
| 12701 | "hda_codec: Cannot set up configuration " |
| 12702 | "from BIOS. Using base mode...\n"); |
| 12703 | board_config = ALC268_3ST; |
| 12704 | } |
| 12705 | } |
| 12706 | |
| 12707 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12708 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12709 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12710 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12711 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12712 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12713 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12714 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12715 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12716 | has_beep = 0; |
| 12717 | for (i = 0; i < spec->num_mixers; i++) { |
| 12718 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12719 | has_beep = 1; |
| 12720 | break; |
| 12721 | } |
| 12722 | } |
| 12723 | |
| 12724 | if (has_beep) { |
| 12725 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12726 | if (err < 0) { |
| 12727 | alc_free(codec); |
| 12728 | return err; |
| 12729 | } |
| 12730 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12731 | /* override the amp caps for beep generator */ |
| 12732 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12733 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12734 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12735 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12736 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12737 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12738 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12739 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12740 | /* check whether NID 0x07 is valid */ |
| 12741 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12742 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12743 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12744 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12745 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12746 | if (spec->auto_mic || |
| 12747 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12748 | spec->adc_nids = alc268_adc_nids_alt; |
| 12749 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12750 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 12751 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 12752 | else |
| 12753 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12754 | } else { |
| 12755 | spec->adc_nids = alc268_adc_nids; |
| 12756 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12757 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12758 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12759 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12760 | /* set default input source */ |
| 12761 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12762 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12763 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12764 | i < spec->num_mux_defs ? |
| 12765 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12766 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12767 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12768 | |
| 12769 | spec->vmaster_nid = 0x02; |
| 12770 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12771 | codec->patch_ops = alc_patch_ops; |
| 12772 | if (board_config == ALC268_AUTO) |
| 12773 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12774 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12775 | codec->proc_widget_hook = print_realtek_coef; |
| 12776 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12777 | return 0; |
| 12778 | } |
| 12779 | |
| 12780 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12781 | * ALC269 channel source setting (2 channel) |
| 12782 | */ |
| 12783 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12784 | |
| 12785 | #define alc269_dac_nids alc260_dac_nids |
| 12786 | |
| 12787 | static hda_nid_t alc269_adc_nids[1] = { |
| 12788 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12789 | 0x08, |
| 12790 | }; |
| 12791 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12792 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12793 | 0x23, |
| 12794 | }; |
| 12795 | |
| 12796 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12797 | * not a mux! |
| 12798 | */ |
| 12799 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12800 | #define alc269_modes alc260_modes |
| 12801 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12802 | |
| 12803 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12804 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12805 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12806 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12807 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12808 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12809 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12810 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12811 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12812 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12813 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12814 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12815 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12816 | { } /* end */ |
| 12817 | }; |
| 12818 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12819 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12820 | /* output mixer control */ |
| 12821 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12822 | { |
| 12823 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12824 | .name = "Master Playback Switch", |
| 12825 | .info = snd_hda_mixer_amp_switch_info, |
| 12826 | .get = snd_hda_mixer_amp_switch_get, |
| 12827 | .put = alc268_acer_master_sw_put, |
| 12828 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12829 | }, |
| 12830 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12831 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12832 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12833 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12834 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12835 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12836 | { } |
| 12837 | }; |
| 12838 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12839 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12840 | /* output mixer control */ |
| 12841 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12842 | { |
| 12843 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12844 | .name = "Master Playback Switch", |
| 12845 | .info = snd_hda_mixer_amp_switch_info, |
| 12846 | .get = snd_hda_mixer_amp_switch_get, |
| 12847 | .put = alc268_acer_master_sw_put, |
| 12848 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12849 | }, |
| 12850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12851 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12852 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12853 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12854 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12855 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12856 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12857 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12858 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12859 | { } |
| 12860 | }; |
| 12861 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12862 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12863 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12864 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12865 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12866 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12867 | { } /* end */ |
| 12868 | }; |
| 12869 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12870 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12871 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12872 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12873 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12874 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12875 | { } /* end */ |
| 12876 | }; |
| 12877 | |
| 12878 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12879 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12880 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12881 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12882 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12883 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12884 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12885 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12886 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12887 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12888 | { } |
| 12889 | }; |
| 12890 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12891 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12892 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12893 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12894 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12895 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12896 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12897 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12898 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12899 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12900 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12901 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12902 | { } |
| 12903 | }; |
| 12904 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12905 | /* toggle speaker-output according to the hp-jack state */ |
| 12906 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12907 | { |
| 12908 | unsigned int present; |
| 12909 | unsigned char bits; |
| 12910 | |
| 12911 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12912 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12913 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12914 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12915 | AMP_IN_MUTE(0), bits); |
| 12916 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12917 | AMP_IN_MUTE(0), bits); |
| 12918 | |
| 12919 | snd_hda_codec_write(codec, 0x20, 0, |
| 12920 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12921 | snd_hda_codec_write(codec, 0x20, 0, |
| 12922 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12923 | |
| 12924 | snd_hda_codec_write(codec, 0x20, 0, |
| 12925 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12926 | snd_hda_codec_write(codec, 0x20, 0, |
| 12927 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12928 | } |
| 12929 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12930 | /* toggle speaker-output according to the hp-jacks state */ |
| 12931 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12932 | { |
| 12933 | unsigned int present; |
| 12934 | unsigned char bits; |
| 12935 | |
| 12936 | /* Check laptop headphone socket */ |
| 12937 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12938 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12939 | |
| 12940 | /* Check port replicator headphone socket */ |
| 12941 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12942 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12943 | |
| 12944 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12945 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12946 | AMP_IN_MUTE(0), bits); |
| 12947 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12948 | AMP_IN_MUTE(0), bits); |
| 12949 | |
| 12950 | snd_hda_codec_write(codec, 0x20, 0, |
| 12951 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12952 | snd_hda_codec_write(codec, 0x20, 0, |
| 12953 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12954 | |
| 12955 | snd_hda_codec_write(codec, 0x20, 0, |
| 12956 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12957 | snd_hda_codec_write(codec, 0x20, 0, |
| 12958 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12959 | } |
| 12960 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12961 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12962 | { |
| 12963 | unsigned int present_laptop; |
| 12964 | unsigned int present_dock; |
| 12965 | |
| 12966 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12967 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12968 | |
| 12969 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12970 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12971 | |
| 12972 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12973 | if (present_dock) |
| 12974 | snd_hda_codec_write(codec, 0x23, 0, |
| 12975 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12976 | if (present_laptop) |
| 12977 | snd_hda_codec_write(codec, 0x23, 0, |
| 12978 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12979 | if (!present_dock && !present_laptop) |
| 12980 | snd_hda_codec_write(codec, 0x23, 0, |
| 12981 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12982 | } |
| 12983 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12984 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12985 | unsigned int res) |
| 12986 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12987 | switch (res >> 26) { |
| 12988 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12989 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12990 | break; |
| 12991 | case ALC880_MIC_EVENT: |
| 12992 | alc_mic_automute(codec); |
| 12993 | break; |
| 12994 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12995 | } |
| 12996 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12997 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12998 | unsigned int res) |
| 12999 | { |
| 13000 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13001 | alc269_lifebook_speaker_automute(codec); |
| 13002 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13003 | alc269_lifebook_mic_autoswitch(codec); |
| 13004 | } |
| 13005 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13006 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13007 | { |
| 13008 | struct alc_spec *spec = codec->spec; |
| 13009 | spec->ext_mic.pin = 0x18; |
| 13010 | spec->ext_mic.mux_idx = 0; |
| 13011 | spec->int_mic.pin = 0x19; |
| 13012 | spec->int_mic.mux_idx = 1; |
| 13013 | spec->auto_mic = 1; |
| 13014 | } |
| 13015 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13016 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13017 | { |
| 13018 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13019 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13020 | } |
| 13021 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13022 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13023 | { |
| 13024 | alc269_lifebook_speaker_automute(codec); |
| 13025 | alc269_lifebook_mic_autoswitch(codec); |
| 13026 | } |
| 13027 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13028 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 13029 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13030 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13031 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13032 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13033 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13034 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13035 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13036 | {} |
| 13037 | }; |
| 13038 | |
| 13039 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 13040 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13041 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13042 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13043 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13044 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13045 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13046 | {} |
| 13047 | }; |
| 13048 | |
| 13049 | /* toggle speaker-output according to the hp-jack state */ |
| 13050 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13051 | { |
| 13052 | unsigned int present; |
| 13053 | unsigned char bits; |
| 13054 | |
| 13055 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13056 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13057 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13058 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13059 | AMP_IN_MUTE(0), bits); |
| 13060 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13061 | AMP_IN_MUTE(0), bits); |
| 13062 | } |
| 13063 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13064 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13065 | static void alc269_eeepc_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13066 | unsigned int res) |
| 13067 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13068 | switch (res >> 26) { |
| 13069 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13070 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13071 | break; |
| 13072 | case ALC880_MIC_EVENT: |
| 13073 | alc_mic_automute(codec); |
| 13074 | break; |
| 13075 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13076 | } |
| 13077 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13078 | static void alc269_eeepc_dmic_setup(struct hda_codec *codec) |
| 13079 | { |
| 13080 | struct alc_spec *spec = codec->spec; |
| 13081 | spec->ext_mic.pin = 0x18; |
| 13082 | spec->ext_mic.mux_idx = 0; |
| 13083 | spec->int_mic.pin = 0x12; |
| 13084 | spec->int_mic.mux_idx = 5; |
| 13085 | spec->auto_mic = 1; |
| 13086 | } |
| 13087 | |
| 13088 | static void alc269_eeepc_amic_setup(struct hda_codec *codec) |
| 13089 | { |
| 13090 | struct alc_spec *spec = codec->spec; |
| 13091 | spec->ext_mic.pin = 0x18; |
| 13092 | spec->ext_mic.mux_idx = 0; |
| 13093 | spec->int_mic.pin = 0x19; |
| 13094 | spec->int_mic.mux_idx = 1; |
| 13095 | spec->auto_mic = 1; |
| 13096 | } |
| 13097 | |
| 13098 | static void alc269_eeepc_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13099 | { |
| 13100 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13101 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13102 | } |
| 13103 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13104 | /* |
| 13105 | * generic initialization of ADC, input mixers and output mixers |
| 13106 | */ |
| 13107 | static struct hda_verb alc269_init_verbs[] = { |
| 13108 | /* |
| 13109 | * Unmute ADC0 and set the default input to mic-in |
| 13110 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13111 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13112 | |
| 13113 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 13114 | * analog-loopback mixer widget |
| 13115 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 13116 | * front panel mic (mic 2) |
| 13117 | */ |
| 13118 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 13119 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13120 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13121 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13122 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13123 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13124 | |
| 13125 | /* |
| 13126 | * Set up output mixers (0x0c - 0x0e) |
| 13127 | */ |
| 13128 | /* set vol=0 to output mixers */ |
| 13129 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13130 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13131 | |
| 13132 | /* set up input amps for analog loopback */ |
| 13133 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13134 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13135 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13136 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13137 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13138 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13139 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13140 | |
| 13141 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13142 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13143 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13144 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13145 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13146 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13147 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13148 | |
| 13149 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13150 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13151 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13152 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13153 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13154 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13155 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13156 | |
| 13157 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13158 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13159 | |
| 13160 | /* FIXME: use matrix-type input source selection */ |
| 13161 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13162 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13163 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13164 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13165 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13166 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13167 | |
| 13168 | /* set EAPD */ |
| 13169 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13170 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13171 | { } |
| 13172 | }; |
| 13173 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 13174 | #define alc269_auto_create_multi_out_ctls \ |
| 13175 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13176 | #define alc269_auto_create_input_ctls \ |
| 13177 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13178 | |
| 13179 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13180 | #define alc269_loopbacks alc880_loopbacks |
| 13181 | #endif |
| 13182 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13183 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13184 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13185 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13186 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13187 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13188 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13189 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13190 | .substreams = 1, |
| 13191 | .channels_min = 2, |
| 13192 | .channels_max = 8, |
| 13193 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13194 | /* NID is set in alc_build_pcms */ |
| 13195 | .ops = { |
| 13196 | .open = alc880_playback_pcm_open, |
| 13197 | .prepare = alc880_playback_pcm_prepare, |
| 13198 | .cleanup = alc880_playback_pcm_cleanup |
| 13199 | }, |
| 13200 | }; |
| 13201 | |
| 13202 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13203 | .substreams = 1, |
| 13204 | .channels_min = 2, |
| 13205 | .channels_max = 2, |
| 13206 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13207 | /* NID is set in alc_build_pcms */ |
| 13208 | }; |
| 13209 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13210 | /* |
| 13211 | * BIOS auto configuration |
| 13212 | */ |
| 13213 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13214 | { |
| 13215 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13216 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13217 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13218 | |
| 13219 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13220 | alc269_ignore); |
| 13221 | if (err < 0) |
| 13222 | return err; |
| 13223 | |
| 13224 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13225 | if (err < 0) |
| 13226 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13227 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13228 | if (err < 0) |
| 13229 | return err; |
| 13230 | |
| 13231 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13232 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13233 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13234 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13235 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13236 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13237 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13238 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13239 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13240 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13241 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13242 | /* set default input source */ |
| 13243 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13244 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13245 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13246 | |
| 13247 | err = alc_auto_add_mic_boost(codec); |
| 13248 | if (err < 0) |
| 13249 | return err; |
| 13250 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13251 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13252 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13253 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13254 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13255 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13256 | return 1; |
| 13257 | } |
| 13258 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame^] | 13259 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 13260 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13261 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13262 | |
| 13263 | |
| 13264 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13265 | static void alc269_auto_init(struct hda_codec *codec) |
| 13266 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13267 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13268 | alc269_auto_init_multi_out(codec); |
| 13269 | alc269_auto_init_hp_out(codec); |
| 13270 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13271 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13272 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13273 | } |
| 13274 | |
| 13275 | /* |
| 13276 | * configuration and preset |
| 13277 | */ |
| 13278 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13279 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13280 | [ALC269_QUANTA_FL1] = "quanta", |
| 13281 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13282 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13283 | [ALC269_FUJITSU] = "fujitsu", |
| 13284 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13285 | }; |
| 13286 | |
| 13287 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13288 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13289 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13290 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13291 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13292 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13293 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13294 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13295 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13296 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13297 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13298 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13299 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13300 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13301 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13302 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13303 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13304 | {} |
| 13305 | }; |
| 13306 | |
| 13307 | static struct alc_config_preset alc269_presets[] = { |
| 13308 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13309 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13310 | .init_verbs = { alc269_init_verbs }, |
| 13311 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13312 | .dac_nids = alc269_dac_nids, |
| 13313 | .hp_nid = 0x03, |
| 13314 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13315 | .channel_mode = alc269_modes, |
| 13316 | .input_mux = &alc269_capture_source, |
| 13317 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13318 | [ALC269_QUANTA_FL1] = { |
| 13319 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13320 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13321 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13322 | .dac_nids = alc269_dac_nids, |
| 13323 | .hp_nid = 0x03, |
| 13324 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13325 | .channel_mode = alc269_modes, |
| 13326 | .input_mux = &alc269_capture_source, |
| 13327 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13328 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13329 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13330 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13331 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13332 | .mixers = { alc269_eeepc_mixer }, |
| 13333 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13334 | .init_verbs = { alc269_init_verbs, |
| 13335 | alc269_eeepc_amic_init_verbs }, |
| 13336 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13337 | .dac_nids = alc269_dac_nids, |
| 13338 | .hp_nid = 0x03, |
| 13339 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13340 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13341 | .unsol_event = alc269_eeepc_unsol_event, |
| 13342 | .setup = alc269_eeepc_amic_setup, |
| 13343 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13344 | }, |
| 13345 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13346 | .mixers = { alc269_eeepc_mixer }, |
| 13347 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13348 | .init_verbs = { alc269_init_verbs, |
| 13349 | alc269_eeepc_dmic_init_verbs }, |
| 13350 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13351 | .dac_nids = alc269_dac_nids, |
| 13352 | .hp_nid = 0x03, |
| 13353 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13354 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13355 | .unsol_event = alc269_eeepc_unsol_event, |
| 13356 | .setup = alc269_eeepc_dmic_setup, |
| 13357 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13358 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13359 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13360 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13361 | .cap_mixer = alc269_epc_capture_mixer, |
| 13362 | .init_verbs = { alc269_init_verbs, |
| 13363 | alc269_eeepc_dmic_init_verbs }, |
| 13364 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13365 | .dac_nids = alc269_dac_nids, |
| 13366 | .hp_nid = 0x03, |
| 13367 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13368 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13369 | .unsol_event = alc269_eeepc_unsol_event, |
| 13370 | .setup = alc269_eeepc_dmic_setup, |
| 13371 | .init_hook = alc269_eeepc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13372 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13373 | [ALC269_LIFEBOOK] = { |
| 13374 | .mixers = { alc269_lifebook_mixer }, |
| 13375 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13376 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13377 | .dac_nids = alc269_dac_nids, |
| 13378 | .hp_nid = 0x03, |
| 13379 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13380 | .channel_mode = alc269_modes, |
| 13381 | .input_mux = &alc269_capture_source, |
| 13382 | .unsol_event = alc269_lifebook_unsol_event, |
| 13383 | .init_hook = alc269_lifebook_init_hook, |
| 13384 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13385 | }; |
| 13386 | |
| 13387 | static int patch_alc269(struct hda_codec *codec) |
| 13388 | { |
| 13389 | struct alc_spec *spec; |
| 13390 | int board_config; |
| 13391 | int err; |
| 13392 | |
| 13393 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13394 | if (spec == NULL) |
| 13395 | return -ENOMEM; |
| 13396 | |
| 13397 | codec->spec = spec; |
| 13398 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13399 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13400 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13401 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13402 | alc269_models, |
| 13403 | alc269_cfg_tbl); |
| 13404 | |
| 13405 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13406 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13407 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13408 | board_config = ALC269_AUTO; |
| 13409 | } |
| 13410 | |
| 13411 | if (board_config == ALC269_AUTO) { |
| 13412 | /* automatic parse from the BIOS config */ |
| 13413 | err = alc269_parse_auto_config(codec); |
| 13414 | if (err < 0) { |
| 13415 | alc_free(codec); |
| 13416 | return err; |
| 13417 | } else if (!err) { |
| 13418 | printk(KERN_INFO |
| 13419 | "hda_codec: Cannot set up configuration " |
| 13420 | "from BIOS. Using base mode...\n"); |
| 13421 | board_config = ALC269_BASIC; |
| 13422 | } |
| 13423 | } |
| 13424 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13425 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13426 | if (err < 0) { |
| 13427 | alc_free(codec); |
| 13428 | return err; |
| 13429 | } |
| 13430 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13431 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13432 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13433 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13434 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13435 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13436 | * fix the sample rate of analog I/O to 44.1kHz |
| 13437 | */ |
| 13438 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13439 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13440 | } else { |
| 13441 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13442 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13443 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13444 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13445 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13446 | |
| 13447 | spec->adc_nids = alc269_adc_nids; |
| 13448 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13449 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13450 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13451 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13452 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13453 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 13454 | spec->vmaster_nid = 0x02; |
| 13455 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13456 | codec->patch_ops = alc_patch_ops; |
| 13457 | if (board_config == ALC269_AUTO) |
| 13458 | spec->init_hook = alc269_auto_init; |
| 13459 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13460 | if (!spec->loopback.amplist) |
| 13461 | spec->loopback.amplist = alc269_loopbacks; |
| 13462 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13463 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13464 | |
| 13465 | return 0; |
| 13466 | } |
| 13467 | |
| 13468 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13469 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13470 | */ |
| 13471 | |
| 13472 | /* |
| 13473 | * set the path ways for 2 channel output |
| 13474 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13475 | */ |
| 13476 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13477 | /* set pin widget 1Ah (line in) for input */ |
| 13478 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13479 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13480 | * the vref |
| 13481 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13482 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13483 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13484 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13485 | #if 0 |
| 13486 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13487 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13488 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13489 | { } /* end */ |
| 13490 | }; |
| 13491 | /* |
| 13492 | * 6ch mode |
| 13493 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13494 | */ |
| 13495 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13496 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13497 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13498 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13499 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13500 | |
| 13501 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13502 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13503 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13504 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13505 | #if 0 |
| 13506 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13507 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13508 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13509 | { } /* end */ |
| 13510 | }; |
| 13511 | |
| 13512 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13513 | { 2, alc861_threestack_ch2_init }, |
| 13514 | { 6, alc861_threestack_ch6_init }, |
| 13515 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13516 | /* Set mic1 as input and unmute the mixer */ |
| 13517 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13518 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13519 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13520 | { } /* end */ |
| 13521 | }; |
| 13522 | /* Set mic1 as output and mute mixer */ |
| 13523 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13524 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13525 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13526 | { } /* end */ |
| 13527 | }; |
| 13528 | |
| 13529 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13530 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13531 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13532 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13533 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13534 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13535 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13536 | /* set pin widget 1Ah (line in) for input */ |
| 13537 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13538 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13539 | * the vref |
| 13540 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13541 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13542 | |
| 13543 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13544 | #if 0 |
| 13545 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13546 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13547 | #endif |
| 13548 | { } /* end */ |
| 13549 | }; |
| 13550 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13551 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13552 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13553 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13554 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13555 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13556 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13557 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13558 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13559 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13560 | |
| 13561 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13562 | #if 0 |
| 13563 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13564 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13565 | #endif |
| 13566 | { } /* end */ |
| 13567 | }; |
| 13568 | |
| 13569 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13570 | { 2, alc861_asus_ch2_init }, |
| 13571 | { 6, alc861_asus_ch6_init }, |
| 13572 | }; |
| 13573 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13574 | /* patch-ALC861 */ |
| 13575 | |
| 13576 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13577 | /* output mixer control */ |
| 13578 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13579 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13580 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13581 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13582 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13583 | |
| 13584 | /*Input mixer control */ |
| 13585 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13586 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13587 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13588 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13589 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13590 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13591 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13592 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13593 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13594 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13595 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13596 | { } /* end */ |
| 13597 | }; |
| 13598 | |
| 13599 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13600 | /* output mixer control */ |
| 13601 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13602 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13603 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13604 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13605 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13606 | |
| 13607 | /* Input mixer control */ |
| 13608 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13609 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13610 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13611 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13612 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13613 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13614 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13615 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13616 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13617 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13618 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13619 | { |
| 13620 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13621 | .name = "Channel Mode", |
| 13622 | .info = alc_ch_mode_info, |
| 13623 | .get = alc_ch_mode_get, |
| 13624 | .put = alc_ch_mode_put, |
| 13625 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13626 | }, |
| 13627 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13628 | }; |
| 13629 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13630 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13631 | /* output mixer control */ |
| 13632 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13633 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13634 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13635 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13636 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13637 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13638 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13639 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13640 | /* output mixer control */ |
| 13641 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13642 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13643 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13644 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13645 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13646 | |
| 13647 | /* Input mixer control */ |
| 13648 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13649 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13650 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13651 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13652 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13653 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13654 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13655 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13656 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13657 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13658 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13659 | { |
| 13660 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13661 | .name = "Channel Mode", |
| 13662 | .info = alc_ch_mode_info, |
| 13663 | .get = alc_ch_mode_get, |
| 13664 | .put = alc_ch_mode_put, |
| 13665 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13666 | }, |
| 13667 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13668 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13669 | |
| 13670 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13671 | /* output mixer control */ |
| 13672 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13673 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13674 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13675 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13676 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13677 | |
| 13678 | /* Input mixer control */ |
| 13679 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13680 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13681 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13682 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13683 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13684 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13685 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13686 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13687 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13688 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13689 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13690 | { |
| 13691 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13692 | .name = "Channel Mode", |
| 13693 | .info = alc_ch_mode_info, |
| 13694 | .get = alc_ch_mode_get, |
| 13695 | .put = alc_ch_mode_put, |
| 13696 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13697 | }, |
| 13698 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13699 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13700 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13701 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13702 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13703 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13704 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13705 | { } |
| 13706 | }; |
| 13707 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13708 | /* |
| 13709 | * generic initialization of ADC, input mixers and output mixers |
| 13710 | */ |
| 13711 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13712 | /* |
| 13713 | * Unmute ADC0 and set the default input to mic-in |
| 13714 | */ |
| 13715 | /* port-A for surround (rear panel) */ |
| 13716 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13717 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13718 | /* port-B for mic-in (rear panel) with vref */ |
| 13719 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13720 | /* port-C for line-in (rear panel) */ |
| 13721 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13722 | /* port-D for Front */ |
| 13723 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13724 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13725 | /* port-E for HP out (front panel) */ |
| 13726 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13727 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13728 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13729 | /* port-F for mic-in (front panel) with vref */ |
| 13730 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13731 | /* port-G for CLFE (rear panel) */ |
| 13732 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13733 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13734 | /* port-H for side (rear panel) */ |
| 13735 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13736 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13737 | /* CD-in */ |
| 13738 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13739 | /* route front mic to ADC1*/ |
| 13740 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13741 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13742 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13743 | /* Unmute DAC0~3 & spdif out*/ |
| 13744 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13745 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13746 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13747 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13748 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13749 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13750 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13751 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13752 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13753 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13754 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13755 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13756 | /* Unmute Stereo Mixer 15 */ |
| 13757 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13758 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13759 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13760 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13761 | |
| 13762 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13763 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13764 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13765 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13766 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13767 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13768 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13769 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13770 | /* hp used DAC 3 (Front) */ |
| 13771 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13772 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13773 | |
| 13774 | { } |
| 13775 | }; |
| 13776 | |
| 13777 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13778 | /* |
| 13779 | * Unmute ADC0 and set the default input to mic-in |
| 13780 | */ |
| 13781 | /* port-A for surround (rear panel) */ |
| 13782 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13783 | /* port-B for mic-in (rear panel) with vref */ |
| 13784 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13785 | /* port-C for line-in (rear panel) */ |
| 13786 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13787 | /* port-D for Front */ |
| 13788 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13789 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13790 | /* port-E for HP out (front panel) */ |
| 13791 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13792 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13793 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13794 | /* port-F for mic-in (front panel) with vref */ |
| 13795 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13796 | /* port-G for CLFE (rear panel) */ |
| 13797 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13798 | /* port-H for side (rear panel) */ |
| 13799 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13800 | /* CD-in */ |
| 13801 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13802 | /* route front mic to ADC1*/ |
| 13803 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13804 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13805 | /* Unmute DAC0~3 & spdif out*/ |
| 13806 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13807 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13808 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13809 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13810 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13811 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13812 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13813 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13814 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13815 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13816 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13817 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13818 | /* Unmute Stereo Mixer 15 */ |
| 13819 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13820 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13821 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13822 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13823 | |
| 13824 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13825 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13826 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13827 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13828 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13829 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13830 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13831 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13832 | /* hp used DAC 3 (Front) */ |
| 13833 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13834 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13835 | { } |
| 13836 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13837 | |
| 13838 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13839 | /* |
| 13840 | * Unmute ADC0 and set the default input to mic-in |
| 13841 | */ |
| 13842 | /* port-A for surround (rear panel) */ |
| 13843 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13844 | /* port-B for mic-in (rear panel) with vref */ |
| 13845 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13846 | /* port-C for line-in (rear panel) */ |
| 13847 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13848 | /* port-D for Front */ |
| 13849 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13850 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13851 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13852 | /* this has to be set to VREF80 */ |
| 13853 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13854 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13855 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13856 | /* port-F for mic-in (front panel) with vref */ |
| 13857 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13858 | /* port-G for CLFE (rear panel) */ |
| 13859 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13860 | /* port-H for side (rear panel) */ |
| 13861 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13862 | /* CD-in */ |
| 13863 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13864 | /* route front mic to ADC1*/ |
| 13865 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13866 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13867 | /* Unmute DAC0~3 & spdif out*/ |
| 13868 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13869 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13870 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13871 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13872 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13873 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13874 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13875 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13876 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13877 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13878 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13879 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13880 | /* Unmute Stereo Mixer 15 */ |
| 13881 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13882 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13883 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13884 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13885 | |
| 13886 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13887 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13888 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13889 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13890 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13891 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13892 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13893 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13894 | /* hp used DAC 3 (Front) */ |
| 13895 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13896 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13897 | { } |
| 13898 | }; |
| 13899 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13900 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13901 | /* |
| 13902 | * Unmute ADC0 and set the default input to mic-in |
| 13903 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13904 | /* port-A for surround (rear panel) |
| 13905 | * according to codec#0 this is the HP jack |
| 13906 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13907 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13908 | /* route front PCM to HP */ |
| 13909 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13910 | /* port-B for mic-in (rear panel) with vref */ |
| 13911 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13912 | /* port-C for line-in (rear panel) */ |
| 13913 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13914 | /* port-D for Front */ |
| 13915 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13916 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13917 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13918 | /* this has to be set to VREF80 */ |
| 13919 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13920 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13921 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13922 | /* port-F for mic-in (front panel) with vref */ |
| 13923 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13924 | /* port-G for CLFE (rear panel) */ |
| 13925 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13926 | /* port-H for side (rear panel) */ |
| 13927 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13928 | /* CD-in */ |
| 13929 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13930 | /* route front mic to ADC1*/ |
| 13931 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13932 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13933 | /* Unmute DAC0~3 & spdif out*/ |
| 13934 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13935 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13936 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13937 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13938 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13939 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13940 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13941 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13942 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13943 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13944 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13945 | /* Unmute Stereo Mixer 15 */ |
| 13946 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13947 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13948 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13949 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13950 | |
| 13951 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13952 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13953 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13954 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13955 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13956 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13957 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13958 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13959 | /* hp used DAC 3 (Front) */ |
| 13960 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13961 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13962 | { } |
| 13963 | }; |
| 13964 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13965 | /* additional init verbs for ASUS laptops */ |
| 13966 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13967 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13968 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13969 | { } |
| 13970 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13971 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13972 | /* |
| 13973 | * generic initialization of ADC, input mixers and output mixers |
| 13974 | */ |
| 13975 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13976 | /* |
| 13977 | * Unmute ADC0 and set the default input to mic-in |
| 13978 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13979 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13980 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13981 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13982 | /* Unmute DAC0~3 & spdif out*/ |
| 13983 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13984 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13985 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13986 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13987 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13988 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13989 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13990 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13991 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13992 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13993 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13994 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13995 | /* Unmute Stereo Mixer 15 */ |
| 13996 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13997 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13998 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13999 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14000 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14001 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14002 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14003 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14004 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14005 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14006 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14007 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14008 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14009 | |
| 14010 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14011 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14012 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14013 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14014 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14015 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14016 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14017 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14018 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14019 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14020 | |
| 14021 | { } |
| 14022 | }; |
| 14023 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14024 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14025 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14026 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14027 | { } |
| 14028 | }; |
| 14029 | |
| 14030 | /* toggle speaker-output according to the hp-jack state */ |
| 14031 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14032 | { |
| 14033 | unsigned int present; |
| 14034 | |
| 14035 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 14036 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14037 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14038 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14039 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14040 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14041 | } |
| 14042 | |
| 14043 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14044 | unsigned int res) |
| 14045 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14046 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14047 | alc861_toshiba_automute(codec); |
| 14048 | } |
| 14049 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14050 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14051 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14052 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14053 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14054 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14055 | |
| 14056 | |
| 14057 | #define ALC861_DIGOUT_NID 0x07 |
| 14058 | |
| 14059 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14060 | { 8, NULL } |
| 14061 | }; |
| 14062 | |
| 14063 | static hda_nid_t alc861_dac_nids[4] = { |
| 14064 | /* front, surround, clfe, side */ |
| 14065 | 0x03, 0x06, 0x05, 0x04 |
| 14066 | }; |
| 14067 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14068 | static hda_nid_t alc660_dac_nids[3] = { |
| 14069 | /* front, clfe, surround */ |
| 14070 | 0x03, 0x05, 0x06 |
| 14071 | }; |
| 14072 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14073 | static hda_nid_t alc861_adc_nids[1] = { |
| 14074 | /* ADC0-2 */ |
| 14075 | 0x08, |
| 14076 | }; |
| 14077 | |
| 14078 | static struct hda_input_mux alc861_capture_source = { |
| 14079 | .num_items = 5, |
| 14080 | .items = { |
| 14081 | { "Mic", 0x0 }, |
| 14082 | { "Front Mic", 0x3 }, |
| 14083 | { "Line", 0x1 }, |
| 14084 | { "CD", 0x4 }, |
| 14085 | { "Mixer", 0x5 }, |
| 14086 | }, |
| 14087 | }; |
| 14088 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14089 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 14090 | { |
| 14091 | struct alc_spec *spec = codec->spec; |
| 14092 | hda_nid_t mix, srcs[5]; |
| 14093 | int i, j, num; |
| 14094 | |
| 14095 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 14096 | return 0; |
| 14097 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14098 | if (num < 0) |
| 14099 | return 0; |
| 14100 | for (i = 0; i < num; i++) { |
| 14101 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14102 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14103 | if (type != AC_WID_AUD_OUT) |
| 14104 | continue; |
| 14105 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 14106 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 14107 | break; |
| 14108 | if (j >= spec->multiout.num_dacs) |
| 14109 | return srcs[i]; |
| 14110 | } |
| 14111 | return 0; |
| 14112 | } |
| 14113 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14114 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14115 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14116 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14117 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14118 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14119 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14120 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14121 | |
| 14122 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14123 | for (i = 0; i < cfg->line_outs; i++) { |
| 14124 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14125 | dac = alc861_look_for_dac(codec, nid); |
| 14126 | if (!dac) |
| 14127 | continue; |
| 14128 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14129 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14130 | return 0; |
| 14131 | } |
| 14132 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14133 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 14134 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14135 | { |
| 14136 | char name[32]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14137 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 14138 | return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name, |
| 14139 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 14140 | } |
| 14141 | |
| 14142 | /* add playback controls from the parsed DAC table */ |
| 14143 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 14144 | const struct auto_pin_cfg *cfg) |
| 14145 | { |
| 14146 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14147 | static const char *chname[4] = { |
| 14148 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14149 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14150 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14151 | int i, err; |
| 14152 | |
| 14153 | if (cfg->line_outs == 1) { |
| 14154 | const char *pfx = NULL; |
| 14155 | if (!cfg->hp_outs) |
| 14156 | pfx = "Master"; |
| 14157 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 14158 | pfx = "Speaker"; |
| 14159 | if (pfx) { |
| 14160 | nid = spec->multiout.dac_nids[0]; |
| 14161 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 14162 | } |
| 14163 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14164 | |
| 14165 | for (i = 0; i < cfg->line_outs; i++) { |
| 14166 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14167 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14168 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14169 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14170 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14171 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14172 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14173 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14174 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14175 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14176 | return err; |
| 14177 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14178 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14179 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14180 | return err; |
| 14181 | } |
| 14182 | } |
| 14183 | return 0; |
| 14184 | } |
| 14185 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14186 | 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] | 14187 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14188 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14189 | int err; |
| 14190 | hda_nid_t nid; |
| 14191 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14192 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14193 | return 0; |
| 14194 | |
| 14195 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14196 | nid = alc861_look_for_dac(codec, pin); |
| 14197 | if (nid) { |
| 14198 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 14199 | if (err < 0) |
| 14200 | return err; |
| 14201 | spec->multiout.hp_nid = nid; |
| 14202 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14203 | } |
| 14204 | return 0; |
| 14205 | } |
| 14206 | |
| 14207 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14208 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14209 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14210 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14211 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14212 | } |
| 14213 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14214 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14215 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14216 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14217 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14218 | hda_nid_t mix, srcs[5]; |
| 14219 | int i, num; |
| 14220 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14221 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14222 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14223 | 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] | 14224 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14225 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 14226 | return; |
| 14227 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14228 | if (num < 0) |
| 14229 | return; |
| 14230 | for (i = 0; i < num; i++) { |
| 14231 | unsigned int mute; |
| 14232 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 14233 | mute = AMP_IN_UNMUTE(i); |
| 14234 | else |
| 14235 | mute = AMP_IN_MUTE(i); |
| 14236 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14237 | mute); |
| 14238 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14239 | } |
| 14240 | |
| 14241 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14242 | { |
| 14243 | struct alc_spec *spec = codec->spec; |
| 14244 | int i; |
| 14245 | |
| 14246 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14247 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14248 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14249 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14250 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14251 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14252 | } |
| 14253 | } |
| 14254 | |
| 14255 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14256 | { |
| 14257 | struct alc_spec *spec = codec->spec; |
| 14258 | hda_nid_t pin; |
| 14259 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 14260 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14261 | if (pin) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14262 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14263 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14264 | pin = spec->autocfg.speaker_pins[0]; |
| 14265 | if (pin) |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14266 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 14267 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14268 | } |
| 14269 | |
| 14270 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14271 | { |
| 14272 | struct alc_spec *spec = codec->spec; |
| 14273 | int i; |
| 14274 | |
| 14275 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14276 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14277 | if (nid >= 0x0c && nid <= 0x11) |
| 14278 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14279 | } |
| 14280 | } |
| 14281 | |
| 14282 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14283 | /* return 1 if successful, 0 if the proper config is not found, |
| 14284 | * or a negative error code |
| 14285 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14286 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14287 | { |
| 14288 | struct alc_spec *spec = codec->spec; |
| 14289 | int err; |
| 14290 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14291 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14292 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14293 | alc861_ignore); |
| 14294 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14295 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14296 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14297 | return 0; /* can't find valid BIOS pin config */ |
| 14298 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14299 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14300 | if (err < 0) |
| 14301 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14302 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14303 | if (err < 0) |
| 14304 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14305 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14306 | if (err < 0) |
| 14307 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14308 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14309 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14310 | return err; |
| 14311 | |
| 14312 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14313 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14314 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14315 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14316 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14317 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14318 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14319 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14320 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14321 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14322 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14323 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14324 | |
| 14325 | spec->adc_nids = alc861_adc_nids; |
| 14326 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14327 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14328 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14329 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14330 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14331 | return 1; |
| 14332 | } |
| 14333 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14334 | /* additional initialization for auto-configuration model */ |
| 14335 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14336 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14337 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14338 | alc861_auto_init_multi_out(codec); |
| 14339 | alc861_auto_init_hp_out(codec); |
| 14340 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14341 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14342 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14343 | } |
| 14344 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14345 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14346 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14347 | { 0x15, HDA_INPUT, 0 }, |
| 14348 | { 0x15, HDA_INPUT, 1 }, |
| 14349 | { 0x15, HDA_INPUT, 2 }, |
| 14350 | { 0x15, HDA_INPUT, 3 }, |
| 14351 | { } /* end */ |
| 14352 | }; |
| 14353 | #endif |
| 14354 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14355 | |
| 14356 | /* |
| 14357 | * configuration and preset |
| 14358 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14359 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14360 | [ALC861_3ST] = "3stack", |
| 14361 | [ALC660_3ST] = "3stack-660", |
| 14362 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14363 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14364 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14365 | [ALC861_TOSHIBA] = "toshiba", |
| 14366 | [ALC861_ASUS] = "asus", |
| 14367 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14368 | [ALC861_AUTO] = "auto", |
| 14369 | }; |
| 14370 | |
| 14371 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14372 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14373 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14374 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14375 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14376 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14377 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14378 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14379 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14380 | * Any other models that need this preset? |
| 14381 | */ |
| 14382 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14383 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14384 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14385 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14386 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14387 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14388 | /* FIXME: the below seems conflict */ |
| 14389 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14390 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14391 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14392 | {} |
| 14393 | }; |
| 14394 | |
| 14395 | static struct alc_config_preset alc861_presets[] = { |
| 14396 | [ALC861_3ST] = { |
| 14397 | .mixers = { alc861_3ST_mixer }, |
| 14398 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14399 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14400 | .dac_nids = alc861_dac_nids, |
| 14401 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14402 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14403 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14404 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14405 | .adc_nids = alc861_adc_nids, |
| 14406 | .input_mux = &alc861_capture_source, |
| 14407 | }, |
| 14408 | [ALC861_3ST_DIG] = { |
| 14409 | .mixers = { alc861_base_mixer }, |
| 14410 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14411 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14412 | .dac_nids = alc861_dac_nids, |
| 14413 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14414 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14415 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14416 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14417 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14418 | .adc_nids = alc861_adc_nids, |
| 14419 | .input_mux = &alc861_capture_source, |
| 14420 | }, |
| 14421 | [ALC861_6ST_DIG] = { |
| 14422 | .mixers = { alc861_base_mixer }, |
| 14423 | .init_verbs = { alc861_base_init_verbs }, |
| 14424 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14425 | .dac_nids = alc861_dac_nids, |
| 14426 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14427 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14428 | .channel_mode = alc861_8ch_modes, |
| 14429 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14430 | .adc_nids = alc861_adc_nids, |
| 14431 | .input_mux = &alc861_capture_source, |
| 14432 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14433 | [ALC660_3ST] = { |
| 14434 | .mixers = { alc861_3ST_mixer }, |
| 14435 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14436 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14437 | .dac_nids = alc660_dac_nids, |
| 14438 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14439 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14440 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14441 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14442 | .adc_nids = alc861_adc_nids, |
| 14443 | .input_mux = &alc861_capture_source, |
| 14444 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14445 | [ALC861_UNIWILL_M31] = { |
| 14446 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14447 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14448 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14449 | .dac_nids = alc861_dac_nids, |
| 14450 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14451 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14452 | .channel_mode = alc861_uniwill_m31_modes, |
| 14453 | .need_dac_fix = 1, |
| 14454 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14455 | .adc_nids = alc861_adc_nids, |
| 14456 | .input_mux = &alc861_capture_source, |
| 14457 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14458 | [ALC861_TOSHIBA] = { |
| 14459 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14460 | .init_verbs = { alc861_base_init_verbs, |
| 14461 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14462 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14463 | .dac_nids = alc861_dac_nids, |
| 14464 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14465 | .channel_mode = alc883_3ST_2ch_modes, |
| 14466 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14467 | .adc_nids = alc861_adc_nids, |
| 14468 | .input_mux = &alc861_capture_source, |
| 14469 | .unsol_event = alc861_toshiba_unsol_event, |
| 14470 | .init_hook = alc861_toshiba_automute, |
| 14471 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14472 | [ALC861_ASUS] = { |
| 14473 | .mixers = { alc861_asus_mixer }, |
| 14474 | .init_verbs = { alc861_asus_init_verbs }, |
| 14475 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14476 | .dac_nids = alc861_dac_nids, |
| 14477 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14478 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14479 | .channel_mode = alc861_asus_modes, |
| 14480 | .need_dac_fix = 1, |
| 14481 | .hp_nid = 0x06, |
| 14482 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14483 | .adc_nids = alc861_adc_nids, |
| 14484 | .input_mux = &alc861_capture_source, |
| 14485 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14486 | [ALC861_ASUS_LAPTOP] = { |
| 14487 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14488 | .init_verbs = { alc861_asus_init_verbs, |
| 14489 | alc861_asus_laptop_init_verbs }, |
| 14490 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14491 | .dac_nids = alc861_dac_nids, |
| 14492 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14493 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14494 | .channel_mode = alc883_3ST_2ch_modes, |
| 14495 | .need_dac_fix = 1, |
| 14496 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14497 | .adc_nids = alc861_adc_nids, |
| 14498 | .input_mux = &alc861_capture_source, |
| 14499 | }, |
| 14500 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14501 | |
| 14502 | |
| 14503 | static int patch_alc861(struct hda_codec *codec) |
| 14504 | { |
| 14505 | struct alc_spec *spec; |
| 14506 | int board_config; |
| 14507 | int err; |
| 14508 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14509 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14510 | if (spec == NULL) |
| 14511 | return -ENOMEM; |
| 14512 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14513 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14514 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14515 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14516 | alc861_models, |
| 14517 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14518 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14519 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14520 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14521 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14522 | board_config = ALC861_AUTO; |
| 14523 | } |
| 14524 | |
| 14525 | if (board_config == ALC861_AUTO) { |
| 14526 | /* automatic parse from the BIOS config */ |
| 14527 | err = alc861_parse_auto_config(codec); |
| 14528 | if (err < 0) { |
| 14529 | alc_free(codec); |
| 14530 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14531 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14532 | printk(KERN_INFO |
| 14533 | "hda_codec: Cannot set up configuration " |
| 14534 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14535 | board_config = ALC861_3ST_DIG; |
| 14536 | } |
| 14537 | } |
| 14538 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14539 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14540 | if (err < 0) { |
| 14541 | alc_free(codec); |
| 14542 | return err; |
| 14543 | } |
| 14544 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14545 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14546 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14547 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14548 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14549 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14550 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14551 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14552 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14553 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14554 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14555 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14556 | spec->vmaster_nid = 0x03; |
| 14557 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14558 | codec->patch_ops = alc_patch_ops; |
| 14559 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14560 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14561 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14562 | if (!spec->loopback.amplist) |
| 14563 | spec->loopback.amplist = alc861_loopbacks; |
| 14564 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14565 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14566 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14567 | return 0; |
| 14568 | } |
| 14569 | |
| 14570 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14571 | * ALC861-VD support |
| 14572 | * |
| 14573 | * Based on ALC882 |
| 14574 | * |
| 14575 | * In addition, an independent DAC |
| 14576 | */ |
| 14577 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14578 | |
| 14579 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14580 | /* front, surr, clfe, side surr */ |
| 14581 | 0x02, 0x03, 0x04, 0x05 |
| 14582 | }; |
| 14583 | |
| 14584 | /* dac_nids for ALC660vd are in a different order - according to |
| 14585 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14586 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14587 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14588 | * - and it is the same as in 861vd. |
| 14589 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14590 | */ |
| 14591 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14592 | /* front, rear, clfe, rear_surr */ |
| 14593 | 0x02, 0x04, 0x03 |
| 14594 | }; |
| 14595 | |
| 14596 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14597 | /* ADC0 */ |
| 14598 | 0x09, |
| 14599 | }; |
| 14600 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14601 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14602 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14603 | /* input MUX */ |
| 14604 | /* FIXME: should be a matrix-type input source selection */ |
| 14605 | static struct hda_input_mux alc861vd_capture_source = { |
| 14606 | .num_items = 4, |
| 14607 | .items = { |
| 14608 | { "Mic", 0x0 }, |
| 14609 | { "Front Mic", 0x1 }, |
| 14610 | { "Line", 0x2 }, |
| 14611 | { "CD", 0x4 }, |
| 14612 | }, |
| 14613 | }; |
| 14614 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14615 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14616 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14617 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14618 | { "Ext Mic", 0x0 }, |
| 14619 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14620 | }, |
| 14621 | }; |
| 14622 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14623 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14624 | .num_items = 2, |
| 14625 | .items = { |
| 14626 | { "Front Mic", 0x0 }, |
| 14627 | { "ATAPI Mic", 0x1 }, |
| 14628 | }, |
| 14629 | }; |
| 14630 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14631 | /* |
| 14632 | * 2ch mode |
| 14633 | */ |
| 14634 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14635 | { 2, NULL } |
| 14636 | }; |
| 14637 | |
| 14638 | /* |
| 14639 | * 6ch mode |
| 14640 | */ |
| 14641 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14642 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14643 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14644 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14645 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14646 | { } /* end */ |
| 14647 | }; |
| 14648 | |
| 14649 | /* |
| 14650 | * 8ch mode |
| 14651 | */ |
| 14652 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14653 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14654 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14655 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14656 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14657 | { } /* end */ |
| 14658 | }; |
| 14659 | |
| 14660 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14661 | { 6, alc861vd_6stack_ch6_init }, |
| 14662 | { 8, alc861vd_6stack_ch8_init }, |
| 14663 | }; |
| 14664 | |
| 14665 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14666 | { |
| 14667 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14668 | .name = "Channel Mode", |
| 14669 | .info = alc_ch_mode_info, |
| 14670 | .get = alc_ch_mode_get, |
| 14671 | .put = alc_ch_mode_put, |
| 14672 | }, |
| 14673 | { } /* end */ |
| 14674 | }; |
| 14675 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14676 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14677 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14678 | */ |
| 14679 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14680 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14681 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14682 | |
| 14683 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14684 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14685 | |
| 14686 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14687 | HDA_OUTPUT), |
| 14688 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14689 | HDA_OUTPUT), |
| 14690 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14691 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14692 | |
| 14693 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14694 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14695 | |
| 14696 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14697 | |
| 14698 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14699 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14700 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14701 | |
| 14702 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14703 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14704 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14705 | |
| 14706 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14707 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14708 | |
| 14709 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14710 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14711 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14712 | { } /* end */ |
| 14713 | }; |
| 14714 | |
| 14715 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14716 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14717 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14718 | |
| 14719 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14720 | |
| 14721 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14722 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14724 | |
| 14725 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14726 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14727 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14728 | |
| 14729 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14730 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14731 | |
| 14732 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14733 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14734 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14735 | { } /* end */ |
| 14736 | }; |
| 14737 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14738 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14739 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14740 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14741 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14742 | |
| 14743 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14744 | |
| 14745 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14746 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14747 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14748 | |
| 14749 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14750 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14751 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14752 | |
| 14753 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14754 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14755 | |
| 14756 | { } /* end */ |
| 14757 | }; |
| 14758 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14759 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14760 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14761 | */ |
| 14762 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14763 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14764 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14765 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14766 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14767 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14768 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14769 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14770 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14771 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14772 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14773 | { } /* end */ |
| 14774 | }; |
| 14775 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14776 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14777 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14778 | */ |
| 14779 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14780 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14781 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14782 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14783 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14784 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14785 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14786 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14787 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14788 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14789 | { } /* end */ |
| 14790 | }; |
| 14791 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14792 | /* |
| 14793 | * generic initialization of ADC, input mixers and output mixers |
| 14794 | */ |
| 14795 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14796 | /* |
| 14797 | * Unmute ADC0 and set the default input to mic-in |
| 14798 | */ |
| 14799 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14800 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14801 | |
| 14802 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14803 | * the analog-loopback mixer widget |
| 14804 | */ |
| 14805 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14806 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14807 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14808 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14809 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14810 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14811 | |
| 14812 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14813 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14814 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14815 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14816 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14817 | |
| 14818 | /* |
| 14819 | * Set up output mixers (0x02 - 0x05) |
| 14820 | */ |
| 14821 | /* set vol=0 to output mixers */ |
| 14822 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14823 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14824 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14825 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14826 | |
| 14827 | /* set up input amps for analog loopback */ |
| 14828 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14829 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14830 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14831 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14832 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14833 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14834 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14835 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14836 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14837 | |
| 14838 | { } |
| 14839 | }; |
| 14840 | |
| 14841 | /* |
| 14842 | * 3-stack pin configuration: |
| 14843 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14844 | */ |
| 14845 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14846 | /* |
| 14847 | * Set pin mode and muting |
| 14848 | */ |
| 14849 | /* set front pin widgets 0x14 for output */ |
| 14850 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14851 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14852 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14853 | |
| 14854 | /* Mic (rear) pin: input vref at 80% */ |
| 14855 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14856 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14857 | /* Front Mic pin: input vref at 80% */ |
| 14858 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14859 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14860 | /* Line In pin: input */ |
| 14861 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14862 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14863 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14864 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14865 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14866 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14867 | /* CD pin widget for input */ |
| 14868 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14869 | |
| 14870 | { } |
| 14871 | }; |
| 14872 | |
| 14873 | /* |
| 14874 | * 6-stack pin configuration: |
| 14875 | */ |
| 14876 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14877 | /* |
| 14878 | * Set pin mode and muting |
| 14879 | */ |
| 14880 | /* set front pin widgets 0x14 for output */ |
| 14881 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14882 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14883 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14884 | |
| 14885 | /* Rear Pin: output 1 (0x0d) */ |
| 14886 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14887 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14888 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14889 | /* CLFE Pin: output 2 (0x0e) */ |
| 14890 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14891 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14892 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14893 | /* Side Pin: output 3 (0x0f) */ |
| 14894 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14895 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14896 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14897 | |
| 14898 | /* Mic (rear) pin: input vref at 80% */ |
| 14899 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14900 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14901 | /* Front Mic pin: input vref at 80% */ |
| 14902 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14903 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14904 | /* Line In pin: input */ |
| 14905 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14906 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14907 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14908 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14909 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14910 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14911 | /* CD pin widget for input */ |
| 14912 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14913 | |
| 14914 | { } |
| 14915 | }; |
| 14916 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14917 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14918 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14919 | { } |
| 14920 | }; |
| 14921 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14922 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14923 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14924 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14925 | { } |
| 14926 | }; |
| 14927 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14928 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14929 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14930 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14932 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14933 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14934 | {} |
| 14935 | }; |
| 14936 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14937 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14938 | { |
| 14939 | unsigned int present; |
| 14940 | unsigned char bits; |
| 14941 | |
| 14942 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14943 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14944 | bits = present ? HDA_AMP_MUTE : 0; |
| 14945 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14946 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14947 | } |
| 14948 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14949 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14950 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14951 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14952 | spec->autocfg.hp_pins[0] = 0x1b; |
| 14953 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14954 | } |
| 14955 | |
| 14956 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 14957 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14958 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14959 | alc861vd_lenovo_mic_automute(codec); |
| 14960 | } |
| 14961 | |
| 14962 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14963 | unsigned int res) |
| 14964 | { |
| 14965 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14966 | case ALC880_MIC_EVENT: |
| 14967 | alc861vd_lenovo_mic_automute(codec); |
| 14968 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14969 | default: |
| 14970 | alc_automute_amp_unsol_event(codec, res); |
| 14971 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14972 | } |
| 14973 | } |
| 14974 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14975 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14976 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14977 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14978 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14979 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14980 | |
| 14981 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14982 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14983 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14984 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14985 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14986 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14987 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14988 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14989 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14990 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14991 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14992 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14993 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14994 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14995 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14996 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14997 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14998 | |
| 14999 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15000 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15001 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15002 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15003 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15004 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15005 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15006 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15007 | |
| 15008 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15009 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15010 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15011 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15012 | |
| 15013 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15014 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15015 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15016 | |
| 15017 | { } /* end */ |
| 15018 | }; |
| 15019 | |
| 15020 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15021 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15022 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15023 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15024 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15025 | spec->autocfg.hp_pins[0] = 0x15; |
| 15026 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15027 | } |
| 15028 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15029 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15030 | #define alc861vd_loopbacks alc880_loopbacks |
| 15031 | #endif |
| 15032 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15033 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15034 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15035 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15036 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15037 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15038 | |
| 15039 | /* |
| 15040 | * configuration and preset |
| 15041 | */ |
| 15042 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15043 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15044 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15045 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15046 | [ALC861VD_3ST] = "3stack", |
| 15047 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15048 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15049 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15050 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15051 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15052 | [ALC861VD_AUTO] = "auto", |
| 15053 | }; |
| 15054 | |
| 15055 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15056 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15057 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15058 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15059 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15060 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15061 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15062 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15063 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15064 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 15065 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15066 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15067 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15068 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15069 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15070 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15071 | {} |
| 15072 | }; |
| 15073 | |
| 15074 | static struct alc_config_preset alc861vd_presets[] = { |
| 15075 | [ALC660VD_3ST] = { |
| 15076 | .mixers = { alc861vd_3st_mixer }, |
| 15077 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15078 | alc861vd_3stack_init_verbs }, |
| 15079 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15080 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15081 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15082 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15083 | .input_mux = &alc861vd_capture_source, |
| 15084 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15085 | [ALC660VD_3ST_DIG] = { |
| 15086 | .mixers = { alc861vd_3st_mixer }, |
| 15087 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15088 | alc861vd_3stack_init_verbs }, |
| 15089 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15090 | .dac_nids = alc660vd_dac_nids, |
| 15091 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15092 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15093 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15094 | .input_mux = &alc861vd_capture_source, |
| 15095 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15096 | [ALC861VD_3ST] = { |
| 15097 | .mixers = { alc861vd_3st_mixer }, |
| 15098 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15099 | alc861vd_3stack_init_verbs }, |
| 15100 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15101 | .dac_nids = alc861vd_dac_nids, |
| 15102 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15103 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15104 | .input_mux = &alc861vd_capture_source, |
| 15105 | }, |
| 15106 | [ALC861VD_3ST_DIG] = { |
| 15107 | .mixers = { alc861vd_3st_mixer }, |
| 15108 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15109 | alc861vd_3stack_init_verbs }, |
| 15110 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15111 | .dac_nids = alc861vd_dac_nids, |
| 15112 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15113 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15114 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15115 | .input_mux = &alc861vd_capture_source, |
| 15116 | }, |
| 15117 | [ALC861VD_6ST_DIG] = { |
| 15118 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15119 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15120 | alc861vd_6stack_init_verbs }, |
| 15121 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15122 | .dac_nids = alc861vd_dac_nids, |
| 15123 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15124 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15125 | .channel_mode = alc861vd_6stack_modes, |
| 15126 | .input_mux = &alc861vd_capture_source, |
| 15127 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15128 | [ALC861VD_LENOVO] = { |
| 15129 | .mixers = { alc861vd_lenovo_mixer }, |
| 15130 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15131 | alc861vd_3stack_init_verbs, |
| 15132 | alc861vd_eapd_verbs, |
| 15133 | alc861vd_lenovo_unsol_verbs }, |
| 15134 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15135 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15136 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15137 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15138 | .input_mux = &alc861vd_capture_source, |
| 15139 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15140 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15141 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15142 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15143 | [ALC861VD_DALLAS] = { |
| 15144 | .mixers = { alc861vd_dallas_mixer }, |
| 15145 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15146 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15147 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15148 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15149 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15150 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15151 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15152 | .setup = alc861vd_dallas_setup, |
| 15153 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15154 | }, |
| 15155 | [ALC861VD_HP] = { |
| 15156 | .mixers = { alc861vd_hp_mixer }, |
| 15157 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15158 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15159 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15160 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15161 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15162 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15163 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15164 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15165 | .setup = alc861vd_dallas_setup, |
| 15166 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15167 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15168 | [ALC660VD_ASUS_V1S] = { |
| 15169 | .mixers = { alc861vd_lenovo_mixer }, |
| 15170 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15171 | alc861vd_3stack_init_verbs, |
| 15172 | alc861vd_eapd_verbs, |
| 15173 | alc861vd_lenovo_unsol_verbs }, |
| 15174 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15175 | .dac_nids = alc660vd_dac_nids, |
| 15176 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15177 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15178 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15179 | .input_mux = &alc861vd_capture_source, |
| 15180 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15181 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15182 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15183 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15184 | }; |
| 15185 | |
| 15186 | /* |
| 15187 | * BIOS auto configuration |
| 15188 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15189 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 15190 | const struct auto_pin_cfg *cfg) |
| 15191 | { |
| 15192 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
| 15193 | } |
| 15194 | |
| 15195 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15196 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15197 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15198 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15199 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15200 | } |
| 15201 | |
| 15202 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15203 | { |
| 15204 | struct alc_spec *spec = codec->spec; |
| 15205 | int i; |
| 15206 | |
| 15207 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15208 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15209 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15210 | if (nid) |
| 15211 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15212 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15213 | } |
| 15214 | } |
| 15215 | |
| 15216 | |
| 15217 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15218 | { |
| 15219 | struct alc_spec *spec = codec->spec; |
| 15220 | hda_nid_t pin; |
| 15221 | |
| 15222 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15223 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15224 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15225 | pin = spec->autocfg.speaker_pins[0]; |
| 15226 | if (pin) |
| 15227 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15228 | } |
| 15229 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15230 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15231 | |
| 15232 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15233 | { |
| 15234 | struct alc_spec *spec = codec->spec; |
| 15235 | int i; |
| 15236 | |
| 15237 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15238 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15239 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15240 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15241 | if (nid != ALC861VD_PIN_CD_NID && |
| 15242 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15243 | snd_hda_codec_write(codec, nid, 0, |
| 15244 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15245 | AMP_OUT_MUTE); |
| 15246 | } |
| 15247 | } |
| 15248 | } |
| 15249 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15250 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15251 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15252 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15253 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15254 | |
| 15255 | /* add playback controls from the parsed DAC table */ |
| 15256 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15257 | * different NIDs for mute/unmute switch and volume control */ |
| 15258 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15259 | const struct auto_pin_cfg *cfg) |
| 15260 | { |
| 15261 | char name[32]; |
| 15262 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15263 | hda_nid_t nid_v, nid_s; |
| 15264 | int i, err; |
| 15265 | |
| 15266 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15267 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15268 | continue; |
| 15269 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15270 | alc880_dac_to_idx( |
| 15271 | spec->multiout.dac_nids[i])); |
| 15272 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15273 | alc880_dac_to_idx( |
| 15274 | spec->multiout.dac_nids[i])); |
| 15275 | |
| 15276 | if (i == 2) { |
| 15277 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15278 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15279 | "Center Playback Volume", |
| 15280 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15281 | HDA_OUTPUT)); |
| 15282 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15283 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15284 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15285 | "LFE Playback Volume", |
| 15286 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15287 | HDA_OUTPUT)); |
| 15288 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15289 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15290 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15291 | "Center Playback Switch", |
| 15292 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15293 | HDA_INPUT)); |
| 15294 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15295 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15296 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15297 | "LFE Playback Switch", |
| 15298 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15299 | HDA_INPUT)); |
| 15300 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15301 | return err; |
| 15302 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15303 | const char *pfx; |
| 15304 | if (cfg->line_outs == 1 && |
| 15305 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 15306 | if (!cfg->hp_pins) |
| 15307 | pfx = "Speaker"; |
| 15308 | else |
| 15309 | pfx = "PCM"; |
| 15310 | } else |
| 15311 | pfx = chname[i]; |
| 15312 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15313 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15314 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15315 | HDA_OUTPUT)); |
| 15316 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15317 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15318 | if (cfg->line_outs == 1 && |
| 15319 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15320 | pfx = "Speaker"; |
| 15321 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15322 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15323 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15324 | HDA_INPUT)); |
| 15325 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15326 | return err; |
| 15327 | } |
| 15328 | } |
| 15329 | return 0; |
| 15330 | } |
| 15331 | |
| 15332 | /* add playback controls for speaker and HP outputs */ |
| 15333 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15334 | * different NIDs for mute/unmute switch and volume control */ |
| 15335 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15336 | hda_nid_t pin, const char *pfx) |
| 15337 | { |
| 15338 | hda_nid_t nid_v, nid_s; |
| 15339 | int err; |
| 15340 | char name[32]; |
| 15341 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15342 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15343 | return 0; |
| 15344 | |
| 15345 | if (alc880_is_fixed_pin(pin)) { |
| 15346 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15347 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15348 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15349 | spec->multiout.hp_nid = nid_v; |
| 15350 | else |
| 15351 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15352 | /* control HP volume/switch on the output mixer amp */ |
| 15353 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15354 | alc880_fixed_pin_idx(pin)); |
| 15355 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15356 | alc880_fixed_pin_idx(pin)); |
| 15357 | |
| 15358 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15359 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15360 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15361 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15362 | return err; |
| 15363 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15364 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15365 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15366 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15367 | return err; |
| 15368 | } else if (alc880_is_multi_pin(pin)) { |
| 15369 | /* set manual connection */ |
| 15370 | /* we have only a switch on HP-out PIN */ |
| 15371 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15372 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15373 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15374 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15375 | return err; |
| 15376 | } |
| 15377 | return 0; |
| 15378 | } |
| 15379 | |
| 15380 | /* parse the BIOS configuration and set up the alc_spec |
| 15381 | * return 1 if successful, 0 if the proper config is not found, |
| 15382 | * or a negative error code |
| 15383 | * Based on ALC880 version - had to change it to override |
| 15384 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15385 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15386 | { |
| 15387 | struct alc_spec *spec = codec->spec; |
| 15388 | int err; |
| 15389 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15390 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15391 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15392 | alc861vd_ignore); |
| 15393 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15394 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15395 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15396 | return 0; /* can't find valid BIOS pin config */ |
| 15397 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15398 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15399 | if (err < 0) |
| 15400 | return err; |
| 15401 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15402 | if (err < 0) |
| 15403 | return err; |
| 15404 | err = alc861vd_auto_create_extra_out(spec, |
| 15405 | spec->autocfg.speaker_pins[0], |
| 15406 | "Speaker"); |
| 15407 | if (err < 0) |
| 15408 | return err; |
| 15409 | err = alc861vd_auto_create_extra_out(spec, |
| 15410 | spec->autocfg.hp_pins[0], |
| 15411 | "Headphone"); |
| 15412 | if (err < 0) |
| 15413 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15414 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15415 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15416 | return err; |
| 15417 | |
| 15418 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15419 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15420 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15421 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15422 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15423 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15424 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15425 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15426 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15427 | |
| 15428 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15429 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15430 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15431 | err = alc_auto_add_mic_boost(codec); |
| 15432 | if (err < 0) |
| 15433 | return err; |
| 15434 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15435 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15436 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15437 | return 1; |
| 15438 | } |
| 15439 | |
| 15440 | /* additional initialization for auto-configuration model */ |
| 15441 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15442 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15443 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15444 | alc861vd_auto_init_multi_out(codec); |
| 15445 | alc861vd_auto_init_hp_out(codec); |
| 15446 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15447 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15448 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15449 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15450 | } |
| 15451 | |
| 15452 | static int patch_alc861vd(struct hda_codec *codec) |
| 15453 | { |
| 15454 | struct alc_spec *spec; |
| 15455 | int err, board_config; |
| 15456 | |
| 15457 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15458 | if (spec == NULL) |
| 15459 | return -ENOMEM; |
| 15460 | |
| 15461 | codec->spec = spec; |
| 15462 | |
| 15463 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15464 | alc861vd_models, |
| 15465 | alc861vd_cfg_tbl); |
| 15466 | |
| 15467 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15468 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15469 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15470 | board_config = ALC861VD_AUTO; |
| 15471 | } |
| 15472 | |
| 15473 | if (board_config == ALC861VD_AUTO) { |
| 15474 | /* automatic parse from the BIOS config */ |
| 15475 | err = alc861vd_parse_auto_config(codec); |
| 15476 | if (err < 0) { |
| 15477 | alc_free(codec); |
| 15478 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15479 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15480 | printk(KERN_INFO |
| 15481 | "hda_codec: Cannot set up configuration " |
| 15482 | "from BIOS. Using base mode...\n"); |
| 15483 | board_config = ALC861VD_3ST; |
| 15484 | } |
| 15485 | } |
| 15486 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15487 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15488 | if (err < 0) { |
| 15489 | alc_free(codec); |
| 15490 | return err; |
| 15491 | } |
| 15492 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15493 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15494 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15495 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15496 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15497 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15498 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15499 | } |
| 15500 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15501 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15502 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15503 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15504 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15505 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15506 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 15507 | if (!spec->adc_nids) { |
| 15508 | spec->adc_nids = alc861vd_adc_nids; |
| 15509 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 15510 | } |
| 15511 | if (!spec->capsrc_nids) |
| 15512 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15513 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15514 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15515 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15516 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15517 | spec->vmaster_nid = 0x02; |
| 15518 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15519 | codec->patch_ops = alc_patch_ops; |
| 15520 | |
| 15521 | if (board_config == ALC861VD_AUTO) |
| 15522 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15523 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15524 | if (!spec->loopback.amplist) |
| 15525 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15526 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15527 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15528 | |
| 15529 | return 0; |
| 15530 | } |
| 15531 | |
| 15532 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15533 | * ALC662 support |
| 15534 | * |
| 15535 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15536 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15537 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15538 | * 6-channel independent captures. |
| 15539 | * |
| 15540 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15541 | * driver yet). |
| 15542 | */ |
| 15543 | #define ALC662_DIGOUT_NID 0x06 |
| 15544 | #define ALC662_DIGIN_NID 0x0a |
| 15545 | |
| 15546 | static hda_nid_t alc662_dac_nids[4] = { |
| 15547 | /* front, rear, clfe, rear_surr */ |
| 15548 | 0x02, 0x03, 0x04 |
| 15549 | }; |
| 15550 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15551 | static hda_nid_t alc272_dac_nids[2] = { |
| 15552 | 0x02, 0x03 |
| 15553 | }; |
| 15554 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15555 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15556 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15557 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15558 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15559 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15560 | static hda_nid_t alc272_adc_nids[1] = { |
| 15561 | /* ADC1-2 */ |
| 15562 | 0x08, |
| 15563 | }; |
| 15564 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15565 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15566 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15567 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15568 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15569 | /* input MUX */ |
| 15570 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15571 | static struct hda_input_mux alc662_capture_source = { |
| 15572 | .num_items = 4, |
| 15573 | .items = { |
| 15574 | { "Mic", 0x0 }, |
| 15575 | { "Front Mic", 0x1 }, |
| 15576 | { "Line", 0x2 }, |
| 15577 | { "CD", 0x4 }, |
| 15578 | }, |
| 15579 | }; |
| 15580 | |
| 15581 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15582 | .num_items = 2, |
| 15583 | .items = { |
| 15584 | { "Mic", 0x1 }, |
| 15585 | { "Line", 0x2 }, |
| 15586 | }, |
| 15587 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15588 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15589 | static struct hda_input_mux alc663_capture_source = { |
| 15590 | .num_items = 3, |
| 15591 | .items = { |
| 15592 | { "Mic", 0x0 }, |
| 15593 | { "Front Mic", 0x1 }, |
| 15594 | { "Line", 0x2 }, |
| 15595 | }, |
| 15596 | }; |
| 15597 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15598 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15599 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15600 | .num_items = 16, |
| 15601 | .items = { |
| 15602 | { "Autoselect Mic", 0x0 }, |
| 15603 | { "Internal Mic", 0x1 }, |
| 15604 | { "In-0x02", 0x2 }, |
| 15605 | { "In-0x03", 0x3 }, |
| 15606 | { "In-0x04", 0x4 }, |
| 15607 | { "In-0x05", 0x5 }, |
| 15608 | { "In-0x06", 0x6 }, |
| 15609 | { "In-0x07", 0x7 }, |
| 15610 | { "In-0x08", 0x8 }, |
| 15611 | { "In-0x09", 0x9 }, |
| 15612 | { "In-0x0a", 0x0a }, |
| 15613 | { "In-0x0b", 0x0b }, |
| 15614 | { "In-0x0c", 0x0c }, |
| 15615 | { "In-0x0d", 0x0d }, |
| 15616 | { "In-0x0e", 0x0e }, |
| 15617 | { "In-0x0f", 0x0f }, |
| 15618 | }, |
| 15619 | }; |
| 15620 | #endif |
| 15621 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15622 | /* |
| 15623 | * 2ch mode |
| 15624 | */ |
| 15625 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15626 | { 2, NULL } |
| 15627 | }; |
| 15628 | |
| 15629 | /* |
| 15630 | * 2ch mode |
| 15631 | */ |
| 15632 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15633 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15634 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15635 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15636 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15637 | { } /* end */ |
| 15638 | }; |
| 15639 | |
| 15640 | /* |
| 15641 | * 6ch mode |
| 15642 | */ |
| 15643 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15644 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15645 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15646 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15647 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15648 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15649 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15650 | { } /* end */ |
| 15651 | }; |
| 15652 | |
| 15653 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15654 | { 2, alc662_3ST_ch2_init }, |
| 15655 | { 6, alc662_3ST_ch6_init }, |
| 15656 | }; |
| 15657 | |
| 15658 | /* |
| 15659 | * 2ch mode |
| 15660 | */ |
| 15661 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15662 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15663 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15664 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15665 | { } /* end */ |
| 15666 | }; |
| 15667 | |
| 15668 | /* |
| 15669 | * 6ch mode |
| 15670 | */ |
| 15671 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15672 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15673 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15674 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15675 | { } /* end */ |
| 15676 | }; |
| 15677 | |
| 15678 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15679 | { 2, alc662_sixstack_ch6_init }, |
| 15680 | { 6, alc662_sixstack_ch8_init }, |
| 15681 | }; |
| 15682 | |
| 15683 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15684 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15685 | */ |
| 15686 | |
| 15687 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15688 | /* output mixer control */ |
| 15689 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15690 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15691 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15692 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15693 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15694 | 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] | 15695 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15696 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15697 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15698 | |
| 15699 | /*Input mixer control */ |
| 15700 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15701 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15702 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15703 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15704 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15705 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15706 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15707 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15708 | { } /* end */ |
| 15709 | }; |
| 15710 | |
| 15711 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15712 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15713 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15714 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15715 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15716 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15717 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15718 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15719 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15720 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15721 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15722 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15723 | { } /* end */ |
| 15724 | }; |
| 15725 | |
| 15726 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15727 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15728 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15729 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15730 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15731 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15732 | 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] | 15733 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15734 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15735 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15736 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15737 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15738 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15739 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15740 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15741 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15742 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15743 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15744 | { } /* end */ |
| 15745 | }; |
| 15746 | |
| 15747 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15748 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15749 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15750 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15751 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15752 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15753 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15754 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15755 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15756 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15757 | { } /* end */ |
| 15758 | }; |
| 15759 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15760 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15761 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15762 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15763 | |
| 15764 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15765 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15766 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15767 | |
| 15768 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15769 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15770 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15771 | { } /* end */ |
| 15772 | }; |
| 15773 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15774 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15775 | ALC262_HIPPO_MASTER_SWITCH, |
| 15776 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15777 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15778 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15779 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15780 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15781 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15782 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15783 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15784 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15785 | { } /* end */ |
| 15786 | }; |
| 15787 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15788 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15789 | .ops = &snd_hda_bind_vol, |
| 15790 | .values = { |
| 15791 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15792 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15793 | 0 |
| 15794 | }, |
| 15795 | }; |
| 15796 | |
| 15797 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15798 | .ops = &snd_hda_bind_sw, |
| 15799 | .values = { |
| 15800 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15801 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15802 | 0 |
| 15803 | }, |
| 15804 | }; |
| 15805 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15806 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15807 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15808 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15809 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15810 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15811 | { } /* end */ |
| 15812 | }; |
| 15813 | |
| 15814 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15815 | .ops = &snd_hda_bind_sw, |
| 15816 | .values = { |
| 15817 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15818 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15819 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15820 | 0 |
| 15821 | }, |
| 15822 | }; |
| 15823 | |
| 15824 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15825 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15826 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15828 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15829 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15830 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15831 | |
| 15832 | { } /* end */ |
| 15833 | }; |
| 15834 | |
| 15835 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15836 | .ops = &snd_hda_bind_sw, |
| 15837 | .values = { |
| 15838 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15839 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15840 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15841 | 0 |
| 15842 | }, |
| 15843 | }; |
| 15844 | |
| 15845 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15846 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15847 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15848 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15849 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15850 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15851 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15852 | { } /* end */ |
| 15853 | }; |
| 15854 | |
| 15855 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15856 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15857 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15858 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15859 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15860 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15861 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15862 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15863 | { } /* end */ |
| 15864 | }; |
| 15865 | |
| 15866 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15867 | .ops = &snd_hda_bind_vol, |
| 15868 | .values = { |
| 15869 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15870 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15871 | 0 |
| 15872 | }, |
| 15873 | }; |
| 15874 | |
| 15875 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15876 | .ops = &snd_hda_bind_sw, |
| 15877 | .values = { |
| 15878 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15879 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15880 | 0 |
| 15881 | }, |
| 15882 | }; |
| 15883 | |
| 15884 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15885 | HDA_BIND_VOL("Master Playback Volume", |
| 15886 | &alc663_asus_two_bind_master_vol), |
| 15887 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15888 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15889 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15890 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15891 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15892 | { } /* end */ |
| 15893 | }; |
| 15894 | |
| 15895 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15896 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15897 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15898 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15899 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15900 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15901 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15902 | { } /* end */ |
| 15903 | }; |
| 15904 | |
| 15905 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15906 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15907 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15908 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15909 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15910 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15911 | |
| 15912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, 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 | |
| 15919 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15920 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15921 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15922 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15923 | |
| 15924 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15925 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15926 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15927 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15928 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15929 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15930 | { } /* end */ |
| 15931 | }; |
| 15932 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15933 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15934 | { |
| 15935 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15936 | .name = "Channel Mode", |
| 15937 | .info = alc_ch_mode_info, |
| 15938 | .get = alc_ch_mode_get, |
| 15939 | .put = alc_ch_mode_put, |
| 15940 | }, |
| 15941 | { } /* end */ |
| 15942 | }; |
| 15943 | |
| 15944 | static struct hda_verb alc662_init_verbs[] = { |
| 15945 | /* ADC: mute amp left and right */ |
| 15946 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15947 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15948 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15949 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15950 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15951 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15952 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15953 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15954 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15955 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15956 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15957 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15958 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15959 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15960 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15961 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15962 | |
| 15963 | /* Front Pin: output 0 (0x0c) */ |
| 15964 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15965 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15966 | |
| 15967 | /* Rear Pin: output 1 (0x0d) */ |
| 15968 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15969 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15970 | |
| 15971 | /* CLFE Pin: output 2 (0x0e) */ |
| 15972 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15973 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15974 | |
| 15975 | /* Mic (rear) pin: input vref at 80% */ |
| 15976 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15977 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15978 | /* Front Mic pin: input vref at 80% */ |
| 15979 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15980 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15981 | /* Line In pin: input */ |
| 15982 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15983 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15984 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15985 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15986 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15987 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15988 | /* CD pin widget for input */ |
| 15989 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15990 | |
| 15991 | /* FIXME: use matrix-type input source selection */ |
| 15992 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15993 | /* Input mixer */ |
| 15994 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15996 | |
| 15997 | /* always trun on EAPD */ |
| 15998 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15999 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16000 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16001 | { } |
| 16002 | }; |
| 16003 | |
| 16004 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 16005 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16006 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16007 | {} |
| 16008 | }; |
| 16009 | |
| 16010 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 16011 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16012 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16013 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16014 | }; |
| 16015 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16016 | /* Set Unsolicited Event*/ |
| 16017 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 16018 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16019 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16020 | {} |
| 16021 | }; |
| 16022 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16023 | /* |
| 16024 | * generic initialization of ADC, input mixers and output mixers |
| 16025 | */ |
| 16026 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 16027 | /* |
| 16028 | * Unmute ADC and set the default input to mic-in |
| 16029 | */ |
| 16030 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16031 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16032 | |
| 16033 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 16034 | * mixer widget |
| 16035 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 16036 | * panel mic (mic 2) |
| 16037 | */ |
| 16038 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16044 | |
| 16045 | /* |
| 16046 | * Set up output mixers (0x0c - 0x0f) |
| 16047 | */ |
| 16048 | /* set vol=0 to output mixers */ |
| 16049 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16050 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16051 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16052 | |
| 16053 | /* set up input amps for analog loopback */ |
| 16054 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16055 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16056 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16057 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16058 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16059 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16060 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16061 | |
| 16062 | |
| 16063 | /* FIXME: use matrix-type input source selection */ |
| 16064 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16065 | /* Input mixer */ |
| 16066 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16067 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16068 | { } |
| 16069 | }; |
| 16070 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16071 | /* additional verbs for ALC663 */ |
| 16072 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16073 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16074 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16075 | { } |
| 16076 | }; |
| 16077 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16078 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16079 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16080 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16081 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16082 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16083 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16084 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16086 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16087 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16088 | {} |
| 16089 | }; |
| 16090 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16091 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16092 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16093 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16094 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16095 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16096 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16097 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16098 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16099 | {} |
| 16100 | }; |
| 16101 | |
| 16102 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16103 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16104 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16105 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16106 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16107 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16108 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16109 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16110 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16111 | {} |
| 16112 | }; |
| 16113 | |
| 16114 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16115 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16116 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16117 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16118 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16119 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16120 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16121 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16122 | {} |
| 16123 | }; |
| 16124 | |
| 16125 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16126 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16127 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16128 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16129 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16130 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16131 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16132 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16133 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16134 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16135 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16136 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16137 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16138 | {} |
| 16139 | }; |
| 16140 | |
| 16141 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16142 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16143 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16144 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16145 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16146 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16147 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16148 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16149 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16150 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16151 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16152 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16153 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16154 | {} |
| 16155 | }; |
| 16156 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16157 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16158 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16159 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16160 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16161 | |
| 16162 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16163 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16164 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16165 | |
| 16166 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16167 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16168 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16169 | {} |
| 16170 | }; |
| 16171 | |
| 16172 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16173 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16174 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16175 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16176 | |
| 16177 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16178 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16179 | {} |
| 16180 | }; |
| 16181 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16182 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16183 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16185 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16186 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16187 | {} |
| 16188 | }; |
| 16189 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16190 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16191 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16192 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16193 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16194 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16195 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16196 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16197 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16198 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16199 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16200 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16201 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16202 | {} |
| 16203 | }; |
| 16204 | |
| 16205 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16206 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16207 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16208 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16209 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16210 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16211 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16212 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16213 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16214 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16215 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16216 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16217 | {} |
| 16218 | }; |
| 16219 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16220 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16221 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16222 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16223 | { } /* end */ |
| 16224 | }; |
| 16225 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16226 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16227 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16228 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16229 | { } /* end */ |
| 16230 | }; |
| 16231 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16232 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16233 | { |
| 16234 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16235 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16236 | |
| 16237 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16238 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16239 | bits = present ? HDA_AMP_MUTE : 0; |
| 16240 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16241 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16242 | } |
| 16243 | |
| 16244 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16245 | { |
| 16246 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16247 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16248 | |
| 16249 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16250 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16251 | bits = present ? HDA_AMP_MUTE : 0; |
| 16252 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16253 | HDA_AMP_MUTE, bits); |
| 16254 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16255 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16256 | } |
| 16257 | |
| 16258 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16259 | unsigned int res) |
| 16260 | { |
| 16261 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16262 | alc662_lenovo_101e_all_automute(codec); |
| 16263 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16264 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16265 | } |
| 16266 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16267 | /* unsolicited event for HP jack sensing */ |
| 16268 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16269 | unsigned int res) |
| 16270 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16271 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16272 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16273 | else |
| 16274 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16275 | } |
| 16276 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16277 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16278 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16279 | struct alc_spec *spec = codec->spec; |
| 16280 | |
| 16281 | alc262_hippo1_setup(codec); |
| 16282 | spec->ext_mic.pin = 0x18; |
| 16283 | spec->ext_mic.mux_idx = 0; |
| 16284 | spec->int_mic.pin = 0x19; |
| 16285 | spec->int_mic.mux_idx = 1; |
| 16286 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16287 | } |
| 16288 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16289 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16290 | { |
| 16291 | alc262_hippo_automute(codec); |
| 16292 | alc_mic_automute(codec); |
| 16293 | } |
| 16294 | |
| 16295 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16296 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16297 | struct alc_spec *spec = codec->spec; |
| 16298 | |
| 16299 | spec->autocfg.hp_pins[0] = 0x14; |
| 16300 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16301 | } |
| 16302 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16303 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 16304 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16305 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16306 | { |
| 16307 | unsigned int present; |
| 16308 | unsigned char bits; |
| 16309 | |
| 16310 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16311 | AC_VERB_GET_PIN_SENSE, 0) |
| 16312 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16313 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16314 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16315 | AMP_IN_MUTE(0), bits); |
| 16316 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16317 | AMP_IN_MUTE(0), bits); |
| 16318 | } |
| 16319 | |
| 16320 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16321 | { |
| 16322 | unsigned int present; |
| 16323 | unsigned char bits; |
| 16324 | |
| 16325 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16326 | AC_VERB_GET_PIN_SENSE, 0) |
| 16327 | & AC_PINSENSE_PRESENCE; |
| 16328 | bits = present ? HDA_AMP_MUTE : 0; |
| 16329 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16330 | AMP_IN_MUTE(0), bits); |
| 16331 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16332 | AMP_IN_MUTE(0), bits); |
| 16333 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16334 | AMP_IN_MUTE(0), bits); |
| 16335 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16336 | AMP_IN_MUTE(0), bits); |
| 16337 | } |
| 16338 | |
| 16339 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16340 | { |
| 16341 | unsigned int present; |
| 16342 | unsigned char bits; |
| 16343 | |
| 16344 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16345 | AC_VERB_GET_PIN_SENSE, 0) |
| 16346 | & AC_PINSENSE_PRESENCE; |
| 16347 | bits = present ? HDA_AMP_MUTE : 0; |
| 16348 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16349 | AMP_IN_MUTE(0), bits); |
| 16350 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16351 | AMP_IN_MUTE(0), bits); |
| 16352 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16353 | AMP_IN_MUTE(0), bits); |
| 16354 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16355 | AMP_IN_MUTE(0), bits); |
| 16356 | } |
| 16357 | |
| 16358 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16359 | { |
| 16360 | unsigned int present; |
| 16361 | unsigned char bits; |
| 16362 | |
| 16363 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16364 | AC_VERB_GET_PIN_SENSE, 0) |
| 16365 | & AC_PINSENSE_PRESENCE; |
| 16366 | bits = present ? 0 : PIN_OUT; |
| 16367 | snd_hda_codec_write(codec, 0x14, 0, |
| 16368 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16369 | } |
| 16370 | |
| 16371 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16372 | { |
| 16373 | unsigned int present1, present2; |
| 16374 | |
| 16375 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16376 | AC_VERB_GET_PIN_SENSE, 0) |
| 16377 | & AC_PINSENSE_PRESENCE; |
| 16378 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16379 | AC_VERB_GET_PIN_SENSE, 0) |
| 16380 | & AC_PINSENSE_PRESENCE; |
| 16381 | |
| 16382 | if (present1 || present2) { |
| 16383 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16384 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16385 | } else { |
| 16386 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16387 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16388 | } |
| 16389 | } |
| 16390 | |
| 16391 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16392 | { |
| 16393 | unsigned int present1, present2; |
| 16394 | |
| 16395 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16396 | AC_VERB_GET_PIN_SENSE, 0) |
| 16397 | & AC_PINSENSE_PRESENCE; |
| 16398 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16399 | AC_VERB_GET_PIN_SENSE, 0) |
| 16400 | & AC_PINSENSE_PRESENCE; |
| 16401 | |
| 16402 | if (present1 || present2) { |
| 16403 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16404 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16405 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16406 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16407 | } else { |
| 16408 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16409 | AMP_IN_MUTE(0), 0); |
| 16410 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16411 | AMP_IN_MUTE(0), 0); |
| 16412 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16413 | } |
| 16414 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16415 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16416 | unsigned int res) |
| 16417 | { |
| 16418 | switch (res >> 26) { |
| 16419 | case ALC880_HP_EVENT: |
| 16420 | alc663_m51va_speaker_automute(codec); |
| 16421 | break; |
| 16422 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16423 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16424 | break; |
| 16425 | } |
| 16426 | } |
| 16427 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16428 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 16429 | { |
| 16430 | struct alc_spec *spec = codec->spec; |
| 16431 | spec->ext_mic.pin = 0x18; |
| 16432 | spec->ext_mic.mux_idx = 0; |
| 16433 | spec->int_mic.pin = 0x12; |
| 16434 | spec->int_mic.mux_idx = 1; |
| 16435 | spec->auto_mic = 1; |
| 16436 | } |
| 16437 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16438 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16439 | { |
| 16440 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16441 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16442 | } |
| 16443 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16444 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16445 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
| 16446 | #define alc663_mode1_setup alc663_m51va_setup |
| 16447 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16448 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16449 | /* ***************** Mode2 ******************************/ |
| 16450 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16451 | unsigned int res) |
| 16452 | { |
| 16453 | switch (res >> 26) { |
| 16454 | case ALC880_HP_EVENT: |
| 16455 | alc662_f5z_speaker_automute(codec); |
| 16456 | break; |
| 16457 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16458 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16459 | break; |
| 16460 | } |
| 16461 | } |
| 16462 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16463 | #define alc662_mode2_setup alc663_m51va_setup |
| 16464 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16465 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16466 | { |
| 16467 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16468 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16469 | } |
| 16470 | /* ***************** Mode3 ******************************/ |
| 16471 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16472 | unsigned int res) |
| 16473 | { |
| 16474 | switch (res >> 26) { |
| 16475 | case ALC880_HP_EVENT: |
| 16476 | alc663_two_hp_m1_speaker_automute(codec); |
| 16477 | break; |
| 16478 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16479 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16480 | break; |
| 16481 | } |
| 16482 | } |
| 16483 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16484 | #define alc663_mode3_setup alc663_m51va_setup |
| 16485 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16486 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16487 | { |
| 16488 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16489 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16490 | } |
| 16491 | /* ***************** Mode4 ******************************/ |
| 16492 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16493 | unsigned int res) |
| 16494 | { |
| 16495 | switch (res >> 26) { |
| 16496 | case ALC880_HP_EVENT: |
| 16497 | alc663_21jd_two_speaker_automute(codec); |
| 16498 | break; |
| 16499 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16500 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16501 | break; |
| 16502 | } |
| 16503 | } |
| 16504 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16505 | #define alc663_mode4_setup alc663_m51va_setup |
| 16506 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16507 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16508 | { |
| 16509 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16510 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16511 | } |
| 16512 | /* ***************** Mode5 ******************************/ |
| 16513 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16514 | unsigned int res) |
| 16515 | { |
| 16516 | switch (res >> 26) { |
| 16517 | case ALC880_HP_EVENT: |
| 16518 | alc663_15jd_two_speaker_automute(codec); |
| 16519 | break; |
| 16520 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16521 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16522 | break; |
| 16523 | } |
| 16524 | } |
| 16525 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16526 | #define alc663_mode5_setup alc663_m51va_setup |
| 16527 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16528 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16529 | { |
| 16530 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16531 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16532 | } |
| 16533 | /* ***************** Mode6 ******************************/ |
| 16534 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16535 | unsigned int res) |
| 16536 | { |
| 16537 | switch (res >> 26) { |
| 16538 | case ALC880_HP_EVENT: |
| 16539 | alc663_two_hp_m2_speaker_automute(codec); |
| 16540 | break; |
| 16541 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16542 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16543 | break; |
| 16544 | } |
| 16545 | } |
| 16546 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16547 | #define alc663_mode6_setup alc663_m51va_setup |
| 16548 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16549 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16550 | { |
| 16551 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16552 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16553 | } |
| 16554 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16555 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16556 | { |
| 16557 | unsigned int present; |
| 16558 | unsigned char bits; |
| 16559 | |
| 16560 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16561 | AC_VERB_GET_PIN_SENSE, 0) |
| 16562 | & AC_PINSENSE_PRESENCE; |
| 16563 | bits = present ? HDA_AMP_MUTE : 0; |
| 16564 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16565 | HDA_AMP_MUTE, bits); |
| 16566 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16567 | HDA_AMP_MUTE, bits); |
| 16568 | } |
| 16569 | |
| 16570 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16571 | { |
| 16572 | unsigned int present; |
| 16573 | unsigned char bits; |
| 16574 | |
| 16575 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16576 | AC_VERB_GET_PIN_SENSE, 0) |
| 16577 | & AC_PINSENSE_PRESENCE; |
| 16578 | bits = present ? HDA_AMP_MUTE : 0; |
| 16579 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16580 | HDA_AMP_MUTE, bits); |
| 16581 | } |
| 16582 | |
| 16583 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16584 | unsigned int res) |
| 16585 | { |
| 16586 | switch (res >> 26) { |
| 16587 | case ALC880_HP_EVENT: |
| 16588 | alc663_g71v_hp_automute(codec); |
| 16589 | break; |
| 16590 | case ALC880_FRONT_EVENT: |
| 16591 | alc663_g71v_front_automute(codec); |
| 16592 | break; |
| 16593 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16594 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16595 | break; |
| 16596 | } |
| 16597 | } |
| 16598 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16599 | #define alc663_g71v_setup alc663_m51va_setup |
| 16600 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16601 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16602 | { |
| 16603 | alc663_g71v_front_automute(codec); |
| 16604 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16605 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16606 | } |
| 16607 | |
| 16608 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16609 | unsigned int res) |
| 16610 | { |
| 16611 | switch (res >> 26) { |
| 16612 | case ALC880_HP_EVENT: |
| 16613 | alc663_m51va_speaker_automute(codec); |
| 16614 | break; |
| 16615 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16616 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16617 | break; |
| 16618 | } |
| 16619 | } |
| 16620 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16621 | #define alc663_g50v_setup alc663_m51va_setup |
| 16622 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16623 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16624 | { |
| 16625 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16626 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16627 | } |
| 16628 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16629 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16630 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16631 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16632 | |
| 16633 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16634 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16635 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16636 | |
| 16637 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16638 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16639 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16640 | { } /* end */ |
| 16641 | }; |
| 16642 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16643 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16644 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16645 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16646 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16647 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16648 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16649 | |
| 16650 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16651 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16652 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16653 | |
| 16654 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16655 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16656 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16657 | { } /* end */ |
| 16658 | }; |
| 16659 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16660 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16661 | #define alc662_loopbacks alc880_loopbacks |
| 16662 | #endif |
| 16663 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16664 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16665 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16666 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16667 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16668 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16669 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16670 | |
| 16671 | /* |
| 16672 | * configuration and preset |
| 16673 | */ |
| 16674 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16675 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16676 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16677 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16678 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16679 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16680 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16681 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16682 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16683 | [ALC663_ASUS_M51VA] = "m51va", |
| 16684 | [ALC663_ASUS_G71V] = "g71v", |
| 16685 | [ALC663_ASUS_H13] = "h13", |
| 16686 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16687 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16688 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16689 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16690 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16691 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16692 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16693 | [ALC272_DELL] = "dell", |
| 16694 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16695 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16696 | [ALC662_AUTO] = "auto", |
| 16697 | }; |
| 16698 | |
| 16699 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16700 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16701 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16702 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16703 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16704 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16705 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16706 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16707 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16708 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16709 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16710 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16711 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16712 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16713 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16714 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16715 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16716 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16717 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16718 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16719 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16720 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16721 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16722 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16723 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16724 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16725 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16726 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16727 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16728 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16729 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16730 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16731 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16732 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16733 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16734 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16735 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16736 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16737 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16738 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16739 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16740 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16741 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16742 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16743 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16744 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16745 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16746 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16747 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16748 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16749 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16750 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16751 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16752 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16753 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16754 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16755 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16756 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16757 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16758 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16759 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16760 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16761 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16762 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16763 | {} |
| 16764 | }; |
| 16765 | |
| 16766 | static struct alc_config_preset alc662_presets[] = { |
| 16767 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16768 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16769 | .init_verbs = { alc662_init_verbs }, |
| 16770 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16771 | .dac_nids = alc662_dac_nids, |
| 16772 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16773 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16774 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16775 | .channel_mode = alc662_3ST_2ch_modes, |
| 16776 | .input_mux = &alc662_capture_source, |
| 16777 | }, |
| 16778 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16779 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16780 | .init_verbs = { alc662_init_verbs }, |
| 16781 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16782 | .dac_nids = alc662_dac_nids, |
| 16783 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16784 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16785 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16786 | .channel_mode = alc662_3ST_6ch_modes, |
| 16787 | .need_dac_fix = 1, |
| 16788 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16789 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16790 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16791 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16792 | .init_verbs = { alc662_init_verbs }, |
| 16793 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16794 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16795 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16796 | .channel_mode = alc662_3ST_6ch_modes, |
| 16797 | .need_dac_fix = 1, |
| 16798 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16799 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16800 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16801 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16802 | .init_verbs = { alc662_init_verbs }, |
| 16803 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16804 | .dac_nids = alc662_dac_nids, |
| 16805 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16806 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16807 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16808 | .channel_mode = alc662_5stack_modes, |
| 16809 | .input_mux = &alc662_capture_source, |
| 16810 | }, |
| 16811 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16812 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16813 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16814 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16815 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16816 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16817 | .channel_mode = alc662_3ST_2ch_modes, |
| 16818 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16819 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16820 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16821 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16822 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16823 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16824 | .init_verbs = { alc662_init_verbs, |
| 16825 | alc662_eeepc_sue_init_verbs }, |
| 16826 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16827 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16828 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16829 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16830 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16831 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16832 | .init_hook = alc662_eeepc_inithook, |
| 16833 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16834 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16835 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16836 | alc662_chmode_mixer }, |
| 16837 | .init_verbs = { alc662_init_verbs, |
| 16838 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16839 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16840 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16841 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16842 | .channel_mode = alc662_3ST_6ch_modes, |
| 16843 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16844 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16845 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16846 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16847 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16848 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16849 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16850 | .init_verbs = { alc662_init_verbs, |
| 16851 | alc662_ecs_init_verbs }, |
| 16852 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16853 | .dac_nids = alc662_dac_nids, |
| 16854 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16855 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16856 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16857 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16858 | .init_hook = alc662_eeepc_inithook, |
| 16859 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16860 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16861 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16862 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16863 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16864 | .dac_nids = alc662_dac_nids, |
| 16865 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16866 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16867 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16868 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16869 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16870 | .init_hook = alc663_m51va_inithook, |
| 16871 | }, |
| 16872 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16873 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16874 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16875 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16876 | .dac_nids = alc662_dac_nids, |
| 16877 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16878 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16879 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16880 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16881 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16882 | .init_hook = alc663_g71v_inithook, |
| 16883 | }, |
| 16884 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16885 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16886 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16887 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16888 | .dac_nids = alc662_dac_nids, |
| 16889 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16890 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16891 | .unsol_event = alc663_m51va_unsol_event, |
| 16892 | .init_hook = alc663_m51va_inithook, |
| 16893 | }, |
| 16894 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16895 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16896 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16897 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16898 | .dac_nids = alc662_dac_nids, |
| 16899 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16900 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16901 | .channel_mode = alc662_3ST_6ch_modes, |
| 16902 | .input_mux = &alc663_capture_source, |
| 16903 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16904 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16905 | .init_hook = alc663_g50v_inithook, |
| 16906 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16907 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16908 | .mixers = { alc663_m51va_mixer }, |
| 16909 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16910 | .init_verbs = { alc662_init_verbs, |
| 16911 | alc663_21jd_amic_init_verbs }, |
| 16912 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16913 | .hp_nid = 0x03, |
| 16914 | .dac_nids = alc662_dac_nids, |
| 16915 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16916 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16917 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16918 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16919 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16920 | .init_hook = alc663_mode1_inithook, |
| 16921 | }, |
| 16922 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16923 | .mixers = { alc662_1bjd_mixer }, |
| 16924 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16925 | .init_verbs = { alc662_init_verbs, |
| 16926 | alc662_1bjd_amic_init_verbs }, |
| 16927 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16928 | .dac_nids = alc662_dac_nids, |
| 16929 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16930 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16931 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16932 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16933 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16934 | .init_hook = alc662_mode2_inithook, |
| 16935 | }, |
| 16936 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16937 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16938 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16939 | .init_verbs = { alc662_init_verbs, |
| 16940 | alc663_two_hp_amic_m1_init_verbs }, |
| 16941 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16942 | .hp_nid = 0x03, |
| 16943 | .dac_nids = alc662_dac_nids, |
| 16944 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16945 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16946 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16947 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16948 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16949 | .init_hook = alc663_mode3_inithook, |
| 16950 | }, |
| 16951 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16952 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16953 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16954 | .init_verbs = { alc662_init_verbs, |
| 16955 | alc663_21jd_amic_init_verbs}, |
| 16956 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16957 | .hp_nid = 0x03, |
| 16958 | .dac_nids = alc662_dac_nids, |
| 16959 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16960 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16961 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16962 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16963 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16964 | .init_hook = alc663_mode4_inithook, |
| 16965 | }, |
| 16966 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16967 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16968 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16969 | .init_verbs = { alc662_init_verbs, |
| 16970 | alc663_15jd_amic_init_verbs }, |
| 16971 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16972 | .hp_nid = 0x03, |
| 16973 | .dac_nids = alc662_dac_nids, |
| 16974 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16975 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16976 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16977 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16978 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16979 | .init_hook = alc663_mode5_inithook, |
| 16980 | }, |
| 16981 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16982 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16983 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16984 | .init_verbs = { alc662_init_verbs, |
| 16985 | alc663_two_hp_amic_m2_init_verbs }, |
| 16986 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16987 | .hp_nid = 0x03, |
| 16988 | .dac_nids = alc662_dac_nids, |
| 16989 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16990 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16991 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16992 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16993 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16994 | .init_hook = alc663_mode6_inithook, |
| 16995 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16996 | [ALC272_DELL] = { |
| 16997 | .mixers = { alc663_m51va_mixer }, |
| 16998 | .cap_mixer = alc272_auto_capture_mixer, |
| 16999 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 17000 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17001 | .dac_nids = alc662_dac_nids, |
| 17002 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17003 | .adc_nids = alc272_adc_nids, |
| 17004 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 17005 | .capsrc_nids = alc272_capsrc_nids, |
| 17006 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17007 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17008 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17009 | .init_hook = alc663_m51va_inithook, |
| 17010 | }, |
| 17011 | [ALC272_DELL_ZM1] = { |
| 17012 | .mixers = { alc663_m51va_mixer }, |
| 17013 | .cap_mixer = alc662_auto_capture_mixer, |
| 17014 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 17015 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17016 | .dac_nids = alc662_dac_nids, |
| 17017 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17018 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17019 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17020 | .capsrc_nids = alc662_capsrc_nids, |
| 17021 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17022 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17023 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17024 | .init_hook = alc663_m51va_inithook, |
| 17025 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17026 | [ALC272_SAMSUNG_NC10] = { |
| 17027 | .mixers = { alc272_nc10_mixer }, |
| 17028 | .init_verbs = { alc662_init_verbs, |
| 17029 | alc663_21jd_amic_init_verbs }, |
| 17030 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17031 | .dac_nids = alc272_dac_nids, |
| 17032 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17033 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17034 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17035 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17036 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17037 | .init_hook = alc663_mode4_inithook, |
| 17038 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17039 | }; |
| 17040 | |
| 17041 | |
| 17042 | /* |
| 17043 | * BIOS auto configuration |
| 17044 | */ |
| 17045 | |
| 17046 | /* add playback controls from the parsed DAC table */ |
| 17047 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17048 | const struct auto_pin_cfg *cfg) |
| 17049 | { |
| 17050 | char name[32]; |
| 17051 | static const char *chname[4] = { |
| 17052 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17053 | }; |
| 17054 | hda_nid_t nid; |
| 17055 | int i, err; |
| 17056 | |
| 17057 | for (i = 0; i < cfg->line_outs; i++) { |
| 17058 | if (!spec->multiout.dac_nids[i]) |
| 17059 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17060 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17061 | if (i == 2) { |
| 17062 | /* Center/LFE */ |
| 17063 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17064 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17065 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 17066 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17067 | if (err < 0) |
| 17068 | return err; |
| 17069 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17070 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17071 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 17072 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17073 | if (err < 0) |
| 17074 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17075 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17076 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17077 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17078 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17079 | if (err < 0) |
| 17080 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17081 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17082 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17083 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17084 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17085 | if (err < 0) |
| 17086 | return err; |
| 17087 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17088 | const char *pfx; |
| 17089 | if (cfg->line_outs == 1 && |
| 17090 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 17091 | if (!cfg->hp_pins) |
| 17092 | pfx = "Speaker"; |
| 17093 | else |
| 17094 | pfx = "PCM"; |
| 17095 | } else |
| 17096 | pfx = chname[i]; |
| 17097 | sprintf(name, "%s Playback Volume", pfx); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17098 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17099 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 17100 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17101 | if (err < 0) |
| 17102 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17103 | if (cfg->line_outs == 1 && |
| 17104 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 17105 | pfx = "Speaker"; |
| 17106 | sprintf(name, "%s Playback Switch", pfx); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17107 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17108 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 17109 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17110 | if (err < 0) |
| 17111 | return err; |
| 17112 | } |
| 17113 | } |
| 17114 | return 0; |
| 17115 | } |
| 17116 | |
| 17117 | /* add playback controls for speaker and HP outputs */ |
| 17118 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 17119 | const char *pfx) |
| 17120 | { |
| 17121 | hda_nid_t nid; |
| 17122 | int err; |
| 17123 | char name[32]; |
| 17124 | |
| 17125 | if (!pin) |
| 17126 | return 0; |
| 17127 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17128 | if (pin == 0x17) { |
| 17129 | /* ALC663 has a mono output pin on 0x17 */ |
| 17130 | sprintf(name, "%s Playback Switch", pfx); |
| 17131 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17132 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 17133 | return err; |
| 17134 | } |
| 17135 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17136 | if (alc880_is_fixed_pin(pin)) { |
| 17137 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 17138 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17139 | /* specify the DAC as the extra output */ |
| 17140 | if (!spec->multiout.hp_nid) |
| 17141 | spec->multiout.hp_nid = nid; |
| 17142 | else |
| 17143 | spec->multiout.extra_out_nid[0] = nid; |
| 17144 | /* control HP volume/switch on the output mixer amp */ |
| 17145 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17146 | sprintf(name, "%s Playback Volume", pfx); |
| 17147 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 17148 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 17149 | if (err < 0) |
| 17150 | return err; |
| 17151 | sprintf(name, "%s Playback Switch", pfx); |
| 17152 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 17153 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 17154 | if (err < 0) |
| 17155 | return err; |
| 17156 | } else if (alc880_is_multi_pin(pin)) { |
| 17157 | /* set manual connection */ |
| 17158 | /* we have only a switch on HP-out PIN */ |
| 17159 | sprintf(name, "%s Playback Switch", pfx); |
| 17160 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17161 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17162 | if (err < 0) |
| 17163 | return err; |
| 17164 | } |
| 17165 | return 0; |
| 17166 | } |
| 17167 | |
| 17168 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17169 | #define alc662_auto_create_input_ctls \ |
| 17170 | alc880_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17171 | |
| 17172 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17173 | hda_nid_t nid, int pin_type, |
| 17174 | int dac_idx) |
| 17175 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17176 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17177 | /* need the manual connection? */ |
| 17178 | if (alc880_is_multi_pin(nid)) { |
| 17179 | struct alc_spec *spec = codec->spec; |
| 17180 | int idx = alc880_multi_pin_idx(nid); |
| 17181 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 17182 | AC_VERB_SET_CONNECT_SEL, |
| 17183 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 17184 | } |
| 17185 | } |
| 17186 | |
| 17187 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17188 | { |
| 17189 | struct alc_spec *spec = codec->spec; |
| 17190 | int i; |
| 17191 | |
| 17192 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17193 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17194 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17195 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17196 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17197 | i); |
| 17198 | } |
| 17199 | } |
| 17200 | |
| 17201 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17202 | { |
| 17203 | struct alc_spec *spec = codec->spec; |
| 17204 | hda_nid_t pin; |
| 17205 | |
| 17206 | pin = spec->autocfg.hp_pins[0]; |
| 17207 | if (pin) /* connect to front */ |
| 17208 | /* use dac 0 */ |
| 17209 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17210 | pin = spec->autocfg.speaker_pins[0]; |
| 17211 | if (pin) |
| 17212 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17213 | } |
| 17214 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17215 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17216 | |
| 17217 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17218 | { |
| 17219 | struct alc_spec *spec = codec->spec; |
| 17220 | int i; |
| 17221 | |
| 17222 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17223 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17224 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17225 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17226 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17227 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17228 | snd_hda_codec_write(codec, nid, 0, |
| 17229 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17230 | AMP_OUT_MUTE); |
| 17231 | } |
| 17232 | } |
| 17233 | } |
| 17234 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17235 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17236 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17237 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17238 | { |
| 17239 | struct alc_spec *spec = codec->spec; |
| 17240 | int err; |
| 17241 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17242 | |
| 17243 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17244 | alc662_ignore); |
| 17245 | if (err < 0) |
| 17246 | return err; |
| 17247 | if (!spec->autocfg.line_outs) |
| 17248 | return 0; /* can't find valid BIOS pin config */ |
| 17249 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17250 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17251 | if (err < 0) |
| 17252 | return err; |
| 17253 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17254 | if (err < 0) |
| 17255 | return err; |
| 17256 | err = alc662_auto_create_extra_out(spec, |
| 17257 | spec->autocfg.speaker_pins[0], |
| 17258 | "Speaker"); |
| 17259 | if (err < 0) |
| 17260 | return err; |
| 17261 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17262 | "Headphone"); |
| 17263 | if (err < 0) |
| 17264 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17265 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17266 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17267 | return err; |
| 17268 | |
| 17269 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17270 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17271 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17272 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17273 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17274 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17275 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17276 | |
| 17277 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17278 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17279 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17280 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17281 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17282 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17283 | |
| 17284 | err = alc_auto_add_mic_boost(codec); |
| 17285 | if (err < 0) |
| 17286 | return err; |
| 17287 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17288 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17289 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17290 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17291 | } |
| 17292 | |
| 17293 | /* additional initialization for auto-configuration model */ |
| 17294 | static void alc662_auto_init(struct hda_codec *codec) |
| 17295 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17296 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17297 | alc662_auto_init_multi_out(codec); |
| 17298 | alc662_auto_init_hp_out(codec); |
| 17299 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17300 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17301 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17302 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17303 | } |
| 17304 | |
| 17305 | static int patch_alc662(struct hda_codec *codec) |
| 17306 | { |
| 17307 | struct alc_spec *spec; |
| 17308 | int err, board_config; |
| 17309 | |
| 17310 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17311 | if (!spec) |
| 17312 | return -ENOMEM; |
| 17313 | |
| 17314 | codec->spec = spec; |
| 17315 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17316 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17317 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17318 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17319 | alc662_models, |
| 17320 | alc662_cfg_tbl); |
| 17321 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17322 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17323 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17324 | board_config = ALC662_AUTO; |
| 17325 | } |
| 17326 | |
| 17327 | if (board_config == ALC662_AUTO) { |
| 17328 | /* automatic parse from the BIOS config */ |
| 17329 | err = alc662_parse_auto_config(codec); |
| 17330 | if (err < 0) { |
| 17331 | alc_free(codec); |
| 17332 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17333 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17334 | printk(KERN_INFO |
| 17335 | "hda_codec: Cannot set up configuration " |
| 17336 | "from BIOS. Using base mode...\n"); |
| 17337 | board_config = ALC662_3ST_2ch_DIG; |
| 17338 | } |
| 17339 | } |
| 17340 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17341 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17342 | if (err < 0) { |
| 17343 | alc_free(codec); |
| 17344 | return err; |
| 17345 | } |
| 17346 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17347 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17348 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17349 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17350 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17351 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17352 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17353 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17354 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17355 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17356 | if (!spec->adc_nids) { |
| 17357 | spec->adc_nids = alc662_adc_nids; |
| 17358 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17359 | } |
| 17360 | if (!spec->capsrc_nids) |
| 17361 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17362 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17363 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17364 | set_capture_mixer(codec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17365 | if (codec->vendor_id == 0x10ec0662) |
| 17366 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17367 | else |
| 17368 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17369 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17370 | spec->vmaster_nid = 0x02; |
| 17371 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17372 | codec->patch_ops = alc_patch_ops; |
| 17373 | if (board_config == ALC662_AUTO) |
| 17374 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17375 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17376 | if (!spec->loopback.amplist) |
| 17377 | spec->loopback.amplist = alc662_loopbacks; |
| 17378 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17379 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17380 | |
| 17381 | return 0; |
| 17382 | } |
| 17383 | |
| 17384 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17385 | * patch entries |
| 17386 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17387 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17388 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17389 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17390 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17391 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17392 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17393 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17394 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17395 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17396 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17397 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17398 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17399 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17400 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17401 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17402 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17403 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17404 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17405 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17406 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17407 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17408 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17409 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17410 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17411 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17412 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17413 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17414 | .patch = patch_alc882 }, |
| 17415 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
| 17416 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17417 | {} /* terminator */ |
| 17418 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17419 | |
| 17420 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17421 | |
| 17422 | MODULE_LICENSE("GPL"); |
| 17423 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17424 | |
| 17425 | static struct hda_codec_preset_list realtek_list = { |
| 17426 | .preset = snd_hda_preset_realtek, |
| 17427 | .owner = THIS_MODULE, |
| 17428 | }; |
| 17429 | |
| 17430 | static int __init patch_realtek_init(void) |
| 17431 | { |
| 17432 | return snd_hda_add_codec_preset(&realtek_list); |
| 17433 | } |
| 17434 | |
| 17435 | static void __exit patch_realtek_exit(void) |
| 17436 | { |
| 17437 | snd_hda_delete_codec_preset(&realtek_list); |
| 17438 | } |
| 17439 | |
| 17440 | module_init(patch_realtek_init) |
| 17441 | module_exit(patch_realtek_exit) |