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, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 211 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 212 | ALC882_MODEL_LAST, |
| 213 | }; |
| 214 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 215 | /* ALC883 models */ |
| 216 | enum { |
| 217 | ALC883_3ST_2ch_DIG, |
| 218 | ALC883_3ST_6ch_DIG, |
| 219 | ALC883_3ST_6ch, |
| 220 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 221 | ALC883_TARGA_DIG, |
| 222 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 223 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 224 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 225 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 226 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 227 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 228 | ALC888_ACER_ASPIRE_8930G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 229 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 230 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 231 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 232 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 233 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 234 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 235 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 236 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 237 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 238 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 239 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 240 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 241 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 242 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 243 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 244 | ALC888_ASUS_M90V, |
| 245 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 246 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 247 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 248 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 249 | ALC883_AUTO, |
| 250 | ALC883_MODEL_LAST, |
| 251 | }; |
| 252 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 253 | /* for GPIO Poll */ |
| 254 | #define GPIO_MASK 0x03 |
| 255 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 256 | /* extra amp-initialization sequence types */ |
| 257 | enum { |
| 258 | ALC_INIT_NONE, |
| 259 | ALC_INIT_DEFAULT, |
| 260 | ALC_INIT_GPIO1, |
| 261 | ALC_INIT_GPIO2, |
| 262 | ALC_INIT_GPIO3, |
| 263 | }; |
| 264 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | struct alc_spec { |
| 266 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 269 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 270 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 272 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 273 | * don't forget NULL |
| 274 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 275 | */ |
| 276 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 278 | char stream_name_analog[16]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | struct hda_pcm_stream *stream_analog_playback; |
| 280 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 281 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 282 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 284 | char stream_name_digital[16]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | struct hda_pcm_stream *stream_digital_playback; |
| 286 | struct hda_pcm_stream *stream_digital_capture; |
| 287 | |
| 288 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 289 | struct hda_multi_out multiout; /* playback set-up |
| 290 | * max_channels, dacs must be set |
| 291 | * dig_out_nid and hp_nid are optional |
| 292 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 293 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 294 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 295 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | |
| 297 | /* capture */ |
| 298 | unsigned int num_adc_nids; |
| 299 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 300 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 301 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | |
| 303 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 304 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | const struct hda_input_mux *input_mux; |
| 306 | unsigned int cur_mux[3]; |
| 307 | |
| 308 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 309 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 311 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 312 | int const_channel_count; |
| 313 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
| 315 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 316 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 317 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 318 | /* dynamic controls, init_verbs and input_mux */ |
| 319 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 320 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 321 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 322 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 323 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 324 | /* hooks */ |
| 325 | void (*init_hook)(struct hda_codec *codec); |
| 326 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 327 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 328 | /* for pin sensing */ |
| 329 | unsigned int sense_updated: 1; |
| 330 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 331 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 332 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 333 | /* other flags */ |
| 334 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 335 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 336 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 337 | /* for virtual master */ |
| 338 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 339 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 340 | struct hda_loopback_check loopback; |
| 341 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 342 | |
| 343 | /* for PLL fix */ |
| 344 | hda_nid_t pll_nid; |
| 345 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 346 | }; |
| 347 | |
| 348 | /* |
| 349 | * configuration template - to be copied to the spec instance |
| 350 | */ |
| 351 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 352 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 353 | * with spec |
| 354 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 355 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 356 | const struct hda_verb *init_verbs[5]; |
| 357 | unsigned int num_dacs; |
| 358 | hda_nid_t *dac_nids; |
| 359 | hda_nid_t dig_out_nid; /* optional */ |
| 360 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 361 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 362 | unsigned int num_adc_nids; |
| 363 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 364 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 365 | hda_nid_t dig_in_nid; |
| 366 | unsigned int num_channel_mode; |
| 367 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 368 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 369 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 370 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 371 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 372 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 373 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 374 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 375 | struct hda_amp_list *loopbacks; |
| 376 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | }; |
| 378 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | |
| 380 | /* |
| 381 | * input MUX handling |
| 382 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 383 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 384 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | { |
| 386 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 387 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 388 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 389 | if (mux_idx >= spec->num_mux_defs) |
| 390 | mux_idx = 0; |
| 391 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | } |
| 393 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 394 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 395 | struct snd_ctl_elem_value *ucontrol) |
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; |
| 399 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 400 | |
| 401 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 402 | return 0; |
| 403 | } |
| 404 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 405 | static int alc_mux_enum_put(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; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 410 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 412 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 413 | hda_nid_t nid = spec->capsrc_nids ? |
| 414 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 415 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 417 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 418 | imux = &spec->input_mux[mux_idx]; |
| 419 | |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 420 | type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 421 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 422 | /* Matrix-mixer style (e.g. ALC882) */ |
| 423 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 424 | unsigned int i, idx; |
| 425 | |
| 426 | idx = ucontrol->value.enumerated.item[0]; |
| 427 | if (idx >= imux->num_items) |
| 428 | idx = imux->num_items - 1; |
| 429 | if (*cur_val == idx) |
| 430 | return 0; |
| 431 | for (i = 0; i < imux->num_items; i++) { |
| 432 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 433 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 434 | imux->items[i].index, |
| 435 | HDA_AMP_MUTE, v); |
| 436 | } |
| 437 | *cur_val = idx; |
| 438 | return 1; |
| 439 | } else { |
| 440 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 441 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 442 | &spec->cur_mux[adc_idx]); |
| 443 | } |
| 444 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 445 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | /* |
| 447 | * channel mode setting |
| 448 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 449 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 450 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | { |
| 452 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 453 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 454 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 455 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | } |
| 457 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 458 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 459 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | { |
| 461 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 462 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 463 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 464 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 465 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | } |
| 467 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 468 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 469 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | { |
| 471 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 472 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 473 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 474 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 475 | &spec->ext_channel_count); |
| 476 | if (err >= 0 && !spec->const_channel_count) { |
| 477 | spec->multiout.max_channels = spec->ext_channel_count; |
| 478 | if (spec->need_dac_fix) |
| 479 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 480 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 481 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | } |
| 483 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 485 | * 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] | 486 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 487 | * being part of a format specifier. Maximum allowed length of a value is |
| 488 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 489 | * |
| 490 | * Note: some retasking pin complexes seem to ignore requests for input |
| 491 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 492 | * are requested. Therefore order this list so that this behaviour will not |
| 493 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 494 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 495 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 496 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 497 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 498 | "Mic 50pc bias", "Mic 80pc bias", |
| 499 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 500 | }; |
| 501 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 502 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 503 | }; |
| 504 | /* 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] | 505 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 506 | * addition, "input" pins may or may not process the mic bias option |
| 507 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 508 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 509 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 510 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 511 | #define ALC_PIN_DIR_IN 0x00 |
| 512 | #define ALC_PIN_DIR_OUT 0x01 |
| 513 | #define ALC_PIN_DIR_INOUT 0x02 |
| 514 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 515 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 516 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 517 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 518 | * For each direction the minimum and maximum values are given. |
| 519 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 520 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 521 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 522 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 523 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 524 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 525 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 526 | }; |
| 527 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 528 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 529 | #define alc_pin_mode_n_items(_dir) \ |
| 530 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 531 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 532 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 533 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 534 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 535 | unsigned int item_num = uinfo->value.enumerated.item; |
| 536 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 537 | |
| 538 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 539 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 540 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 541 | |
| 542 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 543 | item_num = alc_pin_mode_min(dir); |
| 544 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 545 | return 0; |
| 546 | } |
| 547 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 548 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 549 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 550 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 551 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 552 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 553 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 554 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 555 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 556 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 557 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 558 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 559 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 560 | /* Find enumerated value for current pinctl setting */ |
| 561 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 562 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 563 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 564 | *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] | 565 | return 0; |
| 566 | } |
| 567 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 568 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 569 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 570 | { |
| 571 | signed int change; |
| 572 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 573 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 574 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 575 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 576 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 577 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 578 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 579 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 580 | 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] | 581 | val = alc_pin_mode_min(dir); |
| 582 | |
| 583 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 584 | if (change) { |
| 585 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 586 | snd_hda_codec_write_cache(codec, nid, 0, |
| 587 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 588 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 589 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 590 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 591 | * for the requested pin mode. Enum values of 2 or less are |
| 592 | * input modes. |
| 593 | * |
| 594 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 595 | * reduces noise slightly (particularly on input) so we'll |
| 596 | * do it. However, having both input and output buffers |
| 597 | * enabled simultaneously doesn't seem to be problematic if |
| 598 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 599 | */ |
| 600 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 601 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 602 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 603 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 604 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 605 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 606 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 607 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 608 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 609 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 610 | } |
| 611 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 612 | return change; |
| 613 | } |
| 614 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 615 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 616 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 617 | .info = alc_pin_mode_info, \ |
| 618 | .get = alc_pin_mode_get, \ |
| 619 | .put = alc_pin_mode_put, \ |
| 620 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 621 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 622 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 623 | * together using a mask with more than one bit set. This control is |
| 624 | * currently used only by the ALC260 test model. At this stage they are not |
| 625 | * needed for any "production" models. |
| 626 | */ |
| 627 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 628 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 629 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 630 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 631 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 632 | { |
| 633 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 634 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 635 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 636 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 637 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 638 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 639 | |
| 640 | *valp = (val & mask) != 0; |
| 641 | return 0; |
| 642 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 643 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 644 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 645 | { |
| 646 | signed int change; |
| 647 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 648 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 649 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 650 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 651 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 652 | AC_VERB_GET_GPIO_DATA, |
| 653 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 654 | |
| 655 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 656 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 657 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 658 | gpio_data &= ~mask; |
| 659 | else |
| 660 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 661 | snd_hda_codec_write_cache(codec, nid, 0, |
| 662 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 663 | |
| 664 | return change; |
| 665 | } |
| 666 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 667 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 668 | .info = alc_gpio_data_info, \ |
| 669 | .get = alc_gpio_data_get, \ |
| 670 | .put = alc_gpio_data_put, \ |
| 671 | .private_value = nid | (mask<<16) } |
| 672 | #endif /* CONFIG_SND_DEBUG */ |
| 673 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 674 | /* A switch control to allow the enabling of the digital IO pins on the |
| 675 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 676 | * to provide something in the test model allowing digital outputs to be |
| 677 | * identified if present. If models are found which can utilise these |
| 678 | * outputs a more complete mixer control can be devised for those models if |
| 679 | * necessary. |
| 680 | */ |
| 681 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 682 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 683 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 684 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 685 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 686 | { |
| 687 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 688 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 689 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 690 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 691 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 692 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 693 | |
| 694 | *valp = (val & mask) != 0; |
| 695 | return 0; |
| 696 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 697 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 698 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 699 | { |
| 700 | signed int change; |
| 701 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 702 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 703 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 704 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 705 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 706 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 707 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 708 | |
| 709 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 710 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 711 | if (val==0) |
| 712 | ctrl_data &= ~mask; |
| 713 | else |
| 714 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 715 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 716 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 717 | |
| 718 | return change; |
| 719 | } |
| 720 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 721 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 722 | .info = alc_spdif_ctrl_info, \ |
| 723 | .get = alc_spdif_ctrl_get, \ |
| 724 | .put = alc_spdif_ctrl_put, \ |
| 725 | .private_value = nid | (mask<<16) } |
| 726 | #endif /* CONFIG_SND_DEBUG */ |
| 727 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 728 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 729 | * Again, this is only used in the ALC26x test models to help identify when |
| 730 | * the EAPD line must be asserted for features to work. |
| 731 | */ |
| 732 | #ifdef CONFIG_SND_DEBUG |
| 733 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 734 | |
| 735 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 736 | struct snd_ctl_elem_value *ucontrol) |
| 737 | { |
| 738 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 739 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 740 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 741 | long *valp = ucontrol->value.integer.value; |
| 742 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 743 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 744 | |
| 745 | *valp = (val & mask) != 0; |
| 746 | return 0; |
| 747 | } |
| 748 | |
| 749 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 750 | struct snd_ctl_elem_value *ucontrol) |
| 751 | { |
| 752 | int change; |
| 753 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 754 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 755 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 756 | long val = *ucontrol->value.integer.value; |
| 757 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 758 | AC_VERB_GET_EAPD_BTLENABLE, |
| 759 | 0x00); |
| 760 | |
| 761 | /* Set/unset the masked control bit(s) as needed */ |
| 762 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 763 | if (!val) |
| 764 | ctrl_data &= ~mask; |
| 765 | else |
| 766 | ctrl_data |= mask; |
| 767 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 768 | ctrl_data); |
| 769 | |
| 770 | return change; |
| 771 | } |
| 772 | |
| 773 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 774 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 775 | .info = alc_eapd_ctrl_info, \ |
| 776 | .get = alc_eapd_ctrl_get, \ |
| 777 | .put = alc_eapd_ctrl_put, \ |
| 778 | .private_value = nid | (mask<<16) } |
| 779 | #endif /* CONFIG_SND_DEBUG */ |
| 780 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 781 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 782 | * set up the input pin config (depending on the given auto-pin type) |
| 783 | */ |
| 784 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 785 | int auto_pin_type) |
| 786 | { |
| 787 | unsigned int val = PIN_IN; |
| 788 | |
| 789 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 790 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 791 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 792 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 793 | if (pincap & AC_PINCAP_VREF_80) |
| 794 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 795 | else if (pincap & AC_PINCAP_VREF_50) |
| 796 | val = PIN_VREF50; |
| 797 | else if (pincap & AC_PINCAP_VREF_100) |
| 798 | val = PIN_VREF100; |
| 799 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 800 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 801 | } |
| 802 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 803 | } |
| 804 | |
| 805 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 806 | */ |
| 807 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 808 | { |
| 809 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 810 | return; |
| 811 | spec->mixers[spec->num_mixers++] = mix; |
| 812 | } |
| 813 | |
| 814 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 815 | { |
| 816 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 817 | return; |
| 818 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 819 | } |
| 820 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 821 | #ifdef CONFIG_PROC_FS |
| 822 | /* |
| 823 | * hook for proc |
| 824 | */ |
| 825 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 826 | struct hda_codec *codec, hda_nid_t nid) |
| 827 | { |
| 828 | int coeff; |
| 829 | |
| 830 | if (nid != 0x20) |
| 831 | return; |
| 832 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 833 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 834 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 835 | AC_VERB_GET_COEF_INDEX, 0); |
| 836 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 837 | } |
| 838 | #else |
| 839 | #define print_realtek_coef NULL |
| 840 | #endif |
| 841 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 842 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 843 | * set up from the preset table |
| 844 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 845 | static void setup_preset(struct alc_spec *spec, |
| 846 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 847 | { |
| 848 | int i; |
| 849 | |
| 850 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 851 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 852 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 853 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 854 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 855 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 856 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 857 | spec->channel_mode = preset->channel_mode; |
| 858 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 859 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 860 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 861 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 862 | if (preset->const_channel_count) |
| 863 | spec->multiout.max_channels = preset->const_channel_count; |
| 864 | else |
| 865 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 866 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 867 | |
| 868 | spec->multiout.num_dacs = preset->num_dacs; |
| 869 | spec->multiout.dac_nids = preset->dac_nids; |
| 870 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 871 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 872 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 873 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 874 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 875 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 876 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 877 | spec->input_mux = preset->input_mux; |
| 878 | |
| 879 | spec->num_adc_nids = preset->num_adc_nids; |
| 880 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 881 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 882 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 883 | |
| 884 | spec->unsol_event = preset->unsol_event; |
| 885 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 886 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 887 | spec->loopback.amplist = preset->loopbacks; |
| 888 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 889 | } |
| 890 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 891 | /* Enable GPIO mask and set output */ |
| 892 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 893 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 894 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 895 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 896 | { } |
| 897 | }; |
| 898 | |
| 899 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 900 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 901 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 902 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 903 | { } |
| 904 | }; |
| 905 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 906 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 907 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 908 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 909 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 910 | { } |
| 911 | }; |
| 912 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 913 | /* |
| 914 | * Fix hardware PLL issue |
| 915 | * On some codecs, the analog PLL gating control must be off while |
| 916 | * the default value is 1. |
| 917 | */ |
| 918 | static void alc_fix_pll(struct hda_codec *codec) |
| 919 | { |
| 920 | struct alc_spec *spec = codec->spec; |
| 921 | unsigned int val; |
| 922 | |
| 923 | if (!spec->pll_nid) |
| 924 | return; |
| 925 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 926 | spec->pll_coef_idx); |
| 927 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 928 | AC_VERB_GET_PROC_COEF, 0); |
| 929 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 930 | spec->pll_coef_idx); |
| 931 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 932 | val & ~(1 << spec->pll_coef_bit)); |
| 933 | } |
| 934 | |
| 935 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 936 | unsigned int coef_idx, unsigned int coef_bit) |
| 937 | { |
| 938 | struct alc_spec *spec = codec->spec; |
| 939 | spec->pll_nid = nid; |
| 940 | spec->pll_coef_idx = coef_idx; |
| 941 | spec->pll_coef_bit = coef_bit; |
| 942 | alc_fix_pll(codec); |
| 943 | } |
| 944 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 945 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 946 | { |
| 947 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 948 | unsigned int present, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 949 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 950 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 951 | |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 952 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 953 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 954 | 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] | 955 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 956 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 957 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 958 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 959 | nid = spec->autocfg.speaker_pins[i]; |
| 960 | if (!nid) |
| 961 | break; |
| 962 | snd_hda_codec_write(codec, nid, 0, |
| 963 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 964 | spec->jack_present ? 0 : PIN_OUT); |
| 965 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 966 | } |
| 967 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 968 | #if 0 /* it's broken in some cases -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 969 | static void alc_mic_automute(struct hda_codec *codec) |
| 970 | { |
| 971 | struct alc_spec *spec = codec->spec; |
| 972 | unsigned int present; |
| 973 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 974 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 975 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 976 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 977 | |
| 978 | capsrc_idx_mic = mic_nid - 0x18; |
| 979 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 980 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 981 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 982 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 983 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 984 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 985 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 986 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 987 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 988 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 989 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 990 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 991 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 992 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 993 | /* unsolicited event for HP jack sensing */ |
| 994 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 995 | { |
| 996 | if (codec->vendor_id == 0x10ec0880) |
| 997 | res >>= 28; |
| 998 | else |
| 999 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1000 | switch (res) { |
| 1001 | case ALC880_HP_EVENT: |
| 1002 | alc_automute_pin(codec); |
| 1003 | break; |
| 1004 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1005 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1006 | break; |
| 1007 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1008 | } |
| 1009 | |
| 1010 | static void alc_inithook(struct hda_codec *codec) |
| 1011 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1012 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1013 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1014 | } |
| 1015 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1016 | /* additional initialization for ALC888 variants */ |
| 1017 | static void alc888_coef_init(struct hda_codec *codec) |
| 1018 | { |
| 1019 | unsigned int tmp; |
| 1020 | |
| 1021 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1022 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1023 | 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] | 1024 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1025 | /* alc888S-VC */ |
| 1026 | snd_hda_codec_read(codec, 0x20, 0, |
| 1027 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1028 | else |
| 1029 | /* alc888-VB */ |
| 1030 | snd_hda_codec_read(codec, 0x20, 0, |
| 1031 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1032 | } |
| 1033 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1034 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1035 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1036 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1037 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1038 | switch (type) { |
| 1039 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1040 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1041 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1042 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1043 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1044 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1045 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1046 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1047 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1048 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1049 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1050 | case 0x10ec0260: |
| 1051 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1052 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1053 | snd_hda_codec_write(codec, 0x10, 0, |
| 1054 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1055 | break; |
| 1056 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1057 | case 0x10ec0267: |
| 1058 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1059 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1060 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1061 | case 0x10ec0660: |
| 1062 | case 0x10ec0662: |
| 1063 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1064 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1065 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1066 | snd_hda_codec_write(codec, 0x14, 0, |
| 1067 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1068 | snd_hda_codec_write(codec, 0x15, 0, |
| 1069 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1070 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1071 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1072 | switch (codec->vendor_id) { |
| 1073 | case 0x10ec0260: |
| 1074 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1075 | AC_VERB_SET_COEF_INDEX, 7); |
| 1076 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1077 | AC_VERB_GET_PROC_COEF, 0); |
| 1078 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1079 | AC_VERB_SET_COEF_INDEX, 7); |
| 1080 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1081 | AC_VERB_SET_PROC_COEF, |
| 1082 | tmp | 0x2010); |
| 1083 | break; |
| 1084 | case 0x10ec0262: |
| 1085 | case 0x10ec0880: |
| 1086 | case 0x10ec0882: |
| 1087 | case 0x10ec0883: |
| 1088 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1089 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1090 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1091 | snd_hda_codec_write(codec, 0x20, 0, |
| 1092 | AC_VERB_SET_COEF_INDEX, 7); |
| 1093 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1094 | AC_VERB_GET_PROC_COEF, 0); |
| 1095 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1096 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1097 | snd_hda_codec_write(codec, 0x20, 0, |
| 1098 | AC_VERB_SET_PROC_COEF, |
| 1099 | tmp | 0x2010); |
| 1100 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1101 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1102 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1103 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1104 | case 0x10ec0267: |
| 1105 | case 0x10ec0268: |
| 1106 | snd_hda_codec_write(codec, 0x20, 0, |
| 1107 | AC_VERB_SET_COEF_INDEX, 7); |
| 1108 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1109 | AC_VERB_GET_PROC_COEF, 0); |
| 1110 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1111 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1112 | snd_hda_codec_write(codec, 0x20, 0, |
| 1113 | AC_VERB_SET_PROC_COEF, |
| 1114 | tmp | 0x3000); |
| 1115 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1116 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1117 | break; |
| 1118 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1119 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1120 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1121 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1122 | { |
| 1123 | struct alc_spec *spec = codec->spec; |
| 1124 | |
| 1125 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1126 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1127 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1128 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1129 | if (spec->autocfg.line_out_pins[0] && |
| 1130 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1131 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1132 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1133 | else |
| 1134 | return; |
| 1135 | } |
| 1136 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1137 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1138 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1139 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1140 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1141 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1142 | spec->unsol_event = alc_sku_unsol_event; |
| 1143 | } |
| 1144 | |
| 1145 | /* check subsystem ID and set up device-specific initialization; |
| 1146 | * return 1 if initialized, 0 if invalid SSID |
| 1147 | */ |
| 1148 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1149 | * 31 ~ 16 : Manufacture ID |
| 1150 | * 15 ~ 8 : SKU ID |
| 1151 | * 7 ~ 0 : Assembly ID |
| 1152 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1153 | */ |
| 1154 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1155 | hda_nid_t porta, hda_nid_t porte, |
| 1156 | hda_nid_t portd) |
| 1157 | { |
| 1158 | unsigned int ass, tmp, i; |
| 1159 | unsigned nid; |
| 1160 | struct alc_spec *spec = codec->spec; |
| 1161 | |
| 1162 | ass = codec->subsystem_id & 0xffff; |
| 1163 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1164 | goto do_sku; |
| 1165 | |
| 1166 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1167 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1168 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1169 | * 29~21 : reserve |
| 1170 | * 20 : PCBEEP input |
| 1171 | * 19~16 : Check sum (15:1) |
| 1172 | * 15~1 : Custom |
| 1173 | * 0 : override |
| 1174 | */ |
| 1175 | nid = 0x1d; |
| 1176 | if (codec->vendor_id == 0x10ec0260) |
| 1177 | nid = 0x17; |
| 1178 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1179 | snd_printd("realtek: No valid SSID, " |
| 1180 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1181 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1182 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1183 | return 0; |
| 1184 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1185 | return 0; |
| 1186 | |
| 1187 | /* check sum */ |
| 1188 | tmp = 0; |
| 1189 | for (i = 1; i < 16; i++) { |
| 1190 | if ((ass >> i) & 1) |
| 1191 | tmp++; |
| 1192 | } |
| 1193 | if (((ass >> 16) & 0xf) != tmp) |
| 1194 | return 0; |
| 1195 | do_sku: |
| 1196 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1197 | ass & 0xffff, codec->vendor_id); |
| 1198 | /* |
| 1199 | * 0 : override |
| 1200 | * 1 : Swap Jack |
| 1201 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1202 | * 3~5 : External Amplifier control |
| 1203 | * 7~6 : Reserved |
| 1204 | */ |
| 1205 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1206 | switch (tmp) { |
| 1207 | case 1: |
| 1208 | spec->init_amp = ALC_INIT_GPIO1; |
| 1209 | break; |
| 1210 | case 3: |
| 1211 | spec->init_amp = ALC_INIT_GPIO2; |
| 1212 | break; |
| 1213 | case 7: |
| 1214 | spec->init_amp = ALC_INIT_GPIO3; |
| 1215 | break; |
| 1216 | case 5: |
| 1217 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1218 | break; |
| 1219 | } |
| 1220 | |
| 1221 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1222 | * when the external headphone out jack is plugged" |
| 1223 | */ |
| 1224 | if (!(ass & 0x8000)) |
| 1225 | return 1; |
| 1226 | /* |
| 1227 | * 10~8 : Jack location |
| 1228 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1229 | * 14~13: Resvered |
| 1230 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1231 | * when the external headphone out jack is plugged" |
| 1232 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1233 | if (!spec->autocfg.hp_pins[0]) { |
| 1234 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1235 | if (tmp == 0) |
| 1236 | spec->autocfg.hp_pins[0] = porta; |
| 1237 | else if (tmp == 1) |
| 1238 | spec->autocfg.hp_pins[0] = porte; |
| 1239 | else if (tmp == 2) |
| 1240 | spec->autocfg.hp_pins[0] = portd; |
| 1241 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1242 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1243 | } |
| 1244 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1245 | alc_init_auto_hp(codec); |
| 1246 | return 1; |
| 1247 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1248 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1249 | static void alc_ssid_check(struct hda_codec *codec, |
| 1250 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1251 | { |
| 1252 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1253 | struct alc_spec *spec = codec->spec; |
| 1254 | snd_printd("realtek: " |
| 1255 | "Enable default setup for auto mode as fallback\n"); |
| 1256 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1257 | alc_init_auto_hp(codec); |
| 1258 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1259 | } |
| 1260 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1261 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1262 | * Fix-up pin default configurations |
| 1263 | */ |
| 1264 | |
| 1265 | struct alc_pincfg { |
| 1266 | hda_nid_t nid; |
| 1267 | u32 val; |
| 1268 | }; |
| 1269 | |
| 1270 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1271 | const struct snd_pci_quirk *quirk, |
| 1272 | const struct alc_pincfg **pinfix) |
| 1273 | { |
| 1274 | const struct alc_pincfg *cfg; |
| 1275 | |
| 1276 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1277 | if (!quirk) |
| 1278 | return; |
| 1279 | |
| 1280 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1281 | for (; cfg->nid; cfg++) |
| 1282 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1283 | } |
| 1284 | |
| 1285 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1286 | * ALC888 |
| 1287 | */ |
| 1288 | |
| 1289 | /* |
| 1290 | * 2ch mode |
| 1291 | */ |
| 1292 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1293 | /* Mic-in jack as mic in */ |
| 1294 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1295 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1296 | /* Line-in jack as Line in */ |
| 1297 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1298 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1299 | /* Line-Out as Front */ |
| 1300 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1301 | { } /* end */ |
| 1302 | }; |
| 1303 | |
| 1304 | /* |
| 1305 | * 4ch mode |
| 1306 | */ |
| 1307 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1308 | /* Mic-in jack as mic in */ |
| 1309 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1310 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1311 | /* Line-in jack as Surround */ |
| 1312 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1313 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1314 | /* Line-Out as Front */ |
| 1315 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1316 | { } /* end */ |
| 1317 | }; |
| 1318 | |
| 1319 | /* |
| 1320 | * 6ch mode |
| 1321 | */ |
| 1322 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1323 | /* Mic-in jack as CLFE */ |
| 1324 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1325 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1326 | /* Line-in jack as Surround */ |
| 1327 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1328 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1329 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1330 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1331 | { } /* end */ |
| 1332 | }; |
| 1333 | |
| 1334 | /* |
| 1335 | * 8ch mode |
| 1336 | */ |
| 1337 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1338 | /* Mic-in jack as CLFE */ |
| 1339 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1340 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1341 | /* Line-in jack as Surround */ |
| 1342 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1343 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1344 | /* Line-Out as Side */ |
| 1345 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1346 | { } /* end */ |
| 1347 | }; |
| 1348 | |
| 1349 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1350 | { 2, alc888_4ST_ch2_intel_init }, |
| 1351 | { 4, alc888_4ST_ch4_intel_init }, |
| 1352 | { 6, alc888_4ST_ch6_intel_init }, |
| 1353 | { 8, alc888_4ST_ch8_intel_init }, |
| 1354 | }; |
| 1355 | |
| 1356 | /* |
| 1357 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1358 | */ |
| 1359 | |
| 1360 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1361 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1362 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1363 | /* Connect Internal HP to Front */ |
| 1364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1365 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1366 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1367 | /* Connect Bass HP to Front */ |
| 1368 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1369 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1370 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1371 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1372 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1373 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1374 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1375 | /* Connect Mic jack to CLFE */ |
| 1376 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1377 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1378 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1379 | /* Connect Line-in jack to Surround */ |
| 1380 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1381 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1382 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1383 | /* Connect HP out jack to Front */ |
| 1384 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1385 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1386 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1387 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1388 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1389 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1390 | {} |
| 1391 | }; |
| 1392 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1393 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1394 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1395 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1396 | unsigned int val, mute, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1397 | hda_nid_t nid; |
| 1398 | int i; |
| 1399 | |
| 1400 | spec->jack_present = 0; |
| 1401 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1402 | nid = spec->autocfg.hp_pins[i]; |
| 1403 | if (!nid) |
| 1404 | break; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1405 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 1406 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 1407 | snd_hda_codec_read(codec, nid, 0, |
| 1408 | AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1409 | val = snd_hda_codec_read(codec, nid, 0, |
| 1410 | AC_VERB_GET_PIN_SENSE, 0); |
| 1411 | if (val & AC_PINSENSE_PRESENCE) { |
| 1412 | spec->jack_present = 1; |
| 1413 | break; |
| 1414 | } |
| 1415 | } |
| 1416 | |
| 1417 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1418 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1419 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1420 | nid = spec->autocfg.speaker_pins[i]; |
| 1421 | if (!nid) |
| 1422 | break; |
| 1423 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1424 | HDA_AMP_MUTE, mute); |
| 1425 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1426 | } |
| 1427 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1428 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1429 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1430 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1431 | if (codec->vendor_id == 0x10ec0880) |
| 1432 | res >>= 28; |
| 1433 | else |
| 1434 | res >>= 26; |
| 1435 | if (res == ALC880_HP_EVENT) |
| 1436 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1437 | } |
| 1438 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1439 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) |
| 1440 | { |
| 1441 | struct alc_spec *spec = codec->spec; |
| 1442 | |
| 1443 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1444 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1445 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1446 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
| 1447 | alc_automute_amp(codec); |
| 1448 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1449 | |
| 1450 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1451 | * ALC888 Acer Aspire 4930G model |
| 1452 | */ |
| 1453 | |
| 1454 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1455 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1456 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1457 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1459 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1460 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1461 | /* Connect Internal HP to front */ |
| 1462 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1463 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1464 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1465 | /* Connect HP out to front */ |
| 1466 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1467 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1468 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1469 | { } |
| 1470 | }; |
| 1471 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1472 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1473 | * ALC888 Acer Aspire 6530G model |
| 1474 | */ |
| 1475 | |
| 1476 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1477 | /* Bias voltage on for external mic port */ |
| 1478 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1479 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1480 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1481 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1482 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1483 | /* Enable unsolicited event for HP jack */ |
| 1484 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1485 | /* Enable speaker output */ |
| 1486 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1487 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1488 | /* Enable headphone output */ |
| 1489 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1490 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1491 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1492 | { } |
| 1493 | }; |
| 1494 | |
| 1495 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1496 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1497 | */ |
| 1498 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1499 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1500 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1501 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1502 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1503 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1504 | /* Enable unsolicited event for HP jack */ |
| 1505 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1506 | /* Connect Internal Front to Front */ |
| 1507 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1508 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1509 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1510 | /* Connect Internal Rear to Rear */ |
| 1511 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1512 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1513 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1514 | /* Connect Internal CLFE to CLFE */ |
| 1515 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1516 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1517 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1518 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1519 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1521 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1522 | /* Enable all DACs */ |
| 1523 | /* DAC DISABLE/MUTE 1? */ |
| 1524 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1525 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1526 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1527 | /* DAC DISABLE/MUTE 2? */ |
| 1528 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1529 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1530 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1531 | /* Enable amplifiers */ |
| 1532 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1533 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1534 | /* DMIC fix |
| 1535 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1536 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1537 | * makes the signal become a difference/sum signal instead of standard |
| 1538 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1539 | * codec replicate the sum signal to both channels, turning it into a |
| 1540 | * normal mono mic. |
| 1541 | */ |
| 1542 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1543 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1544 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1545 | { } |
| 1546 | }; |
| 1547 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1548 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1549 | /* Front mic only available on one ADC */ |
| 1550 | { |
| 1551 | .num_items = 4, |
| 1552 | .items = { |
| 1553 | { "Mic", 0x0 }, |
| 1554 | { "Line", 0x2 }, |
| 1555 | { "CD", 0x4 }, |
| 1556 | { "Front Mic", 0xb }, |
| 1557 | }, |
| 1558 | }, |
| 1559 | { |
| 1560 | .num_items = 3, |
| 1561 | .items = { |
| 1562 | { "Mic", 0x0 }, |
| 1563 | { "Line", 0x2 }, |
| 1564 | { "CD", 0x4 }, |
| 1565 | }, |
| 1566 | } |
| 1567 | }; |
| 1568 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1569 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1570 | /* Interal mic only available on one ADC */ |
| 1571 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1572 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1573 | .items = { |
| 1574 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1575 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1576 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1577 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1578 | { "Int Mic", 0xb }, |
| 1579 | }, |
| 1580 | }, |
| 1581 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1582 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1583 | .items = { |
| 1584 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1585 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1586 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1587 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1588 | }, |
| 1589 | } |
| 1590 | }; |
| 1591 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1592 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1593 | /* Digital mic only available on first "ADC" */ |
| 1594 | { |
| 1595 | .num_items = 5, |
| 1596 | .items = { |
| 1597 | { "Mic", 0x0 }, |
| 1598 | { "Line", 0x2 }, |
| 1599 | { "CD", 0x4 }, |
| 1600 | { "Front Mic", 0xb }, |
| 1601 | { "Input Mix", 0xa }, |
| 1602 | }, |
| 1603 | }, |
| 1604 | { |
| 1605 | .num_items = 4, |
| 1606 | .items = { |
| 1607 | { "Mic", 0x0 }, |
| 1608 | { "Line", 0x2 }, |
| 1609 | { "CD", 0x4 }, |
| 1610 | { "Input Mix", 0xa }, |
| 1611 | }, |
| 1612 | }, |
| 1613 | { |
| 1614 | .num_items = 4, |
| 1615 | .items = { |
| 1616 | { "Mic", 0x0 }, |
| 1617 | { "Line", 0x2 }, |
| 1618 | { "CD", 0x4 }, |
| 1619 | { "Input Mix", 0xa }, |
| 1620 | }, |
| 1621 | } |
| 1622 | }; |
| 1623 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1624 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1625 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1626 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1627 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1628 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1629 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1630 | HDA_OUTPUT), |
| 1631 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1632 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1633 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1634 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1635 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1636 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1637 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1638 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1639 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1640 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1641 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1642 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1643 | { } /* end */ |
| 1644 | }; |
| 1645 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1646 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1647 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1648 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1649 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1650 | spec->autocfg.hp_pins[0] = 0x15; |
| 1651 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1652 | alc_automute_amp(codec); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1653 | } |
| 1654 | |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1655 | static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec) |
| 1656 | { |
| 1657 | struct alc_spec *spec = codec->spec; |
| 1658 | |
| 1659 | spec->autocfg.hp_pins[0] = 0x15; |
| 1660 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1661 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1662 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1663 | alc_automute_amp(codec); |
| 1664 | } |
| 1665 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1666 | static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1667 | { |
| 1668 | struct alc_spec *spec = codec->spec; |
| 1669 | |
| 1670 | spec->autocfg.hp_pins[0] = 0x15; |
| 1671 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1672 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1673 | spec->autocfg.speaker_pins[2] = 0x1b; |
| 1674 | alc_automute_amp(codec); |
| 1675 | } |
| 1676 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1677 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1678 | * ALC880 3-stack model |
| 1679 | * |
| 1680 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1681 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1682 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1683 | */ |
| 1684 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1685 | static hda_nid_t alc880_dac_nids[4] = { |
| 1686 | /* front, rear, clfe, rear_surr */ |
| 1687 | 0x02, 0x05, 0x04, 0x03 |
| 1688 | }; |
| 1689 | |
| 1690 | static hda_nid_t alc880_adc_nids[3] = { |
| 1691 | /* ADC0-2 */ |
| 1692 | 0x07, 0x08, 0x09, |
| 1693 | }; |
| 1694 | |
| 1695 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1696 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1697 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1698 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1699 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1700 | /* ADC1-2 */ |
| 1701 | 0x08, 0x09, |
| 1702 | }; |
| 1703 | |
| 1704 | #define ALC880_DIGOUT_NID 0x06 |
| 1705 | #define ALC880_DIGIN_NID 0x0a |
| 1706 | |
| 1707 | static struct hda_input_mux alc880_capture_source = { |
| 1708 | .num_items = 4, |
| 1709 | .items = { |
| 1710 | { "Mic", 0x0 }, |
| 1711 | { "Front Mic", 0x3 }, |
| 1712 | { "Line", 0x2 }, |
| 1713 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1714 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1715 | }; |
| 1716 | |
| 1717 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1718 | /* 2ch mode */ |
| 1719 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1720 | /* set line-in to input, mute it */ |
| 1721 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1722 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1723 | /* set mic-in to input vref 80%, mute it */ |
| 1724 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1725 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1726 | { } /* end */ |
| 1727 | }; |
| 1728 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1729 | /* 6ch mode */ |
| 1730 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1731 | /* set line-in to output, unmute it */ |
| 1732 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1733 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1734 | /* set mic-in to output, unmute it */ |
| 1735 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1736 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1737 | { } /* end */ |
| 1738 | }; |
| 1739 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1740 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1741 | { 2, alc880_threestack_ch2_init }, |
| 1742 | { 6, alc880_threestack_ch6_init }, |
| 1743 | }; |
| 1744 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1745 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1746 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1747 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1748 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1749 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1750 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1751 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1752 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1753 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1754 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1755 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1756 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1757 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1758 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1759 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1760 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1761 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1762 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1763 | { |
| 1764 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1765 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1766 | .info = alc_ch_mode_info, |
| 1767 | .get = alc_ch_mode_get, |
| 1768 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1769 | }, |
| 1770 | { } /* end */ |
| 1771 | }; |
| 1772 | |
| 1773 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1774 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1775 | struct snd_ctl_elem_info *uinfo) |
| 1776 | { |
| 1777 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1778 | struct alc_spec *spec = codec->spec; |
| 1779 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1780 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1781 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1782 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1783 | HDA_INPUT); |
| 1784 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1785 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1786 | return err; |
| 1787 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1788 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1789 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1790 | unsigned int size, unsigned int __user *tlv) |
| 1791 | { |
| 1792 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1793 | struct alc_spec *spec = codec->spec; |
| 1794 | int err; |
| 1795 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1796 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1797 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1798 | HDA_INPUT); |
| 1799 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1800 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1801 | return err; |
| 1802 | } |
| 1803 | |
| 1804 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1805 | struct snd_ctl_elem_value *ucontrol); |
| 1806 | |
| 1807 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1808 | struct snd_ctl_elem_value *ucontrol, |
| 1809 | getput_call_t func) |
| 1810 | { |
| 1811 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1812 | struct alc_spec *spec = codec->spec; |
| 1813 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1814 | int err; |
| 1815 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1816 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1817 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1818 | 3, 0, HDA_INPUT); |
| 1819 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1820 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1821 | return err; |
| 1822 | } |
| 1823 | |
| 1824 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1825 | struct snd_ctl_elem_value *ucontrol) |
| 1826 | { |
| 1827 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1828 | snd_hda_mixer_amp_volume_get); |
| 1829 | } |
| 1830 | |
| 1831 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1832 | struct snd_ctl_elem_value *ucontrol) |
| 1833 | { |
| 1834 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1835 | snd_hda_mixer_amp_volume_put); |
| 1836 | } |
| 1837 | |
| 1838 | /* capture mixer elements */ |
| 1839 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1840 | |
| 1841 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1842 | struct snd_ctl_elem_value *ucontrol) |
| 1843 | { |
| 1844 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1845 | snd_hda_mixer_amp_switch_get); |
| 1846 | } |
| 1847 | |
| 1848 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1849 | struct snd_ctl_elem_value *ucontrol) |
| 1850 | { |
| 1851 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1852 | snd_hda_mixer_amp_switch_put); |
| 1853 | } |
| 1854 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1855 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1856 | { \ |
| 1857 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1858 | .name = "Capture Switch", \ |
| 1859 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1860 | .count = num, \ |
| 1861 | .info = alc_cap_sw_info, \ |
| 1862 | .get = alc_cap_sw_get, \ |
| 1863 | .put = alc_cap_sw_put, \ |
| 1864 | }, \ |
| 1865 | { \ |
| 1866 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1867 | .name = "Capture Volume", \ |
| 1868 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1869 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1870 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1871 | .count = num, \ |
| 1872 | .info = alc_cap_vol_info, \ |
| 1873 | .get = alc_cap_vol_get, \ |
| 1874 | .put = alc_cap_vol_put, \ |
| 1875 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1876 | } |
| 1877 | |
| 1878 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1879 | { \ |
| 1880 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1881 | /* .name = "Capture Source", */ \ |
| 1882 | .name = "Input Source", \ |
| 1883 | .count = num, \ |
| 1884 | .info = alc_mux_enum_info, \ |
| 1885 | .get = alc_mux_enum_get, \ |
| 1886 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1887 | } |
| 1888 | |
| 1889 | #define DEFINE_CAPMIX(num) \ |
| 1890 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1891 | _DEFINE_CAPMIX(num), \ |
| 1892 | _DEFINE_CAPSRC(num), \ |
| 1893 | { } /* end */ \ |
| 1894 | } |
| 1895 | |
| 1896 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 1897 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 1898 | _DEFINE_CAPMIX(num), \ |
| 1899 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1900 | } |
| 1901 | |
| 1902 | /* up to three ADCs */ |
| 1903 | DEFINE_CAPMIX(1); |
| 1904 | DEFINE_CAPMIX(2); |
| 1905 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1906 | DEFINE_CAPMIX_NOSRC(1); |
| 1907 | DEFINE_CAPMIX_NOSRC(2); |
| 1908 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1909 | |
| 1910 | /* |
| 1911 | * ALC880 5-stack model |
| 1912 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1913 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1914 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1915 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1916 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1917 | */ |
| 1918 | |
| 1919 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1920 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1921 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1922 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1923 | { } /* end */ |
| 1924 | }; |
| 1925 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1926 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1927 | /* 6ch mode */ |
| 1928 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1929 | /* set line-in to input, mute it */ |
| 1930 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1931 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1932 | { } /* end */ |
| 1933 | }; |
| 1934 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1935 | /* 8ch mode */ |
| 1936 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1937 | /* set line-in to output, unmute it */ |
| 1938 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1939 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1940 | { } /* end */ |
| 1941 | }; |
| 1942 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1943 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1944 | { 6, alc880_fivestack_ch6_init }, |
| 1945 | { 8, alc880_fivestack_ch8_init }, |
| 1946 | }; |
| 1947 | |
| 1948 | |
| 1949 | /* |
| 1950 | * ALC880 6-stack model |
| 1951 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1952 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1953 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1954 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1955 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1956 | */ |
| 1957 | |
| 1958 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1959 | /* front, rear, clfe, rear_surr */ |
| 1960 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1961 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1962 | |
| 1963 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1964 | .num_items = 4, |
| 1965 | .items = { |
| 1966 | { "Mic", 0x0 }, |
| 1967 | { "Front Mic", 0x1 }, |
| 1968 | { "Line", 0x2 }, |
| 1969 | { "CD", 0x4 }, |
| 1970 | }, |
| 1971 | }; |
| 1972 | |
| 1973 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1974 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1975 | { 8, NULL }, |
| 1976 | }; |
| 1977 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1978 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1979 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1980 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1981 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1982 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1983 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1984 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1985 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1986 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1987 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1988 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1989 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1990 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1991 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1992 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1995 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1996 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1997 | { |
| 1998 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1999 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2000 | .info = alc_ch_mode_info, |
| 2001 | .get = alc_ch_mode_get, |
| 2002 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2003 | }, |
| 2004 | { } /* end */ |
| 2005 | }; |
| 2006 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2007 | |
| 2008 | /* |
| 2009 | * ALC880 W810 model |
| 2010 | * |
| 2011 | * W810 has rear IO for: |
| 2012 | * Front (DAC 02) |
| 2013 | * Surround (DAC 03) |
| 2014 | * Center/LFE (DAC 04) |
| 2015 | * Digital out (06) |
| 2016 | * |
| 2017 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2018 | * These are both connected to Line2 on the codec, hence to DAC 02. |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2019 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2020 | * There is a variable resistor to control the speaker or headphone |
| 2021 | * volume. This is a hardware-only device without a software API. |
| 2022 | * |
| 2023 | * Plugging headphones in will disable the internal speakers. This is |
| 2024 | * implemented in hardware, not via the driver using jack sense. In |
| 2025 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2026 | * disable both the speakers and headphones. |
| 2027 | * |
| 2028 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2029 | * These may not do anything useful with this driver yet, because I |
| 2030 | * haven't setup any initialization verbs for these yet... |
| 2031 | */ |
| 2032 | |
| 2033 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2034 | /* front, rear/surround, clfe */ |
| 2035 | 0x02, 0x03, 0x04 |
| 2036 | }; |
| 2037 | |
| 2038 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2039 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2040 | { 6, NULL } |
| 2041 | }; |
| 2042 | |
| 2043 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2044 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2045 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2046 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2047 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2048 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2049 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2050 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2051 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2052 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2053 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2054 | { } /* end */ |
| 2055 | }; |
| 2056 | |
| 2057 | |
| 2058 | /* |
| 2059 | * Z710V model |
| 2060 | * |
| 2061 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2062 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2063 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2064 | */ |
| 2065 | |
| 2066 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2067 | 0x02 |
| 2068 | }; |
| 2069 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2070 | |
| 2071 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2072 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2073 | { 2, NULL } |
| 2074 | }; |
| 2075 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2076 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2077 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2078 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2079 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2080 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2081 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2082 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2083 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2084 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2085 | { } /* end */ |
| 2086 | }; |
| 2087 | |
| 2088 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2089 | /* |
| 2090 | * ALC880 F1734 model |
| 2091 | * |
| 2092 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2093 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2094 | */ |
| 2095 | |
| 2096 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2097 | 0x03 |
| 2098 | }; |
| 2099 | #define ALC880_F1734_HP_DAC 0x02 |
| 2100 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2101 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2102 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2103 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2104 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2105 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2106 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2107 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2108 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2109 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2110 | { } /* end */ |
| 2111 | }; |
| 2112 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2113 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2114 | .num_items = 2, |
| 2115 | .items = { |
| 2116 | { "Mic", 0x1 }, |
| 2117 | { "CD", 0x4 }, |
| 2118 | }, |
| 2119 | }; |
| 2120 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2121 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2122 | /* |
| 2123 | * ALC880 ASUS model |
| 2124 | * |
| 2125 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2126 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2127 | * Mic = 0x18, Line = 0x1a |
| 2128 | */ |
| 2129 | |
| 2130 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2131 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2132 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2133 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2134 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2135 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2136 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2137 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2138 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2139 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2140 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2141 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2142 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2143 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2144 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2145 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2146 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2147 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2148 | { |
| 2149 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2150 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2151 | .info = alc_ch_mode_info, |
| 2152 | .get = alc_ch_mode_get, |
| 2153 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2154 | }, |
| 2155 | { } /* end */ |
| 2156 | }; |
| 2157 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2158 | /* |
| 2159 | * ALC880 ASUS W1V model |
| 2160 | * |
| 2161 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2162 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2163 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2164 | */ |
| 2165 | |
| 2166 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2167 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2168 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2169 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2170 | { } /* end */ |
| 2171 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2172 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2173 | /* TCL S700 */ |
| 2174 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2175 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2176 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2177 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2178 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2179 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2180 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2181 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2182 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2183 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2184 | { } /* end */ |
| 2185 | }; |
| 2186 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2187 | /* Uniwill */ |
| 2188 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2189 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2190 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2191 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2192 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2193 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2194 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2195 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2196 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2197 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2198 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2199 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2200 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2201 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2202 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2203 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2204 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2205 | { |
| 2206 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2207 | .name = "Channel Mode", |
| 2208 | .info = alc_ch_mode_info, |
| 2209 | .get = alc_ch_mode_get, |
| 2210 | .put = alc_ch_mode_put, |
| 2211 | }, |
| 2212 | { } /* end */ |
| 2213 | }; |
| 2214 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2215 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2216 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2217 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2218 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2219 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2220 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2221 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2222 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2223 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2224 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2225 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2226 | { } /* end */ |
| 2227 | }; |
| 2228 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2229 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2230 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2231 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2232 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2233 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2234 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2235 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2236 | { } /* end */ |
| 2237 | }; |
| 2238 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2239 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2240 | * virtual master controls |
| 2241 | */ |
| 2242 | |
| 2243 | /* |
| 2244 | * slave controls for virtual master |
| 2245 | */ |
| 2246 | static const char *alc_slave_vols[] = { |
| 2247 | "Front Playback Volume", |
| 2248 | "Surround Playback Volume", |
| 2249 | "Center Playback Volume", |
| 2250 | "LFE Playback Volume", |
| 2251 | "Side Playback Volume", |
| 2252 | "Headphone Playback Volume", |
| 2253 | "Speaker Playback Volume", |
| 2254 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2255 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2256 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2257 | NULL, |
| 2258 | }; |
| 2259 | |
| 2260 | static const char *alc_slave_sws[] = { |
| 2261 | "Front Playback Switch", |
| 2262 | "Surround Playback Switch", |
| 2263 | "Center Playback Switch", |
| 2264 | "LFE Playback Switch", |
| 2265 | "Side Playback Switch", |
| 2266 | "Headphone Playback Switch", |
| 2267 | "Speaker Playback Switch", |
| 2268 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2269 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2270 | NULL, |
| 2271 | }; |
| 2272 | |
| 2273 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2274 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2275 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2276 | |
| 2277 | static void alc_free_kctls(struct hda_codec *codec); |
| 2278 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2279 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2280 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2281 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2282 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2283 | { } /* end */ |
| 2284 | }; |
| 2285 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2286 | static int alc_build_controls(struct hda_codec *codec) |
| 2287 | { |
| 2288 | struct alc_spec *spec = codec->spec; |
| 2289 | int err; |
| 2290 | int i; |
| 2291 | |
| 2292 | for (i = 0; i < spec->num_mixers; i++) { |
| 2293 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2294 | if (err < 0) |
| 2295 | return err; |
| 2296 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2297 | if (spec->cap_mixer) { |
| 2298 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2299 | if (err < 0) |
| 2300 | return err; |
| 2301 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2302 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2303 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2304 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2305 | if (err < 0) |
| 2306 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2307 | if (!spec->no_analog) { |
| 2308 | err = snd_hda_create_spdif_share_sw(codec, |
| 2309 | &spec->multiout); |
| 2310 | if (err < 0) |
| 2311 | return err; |
| 2312 | spec->multiout.share_spdif = 1; |
| 2313 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2314 | } |
| 2315 | if (spec->dig_in_nid) { |
| 2316 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2317 | if (err < 0) |
| 2318 | return err; |
| 2319 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2320 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2321 | /* create beep controls if needed */ |
| 2322 | if (spec->beep_amp) { |
| 2323 | struct snd_kcontrol_new *knew; |
| 2324 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2325 | struct snd_kcontrol *kctl; |
| 2326 | kctl = snd_ctl_new1(knew, codec); |
| 2327 | if (!kctl) |
| 2328 | return -ENOMEM; |
| 2329 | kctl->private_value = spec->beep_amp; |
| 2330 | err = snd_hda_ctl_add(codec, kctl); |
| 2331 | if (err < 0) |
| 2332 | return err; |
| 2333 | } |
| 2334 | } |
| 2335 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2336 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2337 | if (!spec->no_analog && |
| 2338 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2339 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2340 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2341 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2342 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2343 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2344 | if (err < 0) |
| 2345 | return err; |
| 2346 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2347 | if (!spec->no_analog && |
| 2348 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2349 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2350 | NULL, alc_slave_sws); |
| 2351 | if (err < 0) |
| 2352 | return err; |
| 2353 | } |
| 2354 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2355 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2356 | return 0; |
| 2357 | } |
| 2358 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2359 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2360 | /* |
| 2361 | * initialize the codec volumes, etc |
| 2362 | */ |
| 2363 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2364 | /* |
| 2365 | * generic initialization of ADC, input mixers and output mixers |
| 2366 | */ |
| 2367 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2368 | /* |
| 2369 | * Unmute ADC0-2 and set the default input to mic-in |
| 2370 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2371 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2372 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2373 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2374 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2375 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2376 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2377 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2378 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2379 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2380 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2381 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2382 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2383 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2384 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2385 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2386 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2387 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2388 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2389 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2390 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2391 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2392 | /* |
| 2393 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2394 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2395 | /* set vol=0 to output mixers */ |
| 2396 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2397 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2398 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2399 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2400 | /* set up input amps for analog loopback */ |
| 2401 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2402 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2403 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2404 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2405 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2406 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2407 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2408 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2409 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2410 | |
| 2411 | { } |
| 2412 | }; |
| 2413 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2414 | /* |
| 2415 | * 3-stack pin configuration: |
| 2416 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2417 | */ |
| 2418 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2419 | /* |
| 2420 | * preset connection lists of input pins |
| 2421 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2422 | */ |
| 2423 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2424 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2425 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2426 | |
| 2427 | /* |
| 2428 | * Set pin mode and muting |
| 2429 | */ |
| 2430 | /* set front pin widgets 0x14 for output */ |
| 2431 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2432 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2433 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2434 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2435 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2436 | /* Mic2 (as headphone out) for HP output */ |
| 2437 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2438 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2439 | /* Line In pin widget for input */ |
| 2440 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2441 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2442 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2443 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2444 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2445 | /* CD pin widget for input */ |
| 2446 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2447 | |
| 2448 | { } |
| 2449 | }; |
| 2450 | |
| 2451 | /* |
| 2452 | * 5-stack pin configuration: |
| 2453 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2454 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2455 | */ |
| 2456 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2457 | /* |
| 2458 | * preset connection lists of input pins |
| 2459 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2460 | */ |
| 2461 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2462 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2463 | |
| 2464 | /* |
| 2465 | * Set pin mode and muting |
| 2466 | */ |
| 2467 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2468 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2469 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2470 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2471 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2472 | /* unmute pins for output (no gain on this amp) */ |
| 2473 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2474 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2475 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2476 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2477 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2478 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2479 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2480 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2481 | /* Mic2 (as headphone out) for HP output */ |
| 2482 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2483 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2484 | /* Line In pin widget for input */ |
| 2485 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2486 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2487 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2488 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2489 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2490 | /* CD pin widget for input */ |
| 2491 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2492 | |
| 2493 | { } |
| 2494 | }; |
| 2495 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2496 | /* |
| 2497 | * W810 pin configuration: |
| 2498 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2499 | */ |
| 2500 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2501 | /* hphone/speaker input selector: front DAC */ |
| 2502 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2503 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2504 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2505 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2506 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2507 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2508 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2509 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2510 | |
| 2511 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2512 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2513 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2514 | { } |
| 2515 | }; |
| 2516 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2517 | /* |
| 2518 | * Z71V pin configuration: |
| 2519 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2520 | */ |
| 2521 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2522 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2523 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2524 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2525 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2526 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2527 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2528 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2529 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2530 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2531 | |
| 2532 | { } |
| 2533 | }; |
| 2534 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2535 | /* |
| 2536 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2537 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2538 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2539 | */ |
| 2540 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2541 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2542 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2543 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2544 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2545 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2546 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2547 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2548 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2549 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2550 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2551 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2552 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2553 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2554 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2555 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2556 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2557 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2558 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2559 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2560 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2561 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2562 | { } |
| 2563 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2564 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2565 | /* |
| 2566 | * Uniwill pin configuration: |
| 2567 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2568 | * line = 0x1a |
| 2569 | */ |
| 2570 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2571 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2572 | |
| 2573 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2574 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2575 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2576 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2577 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2578 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2579 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2580 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2581 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2582 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2583 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2584 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2585 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2586 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2587 | |
| 2588 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2589 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2590 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2591 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2592 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2593 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2594 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2595 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2596 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2597 | |
| 2598 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2599 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2600 | |
| 2601 | { } |
| 2602 | }; |
| 2603 | |
| 2604 | /* |
| 2605 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2606 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2607 | */ |
| 2608 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2609 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2610 | |
| 2611 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2612 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2613 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2614 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2615 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2616 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2618 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2620 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2621 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2622 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2623 | |
| 2624 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2625 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2626 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2627 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2628 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2629 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2630 | |
| 2631 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2632 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2633 | |
| 2634 | { } |
| 2635 | }; |
| 2636 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2637 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2638 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2639 | { } |
| 2640 | }; |
| 2641 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2642 | /* auto-toggle front mic */ |
| 2643 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2644 | { |
| 2645 | unsigned int present; |
| 2646 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2647 | |
| 2648 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2649 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2650 | bits = present ? HDA_AMP_MUTE : 0; |
| 2651 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2652 | } |
| 2653 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2654 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2655 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2656 | struct alc_spec *spec = codec->spec; |
| 2657 | |
| 2658 | spec->autocfg.hp_pins[0] = 0x14; |
| 2659 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2660 | spec->autocfg.speaker_pins[0] = 0x16; |
| 2661 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2662 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2663 | } |
| 2664 | |
| 2665 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2666 | unsigned int res) |
| 2667 | { |
| 2668 | /* Looks like the unsol event is incompatible with the standard |
| 2669 | * definition. 4bit tag is placed at 28 bit! |
| 2670 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2671 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2672 | case ALC880_MIC_EVENT: |
| 2673 | alc880_uniwill_mic_automute(codec); |
| 2674 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2675 | default: |
| 2676 | alc_automute_amp_unsol_event(codec, res); |
| 2677 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2678 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2679 | } |
| 2680 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2681 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2682 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2683 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2684 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2685 | spec->autocfg.hp_pins[0] = 0x14; |
| 2686 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2687 | alc_automute_amp(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2688 | } |
| 2689 | |
| 2690 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2691 | { |
| 2692 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2693 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2694 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2695 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2696 | present &= HDA_AMP_VOLMASK; |
| 2697 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2698 | HDA_AMP_VOLMASK, present); |
| 2699 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2700 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2701 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2702 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2703 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2704 | unsigned int res) |
| 2705 | { |
| 2706 | /* Looks like the unsol event is incompatible with the standard |
| 2707 | * definition. 4bit tag is placed at 28 bit! |
| 2708 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2709 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2710 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2711 | else |
| 2712 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2713 | } |
| 2714 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2715 | /* |
| 2716 | * F1734 pin configuration: |
| 2717 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2718 | */ |
| 2719 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2720 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2721 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2722 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2723 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2724 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2725 | |
| 2726 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2727 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2728 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2729 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2730 | |
| 2731 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2732 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2733 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2734 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2735 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2736 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2737 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2738 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2739 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2740 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2741 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2742 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2743 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2744 | { } |
| 2745 | }; |
| 2746 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2747 | /* |
| 2748 | * ASUS pin configuration: |
| 2749 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2750 | */ |
| 2751 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2752 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2753 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2754 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2755 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2756 | |
| 2757 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2758 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2759 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2760 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2761 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2762 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2763 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2764 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2765 | |
| 2766 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2767 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2768 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2769 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2770 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2771 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2772 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2773 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2774 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2775 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2776 | { } |
| 2777 | }; |
| 2778 | |
| 2779 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2780 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2781 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2782 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2783 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2784 | /* Clevo m520g init */ |
| 2785 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2786 | /* headphone output */ |
| 2787 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2788 | /* line-out */ |
| 2789 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2790 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2791 | /* Line-in */ |
| 2792 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2793 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2794 | /* CD */ |
| 2795 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2796 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2797 | /* Mic1 (rear panel) */ |
| 2798 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2799 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2800 | /* Mic2 (front panel) */ |
| 2801 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2802 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2803 | /* headphone */ |
| 2804 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2805 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2806 | /* change to EAPD mode */ |
| 2807 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2808 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2809 | |
| 2810 | { } |
| 2811 | }; |
| 2812 | |
| 2813 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2814 | /* change to EAPD mode */ |
| 2815 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2816 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2817 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2818 | /* Headphone output */ |
| 2819 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2820 | /* Front output*/ |
| 2821 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2822 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2823 | |
| 2824 | /* Line In pin widget for input */ |
| 2825 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2826 | /* CD pin widget for input */ |
| 2827 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2828 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2829 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2830 | |
| 2831 | /* change to EAPD mode */ |
| 2832 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2833 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2834 | |
| 2835 | { } |
| 2836 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2837 | |
| 2838 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2839 | * LG m1 express dual |
| 2840 | * |
| 2841 | * Pin assignment: |
| 2842 | * Rear Line-In/Out (blue): 0x14 |
| 2843 | * Build-in Mic-In: 0x15 |
| 2844 | * Speaker-out: 0x17 |
| 2845 | * HP-Out (green): 0x1b |
| 2846 | * Mic-In/Out (red): 0x19 |
| 2847 | * SPDIF-Out: 0x1e |
| 2848 | */ |
| 2849 | |
| 2850 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2851 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2852 | 0x05, 0x02, 0x03 |
| 2853 | }; |
| 2854 | |
| 2855 | /* seems analog CD is not working */ |
| 2856 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2857 | .num_items = 3, |
| 2858 | .items = { |
| 2859 | { "Mic", 0x1 }, |
| 2860 | { "Line", 0x5 }, |
| 2861 | { "Internal Mic", 0x6 }, |
| 2862 | }, |
| 2863 | }; |
| 2864 | |
| 2865 | /* 2,4,6 channel modes */ |
| 2866 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2867 | /* set line-in and mic-in to input */ |
| 2868 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2869 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2870 | { } |
| 2871 | }; |
| 2872 | |
| 2873 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2874 | /* set line-in to out and mic-in to input */ |
| 2875 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2876 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2877 | { } |
| 2878 | }; |
| 2879 | |
| 2880 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2881 | /* set line-in and mic-in to output */ |
| 2882 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2883 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2884 | { } |
| 2885 | }; |
| 2886 | |
| 2887 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2888 | { 2, alc880_lg_ch2_init }, |
| 2889 | { 4, alc880_lg_ch4_init }, |
| 2890 | { 6, alc880_lg_ch6_init }, |
| 2891 | }; |
| 2892 | |
| 2893 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2894 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2895 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2896 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2897 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2898 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2899 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2900 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2901 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2902 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2903 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2904 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2905 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2906 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2907 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2908 | { |
| 2909 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2910 | .name = "Channel Mode", |
| 2911 | .info = alc_ch_mode_info, |
| 2912 | .get = alc_ch_mode_get, |
| 2913 | .put = alc_ch_mode_put, |
| 2914 | }, |
| 2915 | { } /* end */ |
| 2916 | }; |
| 2917 | |
| 2918 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2919 | /* set capture source to mic-in */ |
| 2920 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2921 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2922 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2923 | /* mute all amp mixer inputs */ |
| 2924 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2925 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2927 | /* line-in to input */ |
| 2928 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2929 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2930 | /* built-in mic */ |
| 2931 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2932 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2933 | /* speaker-out */ |
| 2934 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2935 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2936 | /* mic-in to input */ |
| 2937 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2938 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2939 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2940 | /* HP-out */ |
| 2941 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2942 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2943 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2944 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2945 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2946 | { } |
| 2947 | }; |
| 2948 | |
| 2949 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2950 | static void alc880_lg_init_hook(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2951 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2952 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2953 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2954 | spec->autocfg.hp_pins[0] = 0x1b; |
| 2955 | spec->autocfg.speaker_pins[0] = 0x17; |
| 2956 | alc_automute_amp(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2957 | } |
| 2958 | |
| 2959 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2960 | * LG LW20 |
| 2961 | * |
| 2962 | * Pin assignment: |
| 2963 | * Speaker-out: 0x14 |
| 2964 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2965 | * Built-in Mic-In: 0x19 |
| 2966 | * Line-In: 0x1b |
| 2967 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2968 | * SPDIF-Out: 0x1e |
| 2969 | */ |
| 2970 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2971 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2972 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2973 | .items = { |
| 2974 | { "Mic", 0x0 }, |
| 2975 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2976 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2977 | }, |
| 2978 | }; |
| 2979 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2980 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2981 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2982 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2984 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2985 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2986 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2987 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2988 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2989 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2990 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2991 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2992 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2995 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2996 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2997 | { |
| 2998 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2999 | .name = "Channel Mode", |
| 3000 | .info = alc_ch_mode_info, |
| 3001 | .get = alc_ch_mode_get, |
| 3002 | .put = alc_ch_mode_put, |
| 3003 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3004 | { } /* end */ |
| 3005 | }; |
| 3006 | |
| 3007 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3008 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3009 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3010 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3011 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3012 | /* set capture source to mic-in */ |
| 3013 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3014 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3015 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3016 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3017 | /* speaker-out */ |
| 3018 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3019 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3020 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3021 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3022 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3023 | /* mic-in to input */ |
| 3024 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3025 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3026 | /* built-in mic */ |
| 3027 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3028 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3029 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3030 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3031 | { } |
| 3032 | }; |
| 3033 | |
| 3034 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3035 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3036 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3037 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3038 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3039 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3040 | spec->autocfg.speaker_pins[0] = 0x14; |
| 3041 | alc_automute_amp(codec); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3042 | } |
| 3043 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3044 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3045 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3046 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3047 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3048 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3049 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3050 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3051 | { } /* end */ |
| 3052 | }; |
| 3053 | |
| 3054 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3055 | .num_items = 2, |
| 3056 | .items = { |
| 3057 | { "Mic", 0x0 }, |
| 3058 | { "Internal Mic", 0x1 }, |
| 3059 | }, |
| 3060 | }; |
| 3061 | |
| 3062 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3063 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3064 | |
| 3065 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3066 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3067 | |
| 3068 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3069 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3070 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3071 | /* Mic2 (as headphone out) for HP output */ |
| 3072 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3073 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3074 | /* Internal Speaker */ |
| 3075 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3076 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3077 | |
| 3078 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3079 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3080 | |
| 3081 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3082 | { } |
| 3083 | }; |
| 3084 | |
| 3085 | /* toggle speaker-output according to the hp-jack state */ |
| 3086 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3087 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3088 | struct alc_spec *spec = codec->spec; |
| 3089 | alc_automute_amp(codec); |
| 3090 | /* toggle EAPD */ |
| 3091 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3092 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3093 | else |
| 3094 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3095 | } |
| 3096 | |
| 3097 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3098 | unsigned int res) |
| 3099 | { |
| 3100 | /* Looks like the unsol event is incompatible with the standard |
| 3101 | * definition. 4bit tag is placed at 28 bit! |
| 3102 | */ |
| 3103 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3104 | alc880_medion_rim_automute(codec); |
| 3105 | } |
| 3106 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3107 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) |
| 3108 | { |
| 3109 | struct alc_spec *spec = codec->spec; |
| 3110 | |
| 3111 | spec->autocfg.hp_pins[0] = 0x14; |
| 3112 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 3113 | alc880_medion_rim_automute(codec); |
| 3114 | } |
| 3115 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3116 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3117 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3118 | { 0x0b, HDA_INPUT, 0 }, |
| 3119 | { 0x0b, HDA_INPUT, 1 }, |
| 3120 | { 0x0b, HDA_INPUT, 2 }, |
| 3121 | { 0x0b, HDA_INPUT, 3 }, |
| 3122 | { 0x0b, HDA_INPUT, 4 }, |
| 3123 | { } /* end */ |
| 3124 | }; |
| 3125 | |
| 3126 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3127 | { 0x0b, HDA_INPUT, 1 }, |
| 3128 | { 0x0b, HDA_INPUT, 6 }, |
| 3129 | { 0x0b, HDA_INPUT, 7 }, |
| 3130 | { } /* end */ |
| 3131 | }; |
| 3132 | #endif |
| 3133 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3134 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3135 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3136 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3137 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3138 | static int alc_init(struct hda_codec *codec) |
| 3139 | { |
| 3140 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3141 | unsigned int i; |
| 3142 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3143 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3144 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3145 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3146 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3147 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3148 | |
| 3149 | if (spec->init_hook) |
| 3150 | spec->init_hook(codec); |
| 3151 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3152 | return 0; |
| 3153 | } |
| 3154 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3155 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3156 | { |
| 3157 | struct alc_spec *spec = codec->spec; |
| 3158 | |
| 3159 | if (spec->unsol_event) |
| 3160 | spec->unsol_event(codec, res); |
| 3161 | } |
| 3162 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3163 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3164 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3165 | { |
| 3166 | struct alc_spec *spec = codec->spec; |
| 3167 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3168 | } |
| 3169 | #endif |
| 3170 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3171 | /* |
| 3172 | * Analog playback callbacks |
| 3173 | */ |
| 3174 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3175 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3176 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3177 | { |
| 3178 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3179 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3180 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3181 | } |
| 3182 | |
| 3183 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3184 | struct hda_codec *codec, |
| 3185 | unsigned int stream_tag, |
| 3186 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3187 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3188 | { |
| 3189 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3190 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3191 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3192 | } |
| 3193 | |
| 3194 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3195 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3196 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3197 | { |
| 3198 | struct alc_spec *spec = codec->spec; |
| 3199 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3200 | } |
| 3201 | |
| 3202 | /* |
| 3203 | * Digital out |
| 3204 | */ |
| 3205 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3206 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3207 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3208 | { |
| 3209 | struct alc_spec *spec = codec->spec; |
| 3210 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3211 | } |
| 3212 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3213 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3214 | struct hda_codec *codec, |
| 3215 | unsigned int stream_tag, |
| 3216 | unsigned int format, |
| 3217 | struct snd_pcm_substream *substream) |
| 3218 | { |
| 3219 | struct alc_spec *spec = codec->spec; |
| 3220 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3221 | stream_tag, format, substream); |
| 3222 | } |
| 3223 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3224 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3225 | struct hda_codec *codec, |
| 3226 | struct snd_pcm_substream *substream) |
| 3227 | { |
| 3228 | struct alc_spec *spec = codec->spec; |
| 3229 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3230 | } |
| 3231 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3232 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3233 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3234 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3235 | { |
| 3236 | struct alc_spec *spec = codec->spec; |
| 3237 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3238 | } |
| 3239 | |
| 3240 | /* |
| 3241 | * Analog capture |
| 3242 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3243 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3244 | struct hda_codec *codec, |
| 3245 | unsigned int stream_tag, |
| 3246 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3247 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3248 | { |
| 3249 | struct alc_spec *spec = codec->spec; |
| 3250 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3251 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3252 | stream_tag, 0, format); |
| 3253 | return 0; |
| 3254 | } |
| 3255 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3256 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3257 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3258 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3259 | { |
| 3260 | struct alc_spec *spec = codec->spec; |
| 3261 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3262 | snd_hda_codec_cleanup_stream(codec, |
| 3263 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3264 | return 0; |
| 3265 | } |
| 3266 | |
| 3267 | |
| 3268 | /* |
| 3269 | */ |
| 3270 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3271 | .substreams = 1, |
| 3272 | .channels_min = 2, |
| 3273 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3274 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3275 | .ops = { |
| 3276 | .open = alc880_playback_pcm_open, |
| 3277 | .prepare = alc880_playback_pcm_prepare, |
| 3278 | .cleanup = alc880_playback_pcm_cleanup |
| 3279 | }, |
| 3280 | }; |
| 3281 | |
| 3282 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3283 | .substreams = 1, |
| 3284 | .channels_min = 2, |
| 3285 | .channels_max = 2, |
| 3286 | /* NID is set in alc_build_pcms */ |
| 3287 | }; |
| 3288 | |
| 3289 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3290 | .substreams = 1, |
| 3291 | .channels_min = 2, |
| 3292 | .channels_max = 2, |
| 3293 | /* NID is set in alc_build_pcms */ |
| 3294 | }; |
| 3295 | |
| 3296 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3297 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3298 | .channels_min = 2, |
| 3299 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3300 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3301 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3302 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3303 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3304 | }, |
| 3305 | }; |
| 3306 | |
| 3307 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3308 | .substreams = 1, |
| 3309 | .channels_min = 2, |
| 3310 | .channels_max = 2, |
| 3311 | /* NID is set in alc_build_pcms */ |
| 3312 | .ops = { |
| 3313 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3314 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3315 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3316 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3317 | }, |
| 3318 | }; |
| 3319 | |
| 3320 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3321 | .substreams = 1, |
| 3322 | .channels_min = 2, |
| 3323 | .channels_max = 2, |
| 3324 | /* NID is set in alc_build_pcms */ |
| 3325 | }; |
| 3326 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3327 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3328 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3329 | .substreams = 0, |
| 3330 | .channels_min = 0, |
| 3331 | .channels_max = 0, |
| 3332 | }; |
| 3333 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3334 | static int alc_build_pcms(struct hda_codec *codec) |
| 3335 | { |
| 3336 | struct alc_spec *spec = codec->spec; |
| 3337 | struct hda_pcm *info = spec->pcm_rec; |
| 3338 | int i; |
| 3339 | |
| 3340 | codec->num_pcms = 1; |
| 3341 | codec->pcm_info = info; |
| 3342 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3343 | if (spec->no_analog) |
| 3344 | goto skip_analog; |
| 3345 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3346 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3347 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3348 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3349 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3350 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3351 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3352 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3353 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3354 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3355 | } |
| 3356 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3357 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3358 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3359 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3360 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3361 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3362 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3363 | if (spec->channel_mode) { |
| 3364 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3365 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3366 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3367 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3368 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3369 | } |
| 3370 | } |
| 3371 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3372 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3373 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3374 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3375 | snprintf(spec->stream_name_digital, |
| 3376 | sizeof(spec->stream_name_digital), |
| 3377 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3378 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3379 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3380 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3381 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3382 | if (spec->dig_out_type) |
| 3383 | info->pcm_type = spec->dig_out_type; |
| 3384 | else |
| 3385 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3386 | if (spec->multiout.dig_out_nid && |
| 3387 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3388 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3389 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3390 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3391 | if (spec->dig_in_nid && |
| 3392 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3393 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3394 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3395 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3396 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3397 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3398 | } |
| 3399 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3400 | if (spec->no_analog) |
| 3401 | return 0; |
| 3402 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3403 | /* If the use of more than one ADC is requested for the current |
| 3404 | * model, configure a second analog capture-only PCM. |
| 3405 | */ |
| 3406 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3407 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3408 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3409 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3410 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3411 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3412 | if (spec->alt_dac_nid) { |
| 3413 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3414 | *spec->stream_analog_alt_playback; |
| 3415 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3416 | spec->alt_dac_nid; |
| 3417 | } else { |
| 3418 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3419 | alc_pcm_null_stream; |
| 3420 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3421 | } |
| 3422 | if (spec->num_adc_nids > 1) { |
| 3423 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3424 | *spec->stream_analog_alt_capture; |
| 3425 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3426 | spec->adc_nids[1]; |
| 3427 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3428 | spec->num_adc_nids - 1; |
| 3429 | } else { |
| 3430 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3431 | alc_pcm_null_stream; |
| 3432 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3433 | } |
| 3434 | } |
| 3435 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3436 | return 0; |
| 3437 | } |
| 3438 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3439 | static void alc_free_kctls(struct hda_codec *codec) |
| 3440 | { |
| 3441 | struct alc_spec *spec = codec->spec; |
| 3442 | |
| 3443 | if (spec->kctls.list) { |
| 3444 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3445 | int i; |
| 3446 | for (i = 0; i < spec->kctls.used; i++) |
| 3447 | kfree(kctl[i].name); |
| 3448 | } |
| 3449 | snd_array_free(&spec->kctls); |
| 3450 | } |
| 3451 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3452 | static void alc_free(struct hda_codec *codec) |
| 3453 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3454 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3455 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3456 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3457 | return; |
| 3458 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3459 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3460 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3461 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3462 | } |
| 3463 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3464 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3465 | static int alc_resume(struct hda_codec *codec) |
| 3466 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3467 | codec->patch_ops.init(codec); |
| 3468 | snd_hda_codec_resume_amp(codec); |
| 3469 | snd_hda_codec_resume_cache(codec); |
| 3470 | return 0; |
| 3471 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3472 | #endif |
| 3473 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3474 | /* |
| 3475 | */ |
| 3476 | static struct hda_codec_ops alc_patch_ops = { |
| 3477 | .build_controls = alc_build_controls, |
| 3478 | .build_pcms = alc_build_pcms, |
| 3479 | .init = alc_init, |
| 3480 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3481 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3482 | #ifdef SND_HDA_NEEDS_RESUME |
| 3483 | .resume = alc_resume, |
| 3484 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3485 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3486 | .check_power_status = alc_check_power_status, |
| 3487 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3488 | }; |
| 3489 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3490 | |
| 3491 | /* |
| 3492 | * Test configuration for debugging |
| 3493 | * |
| 3494 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3495 | * enum controls. |
| 3496 | */ |
| 3497 | #ifdef CONFIG_SND_DEBUG |
| 3498 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3499 | 0x02, 0x03, 0x04, 0x05 |
| 3500 | }; |
| 3501 | |
| 3502 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3503 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3504 | .items = { |
| 3505 | { "In-1", 0x0 }, |
| 3506 | { "In-2", 0x1 }, |
| 3507 | { "In-3", 0x2 }, |
| 3508 | { "In-4", 0x3 }, |
| 3509 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3510 | { "Front", 0x5 }, |
| 3511 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3512 | }, |
| 3513 | }; |
| 3514 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3515 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3516 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3517 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3518 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3519 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3520 | }; |
| 3521 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3522 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3523 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3524 | { |
| 3525 | static char *texts[] = { |
| 3526 | "N/A", "Line Out", "HP Out", |
| 3527 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3528 | }; |
| 3529 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3530 | uinfo->count = 1; |
| 3531 | uinfo->value.enumerated.items = 8; |
| 3532 | if (uinfo->value.enumerated.item >= 8) |
| 3533 | uinfo->value.enumerated.item = 7; |
| 3534 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3535 | return 0; |
| 3536 | } |
| 3537 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3538 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3539 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3540 | { |
| 3541 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3542 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3543 | unsigned int pin_ctl, item = 0; |
| 3544 | |
| 3545 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3546 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3547 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3548 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3549 | item = 2; |
| 3550 | else |
| 3551 | item = 1; |
| 3552 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3553 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3554 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3555 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3556 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3557 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3558 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3559 | } |
| 3560 | } |
| 3561 | ucontrol->value.enumerated.item[0] = item; |
| 3562 | return 0; |
| 3563 | } |
| 3564 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3565 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3566 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3567 | { |
| 3568 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3569 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3570 | static unsigned int ctls[] = { |
| 3571 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3572 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3573 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3574 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3575 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3576 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3577 | }; |
| 3578 | unsigned int old_ctl, new_ctl; |
| 3579 | |
| 3580 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3581 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3582 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3583 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3584 | int val; |
| 3585 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3586 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3587 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3588 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3589 | HDA_AMP_MUTE : 0; |
| 3590 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3591 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3592 | return 1; |
| 3593 | } |
| 3594 | return 0; |
| 3595 | } |
| 3596 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3597 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3598 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3599 | { |
| 3600 | static char *texts[] = { |
| 3601 | "Front", "Surround", "CLFE", "Side" |
| 3602 | }; |
| 3603 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3604 | uinfo->count = 1; |
| 3605 | uinfo->value.enumerated.items = 4; |
| 3606 | if (uinfo->value.enumerated.item >= 4) |
| 3607 | uinfo->value.enumerated.item = 3; |
| 3608 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3609 | return 0; |
| 3610 | } |
| 3611 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3612 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3613 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3614 | { |
| 3615 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3616 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3617 | unsigned int sel; |
| 3618 | |
| 3619 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3620 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3621 | return 0; |
| 3622 | } |
| 3623 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3624 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3625 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3626 | { |
| 3627 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3628 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3629 | unsigned int sel; |
| 3630 | |
| 3631 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3632 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3633 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3634 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3635 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3636 | return 1; |
| 3637 | } |
| 3638 | return 0; |
| 3639 | } |
| 3640 | |
| 3641 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3642 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3643 | .name = xname, \ |
| 3644 | .info = alc_test_pin_ctl_info, \ |
| 3645 | .get = alc_test_pin_ctl_get, \ |
| 3646 | .put = alc_test_pin_ctl_put, \ |
| 3647 | .private_value = nid \ |
| 3648 | } |
| 3649 | |
| 3650 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3651 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3652 | .name = xname, \ |
| 3653 | .info = alc_test_pin_src_info, \ |
| 3654 | .get = alc_test_pin_src_get, \ |
| 3655 | .put = alc_test_pin_src_put, \ |
| 3656 | .private_value = nid \ |
| 3657 | } |
| 3658 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3659 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3660 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3661 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3662 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3663 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3664 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3665 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3666 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3667 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3668 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3669 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3670 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3671 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3672 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3673 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3674 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3675 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3676 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3677 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3678 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3679 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3680 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3681 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3682 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3683 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3684 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3685 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3686 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3687 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3688 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3689 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3690 | { |
| 3691 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3692 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3693 | .info = alc_ch_mode_info, |
| 3694 | .get = alc_ch_mode_get, |
| 3695 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3696 | }, |
| 3697 | { } /* end */ |
| 3698 | }; |
| 3699 | |
| 3700 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3701 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3702 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3703 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3704 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3705 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3706 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3707 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3708 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3709 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3710 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3711 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3712 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3713 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3714 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3715 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3716 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3717 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3718 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3719 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3720 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3721 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3722 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3723 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3724 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3725 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3726 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3727 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3728 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3729 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3730 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3731 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3732 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3733 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3734 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3735 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3736 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3737 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3738 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3739 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3740 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3741 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3742 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3743 | /* Analog input/passthru */ |
| 3744 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3745 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3746 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3747 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3748 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3749 | { } |
| 3750 | }; |
| 3751 | #endif |
| 3752 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3753 | /* |
| 3754 | */ |
| 3755 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3756 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3757 | [ALC880_3ST] = "3stack", |
| 3758 | [ALC880_TCL_S700] = "tcl", |
| 3759 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3760 | [ALC880_CLEVO] = "clevo", |
| 3761 | [ALC880_5ST] = "5stack", |
| 3762 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3763 | [ALC880_W810] = "w810", |
| 3764 | [ALC880_Z71V] = "z71v", |
| 3765 | [ALC880_6ST] = "6stack", |
| 3766 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3767 | [ALC880_ASUS] = "asus", |
| 3768 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3769 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3770 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3771 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3772 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3773 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3774 | [ALC880_F1734] = "F1734", |
| 3775 | [ALC880_LG] = "lg", |
| 3776 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3777 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3778 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3779 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3780 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3781 | [ALC880_AUTO] = "auto", |
| 3782 | }; |
| 3783 | |
| 3784 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3785 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3786 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3787 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3788 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3789 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3790 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3791 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3792 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3793 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3794 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3795 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3796 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3797 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3798 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3799 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3800 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3801 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3802 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3803 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3804 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3805 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3806 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3807 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3808 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3809 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3810 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3811 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3812 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3813 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3814 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3815 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3816 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3817 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3818 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3819 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3820 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3821 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3822 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3823 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3824 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3825 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3826 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3827 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3828 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3829 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3830 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3831 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3832 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3833 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3834 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3835 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3836 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3837 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3838 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3839 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3840 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3841 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3842 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3843 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3844 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3845 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3846 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3847 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3848 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3849 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3850 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3851 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3852 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3853 | /* default Intel */ |
| 3854 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3855 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3856 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3857 | {} |
| 3858 | }; |
| 3859 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3860 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3861 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3862 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3863 | static struct alc_config_preset alc880_presets[] = { |
| 3864 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3865 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3866 | .init_verbs = { alc880_volume_init_verbs, |
| 3867 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3868 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3869 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3870 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3871 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3872 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3873 | .input_mux = &alc880_capture_source, |
| 3874 | }, |
| 3875 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3876 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3877 | .init_verbs = { alc880_volume_init_verbs, |
| 3878 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3879 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3880 | .dac_nids = alc880_dac_nids, |
| 3881 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3882 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3883 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3884 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3885 | .input_mux = &alc880_capture_source, |
| 3886 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3887 | [ALC880_TCL_S700] = { |
| 3888 | .mixers = { alc880_tcl_s700_mixer }, |
| 3889 | .init_verbs = { alc880_volume_init_verbs, |
| 3890 | alc880_pin_tcl_S700_init_verbs, |
| 3891 | alc880_gpio2_init_verbs }, |
| 3892 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3893 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3894 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3895 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3896 | .hp_nid = 0x03, |
| 3897 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3898 | .channel_mode = alc880_2_jack_modes, |
| 3899 | .input_mux = &alc880_capture_source, |
| 3900 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3901 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3902 | .mixers = { alc880_three_stack_mixer, |
| 3903 | alc880_five_stack_mixer}, |
| 3904 | .init_verbs = { alc880_volume_init_verbs, |
| 3905 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3906 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3907 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3908 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3909 | .channel_mode = alc880_fivestack_modes, |
| 3910 | .input_mux = &alc880_capture_source, |
| 3911 | }, |
| 3912 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3913 | .mixers = { alc880_three_stack_mixer, |
| 3914 | alc880_five_stack_mixer }, |
| 3915 | .init_verbs = { alc880_volume_init_verbs, |
| 3916 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3917 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3918 | .dac_nids = alc880_dac_nids, |
| 3919 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3920 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3921 | .channel_mode = alc880_fivestack_modes, |
| 3922 | .input_mux = &alc880_capture_source, |
| 3923 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3924 | [ALC880_6ST] = { |
| 3925 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3926 | .init_verbs = { alc880_volume_init_verbs, |
| 3927 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3928 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3929 | .dac_nids = alc880_6st_dac_nids, |
| 3930 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3931 | .channel_mode = alc880_sixstack_modes, |
| 3932 | .input_mux = &alc880_6stack_capture_source, |
| 3933 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3934 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3935 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3936 | .init_verbs = { alc880_volume_init_verbs, |
| 3937 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3938 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3939 | .dac_nids = alc880_6st_dac_nids, |
| 3940 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3941 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3942 | .channel_mode = alc880_sixstack_modes, |
| 3943 | .input_mux = &alc880_6stack_capture_source, |
| 3944 | }, |
| 3945 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3946 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3947 | .init_verbs = { alc880_volume_init_verbs, |
| 3948 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3949 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3950 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3951 | .dac_nids = alc880_w810_dac_nids, |
| 3952 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3953 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3954 | .channel_mode = alc880_w810_modes, |
| 3955 | .input_mux = &alc880_capture_source, |
| 3956 | }, |
| 3957 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3958 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3959 | .init_verbs = { alc880_volume_init_verbs, |
| 3960 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3961 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3962 | .dac_nids = alc880_z71v_dac_nids, |
| 3963 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3964 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3965 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3966 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3967 | .input_mux = &alc880_capture_source, |
| 3968 | }, |
| 3969 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3970 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3971 | .init_verbs = { alc880_volume_init_verbs, |
| 3972 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3973 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3974 | .dac_nids = alc880_f1734_dac_nids, |
| 3975 | .hp_nid = 0x02, |
| 3976 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3977 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3978 | .input_mux = &alc880_f1734_capture_source, |
| 3979 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3980 | .init_hook = alc880_uniwill_p53_init_hook, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3981 | }, |
| 3982 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3983 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3984 | .init_verbs = { alc880_volume_init_verbs, |
| 3985 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3986 | alc880_gpio1_init_verbs }, |
| 3987 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3988 | .dac_nids = alc880_asus_dac_nids, |
| 3989 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3990 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3991 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3992 | .input_mux = &alc880_capture_source, |
| 3993 | }, |
| 3994 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3995 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3996 | .init_verbs = { alc880_volume_init_verbs, |
| 3997 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3998 | alc880_gpio1_init_verbs }, |
| 3999 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4000 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4001 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4002 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4003 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4004 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4005 | .input_mux = &alc880_capture_source, |
| 4006 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4007 | [ALC880_ASUS_DIG2] = { |
| 4008 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4009 | .init_verbs = { alc880_volume_init_verbs, |
| 4010 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4011 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4012 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4013 | .dac_nids = alc880_asus_dac_nids, |
| 4014 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4015 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4016 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4017 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4018 | .input_mux = &alc880_capture_source, |
| 4019 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4020 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4021 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4022 | .init_verbs = { alc880_volume_init_verbs, |
| 4023 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4024 | alc880_gpio1_init_verbs }, |
| 4025 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4026 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4027 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4028 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4029 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4030 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4031 | .input_mux = &alc880_capture_source, |
| 4032 | }, |
| 4033 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4034 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4035 | .init_verbs = { alc880_volume_init_verbs, |
| 4036 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4037 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4038 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4039 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4040 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4041 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4042 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4043 | .input_mux = &alc880_capture_source, |
| 4044 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4045 | [ALC880_UNIWILL] = { |
| 4046 | .mixers = { alc880_uniwill_mixer }, |
| 4047 | .init_verbs = { alc880_volume_init_verbs, |
| 4048 | alc880_uniwill_init_verbs }, |
| 4049 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4050 | .dac_nids = alc880_asus_dac_nids, |
| 4051 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4052 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4053 | .channel_mode = alc880_threestack_modes, |
| 4054 | .need_dac_fix = 1, |
| 4055 | .input_mux = &alc880_capture_source, |
| 4056 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4057 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4058 | }, |
| 4059 | [ALC880_UNIWILL_P53] = { |
| 4060 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4061 | .init_verbs = { alc880_volume_init_verbs, |
| 4062 | alc880_uniwill_p53_init_verbs }, |
| 4063 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4064 | .dac_nids = alc880_asus_dac_nids, |
| 4065 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4066 | .channel_mode = alc880_threestack_modes, |
| 4067 | .input_mux = &alc880_capture_source, |
| 4068 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4069 | .init_hook = alc880_uniwill_p53_init_hook, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4070 | }, |
| 4071 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4072 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4073 | .init_verbs = { alc880_volume_init_verbs, |
| 4074 | alc880_uniwill_p53_init_verbs, |
| 4075 | alc880_beep_init_verbs }, |
| 4076 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4077 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4078 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4079 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4080 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4081 | .input_mux = &alc880_capture_source, |
| 4082 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4083 | .init_hook = alc880_uniwill_p53_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4084 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4085 | [ALC880_CLEVO] = { |
| 4086 | .mixers = { alc880_three_stack_mixer }, |
| 4087 | .init_verbs = { alc880_volume_init_verbs, |
| 4088 | alc880_pin_clevo_init_verbs }, |
| 4089 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4090 | .dac_nids = alc880_dac_nids, |
| 4091 | .hp_nid = 0x03, |
| 4092 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4093 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4094 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4095 | .input_mux = &alc880_capture_source, |
| 4096 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4097 | [ALC880_LG] = { |
| 4098 | .mixers = { alc880_lg_mixer }, |
| 4099 | .init_verbs = { alc880_volume_init_verbs, |
| 4100 | alc880_lg_init_verbs }, |
| 4101 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4102 | .dac_nids = alc880_lg_dac_nids, |
| 4103 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4104 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4105 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4106 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4107 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4108 | .unsol_event = alc_automute_amp_unsol_event, |
| 4109 | .init_hook = alc880_lg_init_hook, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4110 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4111 | .loopbacks = alc880_lg_loopbacks, |
| 4112 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4113 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4114 | [ALC880_LG_LW] = { |
| 4115 | .mixers = { alc880_lg_lw_mixer }, |
| 4116 | .init_verbs = { alc880_volume_init_verbs, |
| 4117 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4118 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4119 | .dac_nids = alc880_dac_nids, |
| 4120 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4121 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4122 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4123 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4124 | .unsol_event = alc_automute_amp_unsol_event, |
| 4125 | .init_hook = alc880_lg_lw_init_hook, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4126 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4127 | [ALC880_MEDION_RIM] = { |
| 4128 | .mixers = { alc880_medion_rim_mixer }, |
| 4129 | .init_verbs = { alc880_volume_init_verbs, |
| 4130 | alc880_medion_rim_init_verbs, |
| 4131 | alc_gpio2_init_verbs }, |
| 4132 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4133 | .dac_nids = alc880_dac_nids, |
| 4134 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4135 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4136 | .channel_mode = alc880_2_jack_modes, |
| 4137 | .input_mux = &alc880_medion_rim_capture_source, |
| 4138 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4139 | .init_hook = alc880_medion_rim_init_hook, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4140 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4141 | #ifdef CONFIG_SND_DEBUG |
| 4142 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4143 | .mixers = { alc880_test_mixer }, |
| 4144 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4145 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4146 | .dac_nids = alc880_test_dac_nids, |
| 4147 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4148 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4149 | .channel_mode = alc880_test_modes, |
| 4150 | .input_mux = &alc880_test_capture_source, |
| 4151 | }, |
| 4152 | #endif |
| 4153 | }; |
| 4154 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4155 | /* |
| 4156 | * Automatic parse of I/O pins from the BIOS configuration |
| 4157 | */ |
| 4158 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4159 | enum { |
| 4160 | ALC_CTL_WIDGET_VOL, |
| 4161 | ALC_CTL_WIDGET_MUTE, |
| 4162 | ALC_CTL_BIND_MUTE, |
| 4163 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4164 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4165 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4166 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4167 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4168 | }; |
| 4169 | |
| 4170 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4171 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4172 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4173 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4174 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4175 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4176 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4177 | knew = snd_array_new(&spec->kctls); |
| 4178 | if (!knew) |
| 4179 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4180 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4181 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4182 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4183 | return -ENOMEM; |
| 4184 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4185 | return 0; |
| 4186 | } |
| 4187 | |
| 4188 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4189 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4190 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4191 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4192 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4193 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4194 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4195 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4196 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4197 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4198 | #define ALC880_PIN_CD_NID 0x1c |
| 4199 | |
| 4200 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4201 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4202 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4203 | { |
| 4204 | hda_nid_t nid; |
| 4205 | int assigned[4]; |
| 4206 | int i, j; |
| 4207 | |
| 4208 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4209 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4210 | |
| 4211 | /* check the pins hardwired to audio widget */ |
| 4212 | for (i = 0; i < cfg->line_outs; i++) { |
| 4213 | nid = cfg->line_out_pins[i]; |
| 4214 | if (alc880_is_fixed_pin(nid)) { |
| 4215 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4216 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4217 | assigned[idx] = 1; |
| 4218 | } |
| 4219 | } |
| 4220 | /* left pins can be connect to any audio widget */ |
| 4221 | for (i = 0; i < cfg->line_outs; i++) { |
| 4222 | nid = cfg->line_out_pins[i]; |
| 4223 | if (alc880_is_fixed_pin(nid)) |
| 4224 | continue; |
| 4225 | /* search for an empty channel */ |
| 4226 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4227 | if (!assigned[j]) { |
| 4228 | spec->multiout.dac_nids[i] = |
| 4229 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4230 | assigned[j] = 1; |
| 4231 | break; |
| 4232 | } |
| 4233 | } |
| 4234 | } |
| 4235 | spec->multiout.num_dacs = cfg->line_outs; |
| 4236 | return 0; |
| 4237 | } |
| 4238 | |
| 4239 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4240 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4241 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4242 | { |
| 4243 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4244 | static const char *chname[4] = { |
| 4245 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4246 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4247 | hda_nid_t nid; |
| 4248 | int i, err; |
| 4249 | |
| 4250 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4251 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4252 | continue; |
| 4253 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4254 | if (i == 2) { |
| 4255 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4256 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4257 | "Center Playback Volume", |
| 4258 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4259 | HDA_OUTPUT)); |
| 4260 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4261 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4262 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4263 | "LFE Playback Volume", |
| 4264 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4265 | HDA_OUTPUT)); |
| 4266 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4267 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4268 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4269 | "Center Playback Switch", |
| 4270 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4271 | HDA_INPUT)); |
| 4272 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4273 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4274 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4275 | "LFE Playback Switch", |
| 4276 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4277 | HDA_INPUT)); |
| 4278 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4279 | return err; |
| 4280 | } else { |
| 4281 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4282 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4283 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4284 | HDA_OUTPUT)); |
| 4285 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4286 | return err; |
| 4287 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4288 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4289 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4290 | HDA_INPUT)); |
| 4291 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4292 | return err; |
| 4293 | } |
| 4294 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4295 | return 0; |
| 4296 | } |
| 4297 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4298 | /* add playback controls for speaker and HP outputs */ |
| 4299 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4300 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4301 | { |
| 4302 | hda_nid_t nid; |
| 4303 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4304 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4305 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4306 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4307 | return 0; |
| 4308 | |
| 4309 | if (alc880_is_fixed_pin(pin)) { |
| 4310 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4311 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4312 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4313 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4314 | else |
| 4315 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4316 | /* control HP volume/switch on the output mixer amp */ |
| 4317 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4318 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4319 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4320 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4321 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4322 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4323 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4324 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4325 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4326 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4327 | return err; |
| 4328 | } else if (alc880_is_multi_pin(pin)) { |
| 4329 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4330 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4331 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4332 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4333 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4334 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4335 | return err; |
| 4336 | } |
| 4337 | return 0; |
| 4338 | } |
| 4339 | |
| 4340 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4341 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4342 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4343 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4344 | { |
| 4345 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4346 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4347 | |
| 4348 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4349 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4350 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4351 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4352 | return err; |
| 4353 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4354 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4355 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4356 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | return err; |
| 4358 | return 0; |
| 4359 | } |
| 4360 | |
| 4361 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4362 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4363 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4364 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4365 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4366 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4367 | |
| 4368 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4369 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4370 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4371 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4372 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4373 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4374 | if (err < 0) |
| 4375 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4376 | imux->items[imux->num_items].label = |
| 4377 | auto_pin_cfg_labels[i]; |
| 4378 | imux->items[imux->num_items].index = |
| 4379 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4380 | imux->num_items++; |
| 4381 | } |
| 4382 | } |
| 4383 | return 0; |
| 4384 | } |
| 4385 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4386 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4387 | unsigned int pin_type) |
| 4388 | { |
| 4389 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4390 | pin_type); |
| 4391 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4392 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4393 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4394 | } |
| 4395 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4396 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4397 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4398 | int dac_idx) |
| 4399 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4400 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4401 | /* need the manual connection? */ |
| 4402 | if (alc880_is_multi_pin(nid)) { |
| 4403 | struct alc_spec *spec = codec->spec; |
| 4404 | int idx = alc880_multi_pin_idx(nid); |
| 4405 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4406 | AC_VERB_SET_CONNECT_SEL, |
| 4407 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4408 | } |
| 4409 | } |
| 4410 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4411 | static int get_pin_type(int line_out_type) |
| 4412 | { |
| 4413 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4414 | return PIN_HP; |
| 4415 | else |
| 4416 | return PIN_OUT; |
| 4417 | } |
| 4418 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4419 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4420 | { |
| 4421 | struct alc_spec *spec = codec->spec; |
| 4422 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4423 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4424 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4425 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4426 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4427 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4428 | } |
| 4429 | } |
| 4430 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4431 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4432 | { |
| 4433 | struct alc_spec *spec = codec->spec; |
| 4434 | hda_nid_t pin; |
| 4435 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4436 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4437 | if (pin) /* connect to front */ |
| 4438 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4439 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4440 | if (pin) /* connect to front */ |
| 4441 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4442 | } |
| 4443 | |
| 4444 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4445 | { |
| 4446 | struct alc_spec *spec = codec->spec; |
| 4447 | int i; |
| 4448 | |
| 4449 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4450 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4451 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4452 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4453 | if (nid != ALC880_PIN_CD_NID && |
| 4454 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4455 | snd_hda_codec_write(codec, nid, 0, |
| 4456 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4457 | AMP_OUT_MUTE); |
| 4458 | } |
| 4459 | } |
| 4460 | } |
| 4461 | |
| 4462 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4463 | /* return 1 if successful, 0 if the proper config is not found, |
| 4464 | * or a negative error code |
| 4465 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4466 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4467 | { |
| 4468 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4469 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4470 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4471 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4472 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4473 | alc880_ignore); |
| 4474 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4475 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4476 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4477 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4478 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4479 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4480 | if (err < 0) |
| 4481 | return err; |
| 4482 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4483 | if (err < 0) |
| 4484 | return err; |
| 4485 | err = alc880_auto_create_extra_out(spec, |
| 4486 | spec->autocfg.speaker_pins[0], |
| 4487 | "Speaker"); |
| 4488 | if (err < 0) |
| 4489 | return err; |
| 4490 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4491 | "Headphone"); |
| 4492 | if (err < 0) |
| 4493 | return err; |
| 4494 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4495 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4496 | return err; |
| 4497 | |
| 4498 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4499 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4500 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4501 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4502 | hda_nid_t dig_nid; |
| 4503 | err = snd_hda_get_connections(codec, |
| 4504 | spec->autocfg.dig_out_pins[i], |
| 4505 | &dig_nid, 1); |
| 4506 | if (err < 0) |
| 4507 | continue; |
| 4508 | if (!i) |
| 4509 | spec->multiout.dig_out_nid = dig_nid; |
| 4510 | else { |
| 4511 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4512 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4513 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4514 | break; |
| 4515 | } |
| 4516 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4517 | if (spec->autocfg.dig_in_pin) |
| 4518 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4519 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4520 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4521 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4522 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4523 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4524 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4525 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4526 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4527 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4528 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4529 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4530 | return 1; |
| 4531 | } |
| 4532 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4533 | /* additional initialization for auto-configuration model */ |
| 4534 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4535 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4536 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4537 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4538 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4539 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4540 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4541 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4542 | } |
| 4543 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4544 | static void set_capture_mixer(struct alc_spec *spec) |
| 4545 | { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4546 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4547 | { alc_capture_mixer_nosrc1, |
| 4548 | alc_capture_mixer_nosrc2, |
| 4549 | alc_capture_mixer_nosrc3 }, |
| 4550 | { alc_capture_mixer1, |
| 4551 | alc_capture_mixer2, |
| 4552 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4553 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4554 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4555 | int mux; |
| 4556 | if (spec->input_mux && spec->input_mux->num_items > 1) |
| 4557 | mux = 1; |
| 4558 | else |
| 4559 | mux = 0; |
| 4560 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4561 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4562 | } |
| 4563 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4564 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4565 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4566 | |
| 4567 | /* |
| 4568 | * OK, here we have finally the patch for ALC880 |
| 4569 | */ |
| 4570 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4571 | static int patch_alc880(struct hda_codec *codec) |
| 4572 | { |
| 4573 | struct alc_spec *spec; |
| 4574 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4575 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4576 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4577 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4578 | if (spec == NULL) |
| 4579 | return -ENOMEM; |
| 4580 | |
| 4581 | codec->spec = spec; |
| 4582 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4583 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4584 | alc880_models, |
| 4585 | alc880_cfg_tbl); |
| 4586 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 4587 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 4588 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4589 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4590 | } |
| 4591 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4592 | if (board_config == ALC880_AUTO) { |
| 4593 | /* automatic parse from the BIOS config */ |
| 4594 | err = alc880_parse_auto_config(codec); |
| 4595 | if (err < 0) { |
| 4596 | alc_free(codec); |
| 4597 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4598 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4599 | printk(KERN_INFO |
| 4600 | "hda_codec: Cannot set up configuration " |
| 4601 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4602 | board_config = ALC880_3ST; |
| 4603 | } |
| 4604 | } |
| 4605 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4606 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4607 | if (err < 0) { |
| 4608 | alc_free(codec); |
| 4609 | return err; |
| 4610 | } |
| 4611 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4612 | if (board_config != ALC880_AUTO) |
| 4613 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4614 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4615 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4616 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4617 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4618 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4619 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4620 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4621 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4622 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4623 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4624 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4625 | /* get type */ |
| 4626 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4627 | if (wcap != AC_WID_AUD_IN) { |
| 4628 | spec->adc_nids = alc880_adc_nids_alt; |
| 4629 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4630 | } else { |
| 4631 | spec->adc_nids = alc880_adc_nids; |
| 4632 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4633 | } |
| 4634 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4635 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4636 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4637 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4638 | spec->vmaster_nid = 0x0c; |
| 4639 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4640 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4641 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4642 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4643 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4644 | if (!spec->loopback.amplist) |
| 4645 | spec->loopback.amplist = alc880_loopbacks; |
| 4646 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4647 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4648 | |
| 4649 | return 0; |
| 4650 | } |
| 4651 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4652 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4653 | /* |
| 4654 | * ALC260 support |
| 4655 | */ |
| 4656 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4657 | static hda_nid_t alc260_dac_nids[1] = { |
| 4658 | /* front */ |
| 4659 | 0x02, |
| 4660 | }; |
| 4661 | |
| 4662 | static hda_nid_t alc260_adc_nids[1] = { |
| 4663 | /* ADC0 */ |
| 4664 | 0x04, |
| 4665 | }; |
| 4666 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4667 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4668 | /* ADC1 */ |
| 4669 | 0x05, |
| 4670 | }; |
| 4671 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4672 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4673 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4674 | */ |
| 4675 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4676 | /* ADC0, ADC1 */ |
| 4677 | 0x04, 0x05 |
| 4678 | }; |
| 4679 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4680 | #define ALC260_DIGOUT_NID 0x03 |
| 4681 | #define ALC260_DIGIN_NID 0x06 |
| 4682 | |
| 4683 | static struct hda_input_mux alc260_capture_source = { |
| 4684 | .num_items = 4, |
| 4685 | .items = { |
| 4686 | { "Mic", 0x0 }, |
| 4687 | { "Front Mic", 0x1 }, |
| 4688 | { "Line", 0x2 }, |
| 4689 | { "CD", 0x4 }, |
| 4690 | }, |
| 4691 | }; |
| 4692 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4693 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4694 | * headphone jack and the internal CD lines since these are the only pins at |
| 4695 | * which audio can appear. For flexibility, also allow the option of |
| 4696 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4697 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4698 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4699 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4700 | { |
| 4701 | .num_items = 3, |
| 4702 | .items = { |
| 4703 | { "Mic/Line", 0x0 }, |
| 4704 | { "CD", 0x4 }, |
| 4705 | { "Headphone", 0x2 }, |
| 4706 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4707 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4708 | { |
| 4709 | .num_items = 4, |
| 4710 | .items = { |
| 4711 | { "Mic/Line", 0x0 }, |
| 4712 | { "CD", 0x4 }, |
| 4713 | { "Headphone", 0x2 }, |
| 4714 | { "Mixer", 0x5 }, |
| 4715 | }, |
| 4716 | }, |
| 4717 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4718 | }; |
| 4719 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4720 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4721 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4722 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4723 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4724 | { |
| 4725 | .num_items = 4, |
| 4726 | .items = { |
| 4727 | { "Mic", 0x0 }, |
| 4728 | { "Line", 0x2 }, |
| 4729 | { "CD", 0x4 }, |
| 4730 | { "Headphone", 0x5 }, |
| 4731 | }, |
| 4732 | }, |
| 4733 | { |
| 4734 | .num_items = 5, |
| 4735 | .items = { |
| 4736 | { "Mic", 0x0 }, |
| 4737 | { "Line", 0x2 }, |
| 4738 | { "CD", 0x4 }, |
| 4739 | { "Headphone", 0x6 }, |
| 4740 | { "Mixer", 0x5 }, |
| 4741 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4742 | }, |
| 4743 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4744 | |
| 4745 | /* Maxdata Favorit 100XS */ |
| 4746 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4747 | { |
| 4748 | .num_items = 2, |
| 4749 | .items = { |
| 4750 | { "Line/Mic", 0x0 }, |
| 4751 | { "CD", 0x4 }, |
| 4752 | }, |
| 4753 | }, |
| 4754 | { |
| 4755 | .num_items = 3, |
| 4756 | .items = { |
| 4757 | { "Line/Mic", 0x0 }, |
| 4758 | { "CD", 0x4 }, |
| 4759 | { "Mixer", 0x5 }, |
| 4760 | }, |
| 4761 | }, |
| 4762 | }; |
| 4763 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4764 | /* |
| 4765 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4766 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4767 | * element which allows changing the channel mode, so the verb list is |
| 4768 | * never used. |
| 4769 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4770 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4771 | { 2, NULL }, |
| 4772 | }; |
| 4773 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4774 | |
| 4775 | /* Mixer combinations |
| 4776 | * |
| 4777 | * basic: base_output + input + pc_beep + capture |
| 4778 | * HP: base_output + input + capture_alt |
| 4779 | * HP_3013: hp_3013 + input + capture |
| 4780 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4781 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4782 | */ |
| 4783 | |
| 4784 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4785 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4786 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4787 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4788 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4789 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4790 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4791 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4792 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4793 | |
| 4794 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4795 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4796 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4797 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4798 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4799 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4800 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4801 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4802 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4803 | { } /* end */ |
| 4804 | }; |
| 4805 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4806 | /* update HP, line and mono out pins according to the master switch */ |
| 4807 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4808 | hda_nid_t hp, hda_nid_t line, |
| 4809 | hda_nid_t mono) |
| 4810 | { |
| 4811 | struct alc_spec *spec = codec->spec; |
| 4812 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4813 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4814 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4815 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4816 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4817 | val); |
| 4818 | /* mono (speaker) depending on the HP jack sense */ |
| 4819 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4820 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4821 | val); |
| 4822 | } |
| 4823 | |
| 4824 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4825 | struct snd_ctl_elem_value *ucontrol) |
| 4826 | { |
| 4827 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4828 | struct alc_spec *spec = codec->spec; |
| 4829 | *ucontrol->value.integer.value = spec->master_sw; |
| 4830 | return 0; |
| 4831 | } |
| 4832 | |
| 4833 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4834 | struct snd_ctl_elem_value *ucontrol) |
| 4835 | { |
| 4836 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4837 | struct alc_spec *spec = codec->spec; |
| 4838 | int val = !!*ucontrol->value.integer.value; |
| 4839 | hda_nid_t hp, line, mono; |
| 4840 | |
| 4841 | if (val == spec->master_sw) |
| 4842 | return 0; |
| 4843 | spec->master_sw = val; |
| 4844 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4845 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4846 | mono = kcontrol->private_value & 0xff; |
| 4847 | alc260_hp_master_update(codec, hp, line, mono); |
| 4848 | return 1; |
| 4849 | } |
| 4850 | |
| 4851 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4852 | { |
| 4853 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4854 | .name = "Master Playback Switch", |
| 4855 | .info = snd_ctl_boolean_mono_info, |
| 4856 | .get = alc260_hp_master_sw_get, |
| 4857 | .put = alc260_hp_master_sw_put, |
| 4858 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4859 | }, |
| 4860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4861 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4862 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4863 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4864 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4865 | HDA_OUTPUT), |
| 4866 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4867 | { } /* end */ |
| 4868 | }; |
| 4869 | |
| 4870 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4871 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4872 | {}, |
| 4873 | }; |
| 4874 | |
| 4875 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4876 | { |
| 4877 | struct alc_spec *spec = codec->spec; |
| 4878 | unsigned int present; |
| 4879 | |
| 4880 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4881 | AC_VERB_GET_PIN_SENSE, 0); |
| 4882 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4883 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4884 | } |
| 4885 | |
| 4886 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4887 | { |
| 4888 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4889 | alc260_hp_automute(codec); |
| 4890 | } |
| 4891 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4892 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4893 | { |
| 4894 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4895 | .name = "Master Playback Switch", |
| 4896 | .info = snd_ctl_boolean_mono_info, |
| 4897 | .get = alc260_hp_master_sw_get, |
| 4898 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4899 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4900 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4901 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4902 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4903 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4904 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4905 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4906 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4907 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4908 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4909 | { } /* end */ |
| 4910 | }; |
| 4911 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4912 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4913 | .ops = &snd_hda_bind_vol, |
| 4914 | .values = { |
| 4915 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4916 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4917 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4918 | 0 |
| 4919 | }, |
| 4920 | }; |
| 4921 | |
| 4922 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4923 | .ops = &snd_hda_bind_sw, |
| 4924 | .values = { |
| 4925 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4926 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4927 | 0 |
| 4928 | }, |
| 4929 | }; |
| 4930 | |
| 4931 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4932 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4933 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4934 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4935 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4936 | { } /* end */ |
| 4937 | }; |
| 4938 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4939 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4940 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4941 | {}, |
| 4942 | }; |
| 4943 | |
| 4944 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4945 | { |
| 4946 | struct alc_spec *spec = codec->spec; |
| 4947 | unsigned int present; |
| 4948 | |
| 4949 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4950 | AC_VERB_GET_PIN_SENSE, 0); |
| 4951 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4952 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4953 | } |
| 4954 | |
| 4955 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4956 | unsigned int res) |
| 4957 | { |
| 4958 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4959 | alc260_hp_3013_automute(codec); |
| 4960 | } |
| 4961 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4962 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4963 | { |
| 4964 | unsigned int present, bits; |
| 4965 | |
| 4966 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4967 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4968 | |
| 4969 | bits = present ? 0 : PIN_OUT; |
| 4970 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4971 | bits); |
| 4972 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4973 | bits); |
| 4974 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4975 | bits); |
| 4976 | } |
| 4977 | |
| 4978 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4979 | unsigned int res) |
| 4980 | { |
| 4981 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4982 | alc260_hp_3012_automute(codec); |
| 4983 | } |
| 4984 | |
| 4985 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4986 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4987 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4988 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4989 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4990 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4991 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4992 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4993 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4994 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4995 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4996 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4997 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4998 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4999 | { } /* end */ |
| 5000 | }; |
| 5001 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5002 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5003 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5004 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5005 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5006 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5007 | * revisions available in early 2006. Therefore for now allow the |
| 5008 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5009 | * that the lack of mic bias for this NID is intentional we could change the |
| 5010 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5011 | * |
| 5012 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5013 | * don't appear to make the mic bias available from the "line" jack, even |
| 5014 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5015 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5016 | * and the output jack. If this turns out to be the case for all such |
| 5017 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5018 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5019 | * |
| 5020 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5021 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5022 | * controls for such models. On models without a "mono speaker" the control |
| 5023 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5024 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5025 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5026 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5027 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5028 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5029 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5030 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5031 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5032 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5033 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5034 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5035 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5036 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5037 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5038 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5039 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5040 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5041 | { } /* end */ |
| 5042 | }; |
| 5043 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5044 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5045 | */ |
| 5046 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5047 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5048 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5049 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5050 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5051 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5052 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5053 | { } /* end */ |
| 5054 | }; |
| 5055 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5056 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5057 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5058 | */ |
| 5059 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5060 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5061 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5062 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5064 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5065 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5066 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5067 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5068 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5069 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5070 | { } /* end */ |
| 5071 | }; |
| 5072 | |
| 5073 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5074 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5075 | */ |
| 5076 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5077 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5078 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5079 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5080 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5081 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5082 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5083 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5084 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5085 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5086 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5087 | { } /* end */ |
| 5088 | }; |
| 5089 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5090 | /* |
| 5091 | * initialization verbs |
| 5092 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5093 | static struct hda_verb alc260_init_verbs[] = { |
| 5094 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5095 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5096 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5097 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5098 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5099 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5100 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5101 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5102 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5103 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5104 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5105 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5106 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5107 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5108 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5109 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5110 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5111 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5112 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5113 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5114 | /* set connection select to line in (default select for this ADC) */ |
| 5115 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5116 | /* mute capture amp left and right */ |
| 5117 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5118 | /* set connection select to line in (default select for this ADC) */ |
| 5119 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5120 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5121 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5122 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5123 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5124 | /* set vol=0 HP mixer amp left and right */ |
| 5125 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5126 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5127 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5128 | /* set vol=0 Mono mixer amp left and right */ |
| 5129 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5130 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5131 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5132 | /* unmute LINE-2 out pin */ |
| 5133 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5134 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5135 | * Line In 2 = 0x03 |
| 5136 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5137 | /* mute analog inputs */ |
| 5138 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5139 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5140 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5141 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5142 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5143 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5144 | /* mute Front out path */ |
| 5145 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5146 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5147 | /* mute Headphone out path */ |
| 5148 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5149 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5150 | /* mute Mono out path */ |
| 5151 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5152 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5153 | { } |
| 5154 | }; |
| 5155 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5156 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5157 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5158 | /* Headphone and output */ |
| 5159 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5160 | /* mono output */ |
| 5161 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5162 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5163 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5164 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5165 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5166 | /* Line In pin widget for input */ |
| 5167 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5168 | /* Line-2 pin widget for output */ |
| 5169 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5170 | /* CD pin widget for input */ |
| 5171 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5172 | /* unmute amp left and right */ |
| 5173 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5174 | /* set connection select to line in (default select for this ADC) */ |
| 5175 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5176 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5177 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5178 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5179 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5180 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5181 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5182 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5183 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5184 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5185 | * Line In 2 = 0x03 |
| 5186 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5187 | /* mute analog inputs */ |
| 5188 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5189 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5190 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5191 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5192 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5193 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5194 | /* Unmute Front out path */ |
| 5195 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5196 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5197 | /* Unmute Headphone out path */ |
| 5198 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5199 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5200 | /* Unmute Mono out path */ |
| 5201 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5202 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5203 | { } |
| 5204 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5205 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5206 | |
| 5207 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5208 | /* Line out and output */ |
| 5209 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5210 | /* mono output */ |
| 5211 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5212 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5213 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5214 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5215 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5216 | /* Line In pin widget for input */ |
| 5217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5218 | /* Headphone pin widget for output */ |
| 5219 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5220 | /* CD pin widget for input */ |
| 5221 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5222 | /* unmute amp left and right */ |
| 5223 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5224 | /* set connection select to line in (default select for this ADC) */ |
| 5225 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5226 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5227 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5228 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5229 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5230 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5231 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5232 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5233 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5234 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5235 | * Line In 2 = 0x03 |
| 5236 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5237 | /* mute analog inputs */ |
| 5238 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5239 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5240 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5241 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5242 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5243 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5244 | /* Unmute Front out path */ |
| 5245 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5246 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5247 | /* Unmute Headphone out path */ |
| 5248 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5249 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5250 | /* Unmute Mono out path */ |
| 5251 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5252 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5253 | { } |
| 5254 | }; |
| 5255 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5256 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5257 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5258 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5259 | */ |
| 5260 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5261 | /* Disable all GPIOs */ |
| 5262 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5263 | /* Internal speaker is connected to headphone pin */ |
| 5264 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5265 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5266 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5267 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5268 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5269 | /* Ensure all other unused pins are disabled and muted. */ |
| 5270 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5271 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5272 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5273 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5274 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5275 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5276 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5277 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5278 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5279 | /* Disable digital (SPDIF) pins */ |
| 5280 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5281 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5282 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5283 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5284 | * when acting as an output. |
| 5285 | */ |
| 5286 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5287 | |
| 5288 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5289 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5290 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5291 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5292 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5293 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5294 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5295 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5296 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5297 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5298 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5299 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5300 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5301 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5302 | * If the pin mode is changed by the user the pin mode control will |
| 5303 | * take care of enabling the pin's input/output buffers as needed. |
| 5304 | * Therefore there's no need to enable the input buffer at this |
| 5305 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5306 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5307 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5308 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5309 | * mixer ctrl) |
| 5310 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5311 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5312 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5313 | /* Mute capture amp left and right */ |
| 5314 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5315 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5316 | * in (on mic1 pin) |
| 5317 | */ |
| 5318 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5319 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5320 | /* Do the same for the second ADC: mute capture input amp and |
| 5321 | * set ADC connection to line in (on mic1 pin) |
| 5322 | */ |
| 5323 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5324 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5325 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5326 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5327 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5328 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5329 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5330 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5331 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5334 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5335 | |
| 5336 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5337 | }; |
| 5338 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5339 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5340 | * similar laptops (adapted from Fujitsu init verbs). |
| 5341 | */ |
| 5342 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5343 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5344 | * the headphone jack. Turn this on and rely on the standard mute |
| 5345 | * methods whenever the user wants to turn these outputs off. |
| 5346 | */ |
| 5347 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5348 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5349 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5350 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5351 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5352 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5353 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5354 | /* Line In jack is connected to Line1 pin */ |
| 5355 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5356 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5357 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5358 | /* Ensure all other unused pins are disabled and muted. */ |
| 5359 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5360 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5361 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5362 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5364 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5365 | /* Disable digital (SPDIF) pins */ |
| 5366 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5367 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5368 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5369 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5370 | * bus when acting as outputs. |
| 5371 | */ |
| 5372 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5373 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5374 | |
| 5375 | /* Start with output sum widgets muted and their output gains at min */ |
| 5376 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5377 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5378 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5379 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5380 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5381 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5382 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5383 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5384 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5385 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5386 | /* Unmute Line-out pin widget amp left and right |
| 5387 | * (no equiv mixer ctrl) |
| 5388 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5389 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5390 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5391 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5392 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5393 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5394 | * will take care of enabling the pin's input/output buffers as needed. |
| 5395 | * Therefore there's no need to enable the input buffer at this |
| 5396 | * stage. |
| 5397 | */ |
| 5398 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5399 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5400 | |
| 5401 | /* Mute capture amp left and right */ |
| 5402 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5403 | /* Set ADC connection select to match default mixer setting - mic |
| 5404 | * (on mic1 pin) |
| 5405 | */ |
| 5406 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5407 | |
| 5408 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5409 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5410 | */ |
| 5411 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5412 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5413 | |
| 5414 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5416 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5417 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5418 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5419 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5420 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5421 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5422 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5423 | |
| 5424 | { } |
| 5425 | }; |
| 5426 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5427 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5428 | * (adapted from Acer init verbs). |
| 5429 | */ |
| 5430 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5431 | /* GPIO 0 enables the output jack. |
| 5432 | * Turn this on and rely on the standard mute |
| 5433 | * methods whenever the user wants to turn these outputs off. |
| 5434 | */ |
| 5435 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5436 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5437 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5438 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5439 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5440 | /* Ensure all other unused pins are disabled and muted. */ |
| 5441 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5442 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5443 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5444 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5445 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5446 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5447 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5448 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5449 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5450 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5451 | /* Disable digital (SPDIF) pins */ |
| 5452 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5453 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5454 | |
| 5455 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5456 | * bus when acting as outputs. |
| 5457 | */ |
| 5458 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5459 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5460 | |
| 5461 | /* Start with output sum widgets muted and their output gains at min */ |
| 5462 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5463 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5464 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5465 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5466 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5467 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5468 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5469 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5470 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5471 | |
| 5472 | /* Unmute Line-out pin widget amp left and right |
| 5473 | * (no equiv mixer ctrl) |
| 5474 | */ |
| 5475 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5476 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5477 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5478 | * will take care of enabling the pin's input/output buffers as needed. |
| 5479 | * Therefore there's no need to enable the input buffer at this |
| 5480 | * stage. |
| 5481 | */ |
| 5482 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5483 | |
| 5484 | /* Mute capture amp left and right */ |
| 5485 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5486 | /* Set ADC connection select to match default mixer setting - mic |
| 5487 | * (on mic1 pin) |
| 5488 | */ |
| 5489 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5490 | |
| 5491 | /* Do similar with the second ADC: mute capture input amp and |
| 5492 | * set ADC connection to mic to match ALSA's default state. |
| 5493 | */ |
| 5494 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5495 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5496 | |
| 5497 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5498 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5499 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5500 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5501 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5502 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5503 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5505 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5506 | |
| 5507 | { } |
| 5508 | }; |
| 5509 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5510 | static struct hda_verb alc260_will_verbs[] = { |
| 5511 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5512 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5513 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5514 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5515 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5516 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5517 | {} |
| 5518 | }; |
| 5519 | |
| 5520 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5521 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5522 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5523 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5524 | |
| 5525 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5526 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5527 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5528 | |
| 5529 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5530 | {} |
| 5531 | }; |
| 5532 | |
| 5533 | /* toggle speaker-output according to the hp-jack state */ |
| 5534 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5535 | { |
| 5536 | unsigned int present; |
| 5537 | |
| 5538 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5539 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5540 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5541 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5542 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5543 | AC_VERB_SET_GPIO_DATA, 1); |
| 5544 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5545 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5546 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5547 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5548 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5549 | AC_VERB_SET_GPIO_DATA, 0); |
| 5550 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5551 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5552 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5553 | } |
| 5554 | } |
| 5555 | |
| 5556 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5557 | unsigned int res) |
| 5558 | { |
| 5559 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5560 | alc260_replacer_672v_automute(codec); |
| 5561 | } |
| 5562 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5563 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5564 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5565 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5566 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5567 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5568 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5569 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5570 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5571 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5572 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5573 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5574 | {} |
| 5575 | }; |
| 5576 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5577 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5578 | * configuration. |
| 5579 | */ |
| 5580 | #ifdef CONFIG_SND_DEBUG |
| 5581 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5582 | 0x02, |
| 5583 | }; |
| 5584 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5585 | 0x04, 0x05, |
| 5586 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5587 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5588 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5589 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5590 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5591 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5592 | { |
| 5593 | .num_items = 7, |
| 5594 | .items = { |
| 5595 | { "MIC1 pin", 0x0 }, |
| 5596 | { "MIC2 pin", 0x1 }, |
| 5597 | { "LINE1 pin", 0x2 }, |
| 5598 | { "LINE2 pin", 0x3 }, |
| 5599 | { "CD pin", 0x4 }, |
| 5600 | { "LINE-OUT pin", 0x5 }, |
| 5601 | { "HP-OUT pin", 0x6 }, |
| 5602 | }, |
| 5603 | }, |
| 5604 | { |
| 5605 | .num_items = 8, |
| 5606 | .items = { |
| 5607 | { "MIC1 pin", 0x0 }, |
| 5608 | { "MIC2 pin", 0x1 }, |
| 5609 | { "LINE1 pin", 0x2 }, |
| 5610 | { "LINE2 pin", 0x3 }, |
| 5611 | { "CD pin", 0x4 }, |
| 5612 | { "Mixer", 0x5 }, |
| 5613 | { "LINE-OUT pin", 0x6 }, |
| 5614 | { "HP-OUT pin", 0x7 }, |
| 5615 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5616 | }, |
| 5617 | }; |
| 5618 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5619 | /* Output driver widgets */ |
| 5620 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5621 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5622 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5623 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5624 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5625 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5626 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5627 | /* Modes for retasking pin widgets |
| 5628 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5629 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5630 | * mention this restriction. At this stage it's not clear whether |
| 5631 | * this behaviour is intentional or is a hardware bug in chip |
| 5632 | * revisions available at least up until early 2006. Therefore for |
| 5633 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5634 | * choices, but if it turns out that the lack of mic bias for these |
| 5635 | * NIDs is intentional we could change their modes from |
| 5636 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5637 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5638 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5639 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5640 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5641 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5642 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5643 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5644 | |
| 5645 | /* Loopback mixer controls */ |
| 5646 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5647 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5648 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5649 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5650 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5651 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5652 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5653 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5654 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5655 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5656 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5657 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5658 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5659 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5660 | |
| 5661 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5662 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5663 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5664 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5665 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5666 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5667 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5668 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5669 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5670 | */ |
| 5671 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5672 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5673 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5674 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5675 | * this output to turn on an external amplifier. |
| 5676 | */ |
| 5677 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5678 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5679 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5680 | { } /* end */ |
| 5681 | }; |
| 5682 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5683 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5684 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5685 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5686 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5687 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5688 | /* Enable retasking pins as output, initially without power amp */ |
| 5689 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5690 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5691 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5692 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5693 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5694 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5695 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5696 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5697 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5698 | * payload also sets the generation to 0, output to be in "consumer" |
| 5699 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5700 | * control. |
| 5701 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5702 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5703 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5704 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5705 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5706 | * OUT1 sum bus when acting as an output. |
| 5707 | */ |
| 5708 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5709 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5710 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5711 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5712 | |
| 5713 | /* Start with output sum widgets muted and their output gains at min */ |
| 5714 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5715 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5716 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5717 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5718 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5719 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5720 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5721 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5722 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5723 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5724 | /* Unmute retasking pin widget output buffers since the default |
| 5725 | * state appears to be output. As the pin mode is changed by the |
| 5726 | * user the pin mode control will take care of enabling the pin's |
| 5727 | * input/output buffers as needed. |
| 5728 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5729 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5730 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5731 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5732 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5733 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5734 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5735 | /* Also unmute the mono-out pin widget */ |
| 5736 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5737 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5738 | /* Mute capture amp left and right */ |
| 5739 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5740 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5741 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5742 | */ |
| 5743 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5744 | |
| 5745 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5746 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5747 | */ |
| 5748 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5749 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5750 | |
| 5751 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5752 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5753 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5754 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5755 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5756 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5757 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5758 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5759 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5760 | |
| 5761 | { } |
| 5762 | }; |
| 5763 | #endif |
| 5764 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5765 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5766 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5767 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5768 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5769 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5770 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5771 | /* |
| 5772 | * for BIOS auto-configuration |
| 5773 | */ |
| 5774 | |
| 5775 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5776 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5777 | { |
| 5778 | hda_nid_t nid_vol; |
| 5779 | unsigned long vol_val, sw_val; |
| 5780 | char name[32]; |
| 5781 | int err; |
| 5782 | |
| 5783 | if (nid >= 0x0f && nid < 0x11) { |
| 5784 | nid_vol = nid - 0x7; |
| 5785 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5786 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5787 | } else if (nid == 0x11) { |
| 5788 | nid_vol = nid - 0x7; |
| 5789 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5790 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5791 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5792 | nid_vol = 0x08; |
| 5793 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5794 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5795 | } else |
| 5796 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5797 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5798 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5799 | /* first control for the volume widget */ |
| 5800 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5801 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5802 | if (err < 0) |
| 5803 | return err; |
| 5804 | *vol_bits |= (1 << nid_vol); |
| 5805 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5806 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5807 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5808 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5809 | return err; |
| 5810 | return 1; |
| 5811 | } |
| 5812 | |
| 5813 | /* add playback controls from the parsed DAC table */ |
| 5814 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5815 | const struct auto_pin_cfg *cfg) |
| 5816 | { |
| 5817 | hda_nid_t nid; |
| 5818 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5819 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5820 | |
| 5821 | spec->multiout.num_dacs = 1; |
| 5822 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5823 | spec->multiout.dac_nids[0] = 0x02; |
| 5824 | |
| 5825 | nid = cfg->line_out_pins[0]; |
| 5826 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5827 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5828 | if (err < 0) |
| 5829 | return err; |
| 5830 | } |
| 5831 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5832 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5833 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5834 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5835 | if (err < 0) |
| 5836 | return err; |
| 5837 | } |
| 5838 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5839 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5840 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5841 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5842 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5843 | if (err < 0) |
| 5844 | return err; |
| 5845 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5846 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5847 | } |
| 5848 | |
| 5849 | /* create playback/capture controls for input pins */ |
| 5850 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5851 | const struct auto_pin_cfg *cfg) |
| 5852 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5853 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5854 | int i, err, idx; |
| 5855 | |
| 5856 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5857 | if (cfg->input_pins[i] >= 0x12) { |
| 5858 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5859 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5860 | auto_pin_cfg_labels[i], idx, |
| 5861 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5862 | if (err < 0) |
| 5863 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5864 | imux->items[imux->num_items].label = |
| 5865 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5866 | imux->items[imux->num_items].index = idx; |
| 5867 | imux->num_items++; |
| 5868 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5869 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5870 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5871 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5872 | auto_pin_cfg_labels[i], idx, |
| 5873 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5874 | if (err < 0) |
| 5875 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5876 | imux->items[imux->num_items].label = |
| 5877 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5878 | imux->items[imux->num_items].index = idx; |
| 5879 | imux->num_items++; |
| 5880 | } |
| 5881 | } |
| 5882 | return 0; |
| 5883 | } |
| 5884 | |
| 5885 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5886 | hda_nid_t nid, int pin_type, |
| 5887 | int sel_idx) |
| 5888 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5889 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5890 | /* need the manual connection? */ |
| 5891 | if (nid >= 0x12) { |
| 5892 | int idx = nid - 0x12; |
| 5893 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5894 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5895 | } |
| 5896 | } |
| 5897 | |
| 5898 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5899 | { |
| 5900 | struct alc_spec *spec = codec->spec; |
| 5901 | hda_nid_t nid; |
| 5902 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5903 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5904 | if (nid) { |
| 5905 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5906 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5907 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5908 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5909 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5910 | if (nid) |
| 5911 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5912 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5913 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5914 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5915 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5916 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5917 | |
| 5918 | #define ALC260_PIN_CD_NID 0x16 |
| 5919 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5920 | { |
| 5921 | struct alc_spec *spec = codec->spec; |
| 5922 | int i; |
| 5923 | |
| 5924 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5925 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5926 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5927 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5928 | if (nid != ALC260_PIN_CD_NID && |
| 5929 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5930 | snd_hda_codec_write(codec, nid, 0, |
| 5931 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5932 | AMP_OUT_MUTE); |
| 5933 | } |
| 5934 | } |
| 5935 | } |
| 5936 | |
| 5937 | /* |
| 5938 | * generic initialization of ADC, input mixers and output mixers |
| 5939 | */ |
| 5940 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5941 | /* |
| 5942 | * Unmute ADC0-1 and set the default input to mic-in |
| 5943 | */ |
| 5944 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5945 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5946 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5947 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5948 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5949 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5950 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5951 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5952 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5953 | */ |
| 5954 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5955 | /* mute analog inputs */ |
| 5956 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5957 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5958 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5959 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5960 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5961 | |
| 5962 | /* |
| 5963 | * Set up output mixers (0x08 - 0x0a) |
| 5964 | */ |
| 5965 | /* set vol=0 to output mixers */ |
| 5966 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5967 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5968 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5969 | /* set up input amps for analog loopback */ |
| 5970 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5971 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5972 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5973 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5974 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5975 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5976 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5977 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5978 | { } |
| 5979 | }; |
| 5980 | |
| 5981 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5982 | { |
| 5983 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5984 | int err; |
| 5985 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5986 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5987 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5988 | alc260_ignore); |
| 5989 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5990 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5991 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5992 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5993 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5994 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5995 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5996 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5997 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5998 | return err; |
| 5999 | |
| 6000 | spec->multiout.max_channels = 2; |
| 6001 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6002 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6003 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6004 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6005 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6006 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6007 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6008 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6009 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6010 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6011 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6012 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6013 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6014 | return 1; |
| 6015 | } |
| 6016 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6017 | /* additional initialization for auto-configuration model */ |
| 6018 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6019 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6020 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6021 | alc260_auto_init_multi_out(codec); |
| 6022 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6023 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6024 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6025 | } |
| 6026 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6027 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6028 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6029 | { 0x07, HDA_INPUT, 0 }, |
| 6030 | { 0x07, HDA_INPUT, 1 }, |
| 6031 | { 0x07, HDA_INPUT, 2 }, |
| 6032 | { 0x07, HDA_INPUT, 3 }, |
| 6033 | { 0x07, HDA_INPUT, 4 }, |
| 6034 | { } /* end */ |
| 6035 | }; |
| 6036 | #endif |
| 6037 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6038 | /* |
| 6039 | * ALC260 configurations |
| 6040 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6041 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6042 | [ALC260_BASIC] = "basic", |
| 6043 | [ALC260_HP] = "hp", |
| 6044 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6045 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6046 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6047 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6048 | [ALC260_WILL] = "will", |
| 6049 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6050 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6051 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6052 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6053 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6054 | [ALC260_AUTO] = "auto", |
| 6055 | }; |
| 6056 | |
| 6057 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6058 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6059 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6060 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6061 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 6062 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6063 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6064 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6065 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6066 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6067 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6068 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6069 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6070 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6071 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6072 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6073 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6074 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6075 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6076 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6077 | {} |
| 6078 | }; |
| 6079 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6080 | static struct alc_config_preset alc260_presets[] = { |
| 6081 | [ALC260_BASIC] = { |
| 6082 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6083 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6084 | .init_verbs = { alc260_init_verbs }, |
| 6085 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6086 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6087 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6088 | .adc_nids = alc260_adc_nids, |
| 6089 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6090 | .channel_mode = alc260_modes, |
| 6091 | .input_mux = &alc260_capture_source, |
| 6092 | }, |
| 6093 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6094 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6095 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6096 | .init_verbs = { alc260_init_verbs, |
| 6097 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6098 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6099 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6100 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6101 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6102 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6103 | .channel_mode = alc260_modes, |
| 6104 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6105 | .unsol_event = alc260_hp_unsol_event, |
| 6106 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6107 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6108 | [ALC260_HP_DC7600] = { |
| 6109 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6110 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6111 | .init_verbs = { alc260_init_verbs, |
| 6112 | alc260_hp_dc7600_verbs }, |
| 6113 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6114 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6115 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6116 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6117 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6118 | .channel_mode = alc260_modes, |
| 6119 | .input_mux = &alc260_capture_source, |
| 6120 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6121 | .init_hook = alc260_hp_3012_automute, |
| 6122 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6123 | [ALC260_HP_3013] = { |
| 6124 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6125 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6126 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6127 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6128 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6129 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6130 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6131 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6132 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6133 | .channel_mode = alc260_modes, |
| 6134 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6135 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6136 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6137 | }, |
| 6138 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6139 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6140 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6141 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6142 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6143 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6144 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6145 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6146 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6147 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6148 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6149 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6150 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6151 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6152 | .init_verbs = { alc260_acer_init_verbs }, |
| 6153 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6154 | .dac_nids = alc260_dac_nids, |
| 6155 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6156 | .adc_nids = alc260_dual_adc_nids, |
| 6157 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6158 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6159 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6160 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6161 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6162 | [ALC260_FAVORIT100] = { |
| 6163 | .mixers = { alc260_favorit100_mixer }, |
| 6164 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6165 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6166 | .dac_nids = alc260_dac_nids, |
| 6167 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6168 | .adc_nids = alc260_dual_adc_nids, |
| 6169 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6170 | .channel_mode = alc260_modes, |
| 6171 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6172 | .input_mux = alc260_favorit100_capture_sources, |
| 6173 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6174 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6175 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6176 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6177 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6178 | .dac_nids = alc260_dac_nids, |
| 6179 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6180 | .adc_nids = alc260_adc_nids, |
| 6181 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6182 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6183 | .channel_mode = alc260_modes, |
| 6184 | .input_mux = &alc260_capture_source, |
| 6185 | }, |
| 6186 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6187 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6188 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6189 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6190 | .dac_nids = alc260_dac_nids, |
| 6191 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6192 | .adc_nids = alc260_adc_nids, |
| 6193 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6194 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6195 | .channel_mode = alc260_modes, |
| 6196 | .input_mux = &alc260_capture_source, |
| 6197 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6198 | .init_hook = alc260_replacer_672v_automute, |
| 6199 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6200 | #ifdef CONFIG_SND_DEBUG |
| 6201 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6202 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6203 | .init_verbs = { alc260_test_init_verbs }, |
| 6204 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6205 | .dac_nids = alc260_test_dac_nids, |
| 6206 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6207 | .adc_nids = alc260_test_adc_nids, |
| 6208 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6209 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6210 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6211 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6212 | }, |
| 6213 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6214 | }; |
| 6215 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6216 | static int patch_alc260(struct hda_codec *codec) |
| 6217 | { |
| 6218 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6219 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6220 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6221 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6222 | if (spec == NULL) |
| 6223 | return -ENOMEM; |
| 6224 | |
| 6225 | codec->spec = spec; |
| 6226 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6227 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6228 | alc260_models, |
| 6229 | alc260_cfg_tbl); |
| 6230 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6231 | snd_printd(KERN_INFO "hda_codec: Unknown model for %s, " |
| 6232 | "trying auto-probe from BIOS...\n", |
| 6233 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6234 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6235 | } |
| 6236 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6237 | if (board_config == ALC260_AUTO) { |
| 6238 | /* automatic parse from the BIOS config */ |
| 6239 | err = alc260_parse_auto_config(codec); |
| 6240 | if (err < 0) { |
| 6241 | alc_free(codec); |
| 6242 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6243 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6244 | printk(KERN_INFO |
| 6245 | "hda_codec: Cannot set up configuration " |
| 6246 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6247 | board_config = ALC260_BASIC; |
| 6248 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6249 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6250 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6251 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6252 | if (err < 0) { |
| 6253 | alc_free(codec); |
| 6254 | return err; |
| 6255 | } |
| 6256 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6257 | if (board_config != ALC260_AUTO) |
| 6258 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6259 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6260 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6261 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6262 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6263 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6264 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6265 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6266 | if (!spec->adc_nids && spec->input_mux) { |
| 6267 | /* check whether NID 0x04 is valid */ |
| 6268 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 6269 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 6270 | /* get type */ |
| 6271 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6272 | spec->adc_nids = alc260_adc_nids_alt; |
| 6273 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6274 | } else { |
| 6275 | spec->adc_nids = alc260_adc_nids; |
| 6276 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6277 | } |
| 6278 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6279 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6280 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6281 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6282 | spec->vmaster_nid = 0x08; |
| 6283 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6284 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6285 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6286 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6287 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6288 | if (!spec->loopback.amplist) |
| 6289 | spec->loopback.amplist = alc260_loopbacks; |
| 6290 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6291 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6292 | |
| 6293 | return 0; |
| 6294 | } |
| 6295 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6296 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6297 | /* |
| 6298 | * ALC882 support |
| 6299 | * |
| 6300 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6301 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6302 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6303 | * 6-channel independent captures. |
| 6304 | * |
| 6305 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6306 | * driver yet). |
| 6307 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6308 | #define ALC882_DIGOUT_NID 0x06 |
| 6309 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6310 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6311 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6312 | { 8, NULL } |
| 6313 | }; |
| 6314 | |
| 6315 | static hda_nid_t alc882_dac_nids[4] = { |
| 6316 | /* front, rear, clfe, rear_surr */ |
| 6317 | 0x02, 0x03, 0x04, 0x05 |
| 6318 | }; |
| 6319 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6320 | /* identical with ALC880 */ |
| 6321 | #define alc882_adc_nids alc880_adc_nids |
| 6322 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6323 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6324 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6325 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 6326 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6327 | /* input MUX */ |
| 6328 | /* FIXME: should be a matrix-type input source selection */ |
| 6329 | |
| 6330 | static struct hda_input_mux alc882_capture_source = { |
| 6331 | .num_items = 4, |
| 6332 | .items = { |
| 6333 | { "Mic", 0x0 }, |
| 6334 | { "Front Mic", 0x1 }, |
| 6335 | { "Line", 0x2 }, |
| 6336 | { "CD", 0x4 }, |
| 6337 | }, |
| 6338 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6339 | |
| 6340 | static struct hda_input_mux mb5_capture_source = { |
| 6341 | .num_items = 3, |
| 6342 | .items = { |
| 6343 | { "Mic", 0x1 }, |
| 6344 | { "Line", 0x2 }, |
| 6345 | { "CD", 0x4 }, |
| 6346 | }, |
| 6347 | }; |
| 6348 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6349 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6350 | * 2ch mode |
| 6351 | */ |
| 6352 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6353 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6354 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6355 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6356 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6357 | { } /* end */ |
| 6358 | }; |
| 6359 | |
| 6360 | /* |
| 6361 | * 6ch mode |
| 6362 | */ |
| 6363 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6364 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6365 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6366 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6367 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6368 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6369 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6370 | { } /* end */ |
| 6371 | }; |
| 6372 | |
| 6373 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 6374 | { 2, alc882_3ST_ch2_init }, |
| 6375 | { 6, alc882_3ST_ch6_init }, |
| 6376 | }; |
| 6377 | |
| 6378 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6379 | * 6ch mode |
| 6380 | */ |
| 6381 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6382 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6383 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6384 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6385 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6386 | { } /* end */ |
| 6387 | }; |
| 6388 | |
| 6389 | /* |
| 6390 | * 8ch mode |
| 6391 | */ |
| 6392 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6393 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6394 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6395 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6396 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6397 | { } /* end */ |
| 6398 | }; |
| 6399 | |
| 6400 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6401 | { 6, alc882_sixstack_ch6_init }, |
| 6402 | { 8, alc882_sixstack_ch8_init }, |
| 6403 | }; |
| 6404 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6405 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6406 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6407 | */ |
| 6408 | |
| 6409 | /* |
| 6410 | * 2ch mode |
| 6411 | */ |
| 6412 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6413 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6414 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6415 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6416 | { } /* end */ |
| 6417 | }; |
| 6418 | |
| 6419 | /* |
| 6420 | * 6ch mode |
| 6421 | */ |
| 6422 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6423 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6424 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6425 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6426 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6427 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6428 | { } /* end */ |
| 6429 | }; |
| 6430 | |
| 6431 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6432 | { 2, alc885_mbp_ch2_init }, |
| 6433 | { 6, alc885_mbp_ch6_init }, |
| 6434 | }; |
| 6435 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6436 | /* |
| 6437 | * 2ch |
| 6438 | * Speakers/Woofer/HP = Front |
| 6439 | * LineIn = Input |
| 6440 | */ |
| 6441 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6442 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6443 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6444 | { } /* end */ |
| 6445 | }; |
| 6446 | |
| 6447 | /* |
| 6448 | * 6ch mode |
| 6449 | * Speakers/HP = Front |
| 6450 | * Woofer = LFE |
| 6451 | * LineIn = Surround |
| 6452 | */ |
| 6453 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6454 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6455 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6456 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6457 | { } /* end */ |
| 6458 | }; |
| 6459 | |
| 6460 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6461 | { 2, alc885_mb5_ch2_init }, |
| 6462 | { 6, alc885_mb5_ch6_init }, |
| 6463 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6464 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6465 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6466 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6467 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6468 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6469 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6470 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6471 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6472 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6473 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6474 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6475 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6476 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6477 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6478 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6479 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6480 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6481 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6482 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6483 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6484 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6485 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6486 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6487 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6488 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6489 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6490 | { } /* end */ |
| 6491 | }; |
| 6492 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6493 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6494 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6495 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6496 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6497 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6498 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6499 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6500 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6501 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6502 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6503 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6504 | { } /* end */ |
| 6505 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6506 | |
| 6507 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6508 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6509 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6510 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6511 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 6512 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 6513 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 6514 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 6515 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6516 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6517 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6518 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6519 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6520 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 6521 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 6522 | { } /* end */ |
| 6523 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6524 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6525 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6526 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6527 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6528 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6529 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6530 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6531 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6532 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6533 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6534 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6535 | { } /* end */ |
| 6536 | }; |
| 6537 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6538 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6539 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6540 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6541 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6542 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6543 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6544 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6545 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6546 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6547 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6548 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6549 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6550 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6551 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6552 | { } /* end */ |
| 6553 | }; |
| 6554 | |
| 6555 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6556 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6557 | */ |
| 6558 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6559 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6560 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6561 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6562 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6563 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6564 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6565 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6566 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6567 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6568 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6569 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6570 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6571 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6572 | { } /* end */ |
| 6573 | }; |
| 6574 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6575 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6576 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6577 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6578 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6579 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6580 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6581 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6582 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6583 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6584 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6585 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6586 | { } /* end */ |
| 6587 | }; |
| 6588 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6589 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6590 | { |
| 6591 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6592 | .name = "Channel Mode", |
| 6593 | .info = alc_ch_mode_info, |
| 6594 | .get = alc_ch_mode_get, |
| 6595 | .put = alc_ch_mode_put, |
| 6596 | }, |
| 6597 | { } /* end */ |
| 6598 | }; |
| 6599 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6600 | static struct hda_verb alc882_init_verbs[] = { |
| 6601 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6602 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6603 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6604 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6605 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6606 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6607 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6608 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6609 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6610 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6611 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6612 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6613 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6614 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6615 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6616 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6617 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6618 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6619 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6620 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6621 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6622 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6623 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6624 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6625 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6626 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6627 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6628 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6629 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6630 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6631 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6632 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6633 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6634 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6635 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6636 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6637 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6638 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6639 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6640 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6641 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6642 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6643 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6644 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6645 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6646 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6647 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6648 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6649 | |
| 6650 | /* FIXME: use matrix-type input source selection */ |
| 6651 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6652 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6653 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6654 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6655 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6656 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6657 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6658 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6659 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6660 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6661 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6662 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6663 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6664 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6665 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6666 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6667 | /* ADC1: mute amp left and right */ |
| 6668 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6669 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6670 | /* ADC2: mute amp left and right */ |
| 6671 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6672 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6673 | /* ADC3: mute amp left and right */ |
| 6674 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6675 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6676 | |
| 6677 | { } |
| 6678 | }; |
| 6679 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6680 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6681 | /* change to EAPD mode */ |
| 6682 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6683 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6684 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6685 | }; |
| 6686 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6687 | /* Mac Pro test */ |
| 6688 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6689 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6690 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6691 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6692 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6693 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6694 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6695 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6696 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6697 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6698 | { } /* end */ |
| 6699 | }; |
| 6700 | |
| 6701 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6702 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6703 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6704 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6705 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6706 | /* Front Pin: output 0 (0x0c) */ |
| 6707 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6708 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6709 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6710 | /* Front Mic pin: input vref at 80% */ |
| 6711 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6712 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6713 | /* Speaker: output */ |
| 6714 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6715 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6716 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6717 | /* Headphone output (output 0 - 0x0c) */ |
| 6718 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6719 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6720 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6721 | |
| 6722 | /* FIXME: use matrix-type input source selection */ |
| 6723 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6724 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6725 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6726 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6727 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6728 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6729 | /* Input mixer2 */ |
| 6730 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6731 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6732 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6733 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6734 | /* Input mixer3 */ |
| 6735 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6736 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6737 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6738 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6739 | /* ADC1: mute amp left and right */ |
| 6740 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6741 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6742 | /* ADC2: mute amp left and right */ |
| 6743 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6744 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6745 | /* ADC3: mute amp left and right */ |
| 6746 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6747 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6748 | |
| 6749 | { } |
| 6750 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6751 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6752 | /* Macbook 5,1 */ |
| 6753 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6754 | /* DACs */ |
| 6755 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6756 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6757 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6758 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6759 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6760 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6761 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6762 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6763 | /* Surround mixer */ |
| 6764 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6765 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6766 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6767 | /* LFE mixer */ |
| 6768 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6769 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6770 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6771 | /* HP mixer */ |
| 6772 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6773 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6774 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6775 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6776 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 6777 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6778 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6779 | /* LFE Pin (0x0e) */ |
| 6780 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 6781 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6782 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6783 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6784 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6785 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6786 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6787 | /* Front Mic pin: input vref at 80% */ |
| 6788 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6789 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6790 | /* Line In pin */ |
| 6791 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6792 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6793 | |
| 6794 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6795 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6796 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6797 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6798 | { } |
| 6799 | }; |
| 6800 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6801 | /* Macbook Pro rev3 */ |
| 6802 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6803 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6804 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6805 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6806 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6807 | /* Rear mixer */ |
| 6808 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6809 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6810 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6811 | /* Front Pin: output 0 (0x0c) */ |
| 6812 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6813 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6814 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6815 | /* HP Pin: output 0 (0x0d) */ |
| 6816 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6817 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6818 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6819 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6820 | /* Mic (rear) pin: input vref at 80% */ |
| 6821 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6822 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6823 | /* Front Mic pin: input vref at 80% */ |
| 6824 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6825 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6826 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6827 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6828 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6829 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6830 | |
| 6831 | /* FIXME: use matrix-type input source selection */ |
| 6832 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6833 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6834 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6835 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6836 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6837 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6838 | /* Input mixer2 */ |
| 6839 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6840 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6841 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6842 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6843 | /* Input mixer3 */ |
| 6844 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6845 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6846 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6847 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6848 | /* ADC1: mute amp left and right */ |
| 6849 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6850 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6851 | /* ADC2: mute amp left and right */ |
| 6852 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6853 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6854 | /* ADC3: mute amp left and right */ |
| 6855 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6856 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6857 | |
| 6858 | { } |
| 6859 | }; |
| 6860 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6861 | /* iMac 24 mixer. */ |
| 6862 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6863 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6864 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6865 | { } /* end */ |
| 6866 | }; |
| 6867 | |
| 6868 | /* iMac 24 init verbs. */ |
| 6869 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6870 | /* Internal speakers: output 0 (0x0c) */ |
| 6871 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6872 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6873 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6874 | /* Internal speakers: output 0 (0x0c) */ |
| 6875 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6876 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6877 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6878 | /* Headphone: output 0 (0x0c) */ |
| 6879 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6880 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6881 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6882 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6883 | /* Front Mic: input vref at 80% */ |
| 6884 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6885 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6886 | { } |
| 6887 | }; |
| 6888 | |
| 6889 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6890 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6891 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6892 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6893 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6894 | spec->autocfg.hp_pins[0] = 0x14; |
| 6895 | spec->autocfg.speaker_pins[0] = 0x18; |
| 6896 | spec->autocfg.speaker_pins[1] = 0x1a; |
| 6897 | alc_automute_amp(codec); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6898 | } |
| 6899 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6900 | static void alc885_mbp3_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6901 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6902 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6903 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6904 | spec->autocfg.hp_pins[0] = 0x15; |
| 6905 | spec->autocfg.speaker_pins[0] = 0x14; |
| 6906 | alc_automute_amp(codec); |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6907 | } |
| 6908 | |
| 6909 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6910 | static struct hda_verb alc882_targa_verbs[] = { |
| 6911 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6912 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6913 | |
| 6914 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6915 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6916 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6917 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6918 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6919 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6920 | |
| 6921 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6922 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6923 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6924 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6925 | { } /* end */ |
| 6926 | }; |
| 6927 | |
| 6928 | /* toggle speaker-output according to the hp-jack state */ |
| 6929 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6930 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6931 | struct alc_spec *spec = codec->spec; |
| 6932 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6933 | 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] | 6934 | spec->jack_present ? 1 : 3); |
| 6935 | } |
| 6936 | |
| 6937 | static void alc882_targa_init_hook(struct hda_codec *codec) |
| 6938 | { |
| 6939 | struct alc_spec *spec = codec->spec; |
| 6940 | |
| 6941 | spec->autocfg.hp_pins[0] = 0x14; |
| 6942 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 6943 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6944 | } |
| 6945 | |
| 6946 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6947 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6948 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6949 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6950 | } |
| 6951 | |
| 6952 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6953 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6954 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6955 | |
| 6956 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6957 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6958 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6959 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6960 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6961 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6962 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6963 | |
| 6964 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6965 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6966 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6967 | { } /* end */ |
| 6968 | }; |
| 6969 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6970 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6971 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6972 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6973 | |
| 6974 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6975 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6976 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6977 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6978 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6979 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6980 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6981 | |
| 6982 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6983 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6984 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6985 | { } /* end */ |
| 6986 | }; |
| 6987 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6988 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6989 | { |
| 6990 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6991 | |
| 6992 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6993 | AC_VERB_GET_GPIO_DATA, 0); |
| 6994 | |
| 6995 | if (!muted) |
| 6996 | gpiostate |= (1 << pin); |
| 6997 | else |
| 6998 | gpiostate &= ~(1 << pin); |
| 6999 | |
| 7000 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7001 | AC_VERB_GET_GPIO_MASK, 0); |
| 7002 | gpiomask |= (1 << pin); |
| 7003 | |
| 7004 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7005 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7006 | gpiodir |= (1 << pin); |
| 7007 | |
| 7008 | |
| 7009 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7010 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7011 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7012 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7013 | |
| 7014 | msleep(1); |
| 7015 | |
| 7016 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7017 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7018 | } |
| 7019 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7020 | /* set up GPIO at initialization */ |
| 7021 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7022 | { |
| 7023 | alc882_gpio_mute(codec, 0, 0); |
| 7024 | alc882_gpio_mute(codec, 1, 0); |
| 7025 | } |
| 7026 | |
| 7027 | /* set up GPIO and update auto-muting at initialization */ |
| 7028 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7029 | { |
| 7030 | alc885_macpro_init_hook(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7031 | alc885_imac24_automute_init_hook(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7032 | } |
| 7033 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7034 | /* |
| 7035 | * generic initialization of ADC, input mixers and output mixers |
| 7036 | */ |
| 7037 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 7038 | /* |
| 7039 | * Unmute ADC0-2 and set the default input to mic-in |
| 7040 | */ |
| 7041 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7042 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7043 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7044 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7045 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7046 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7047 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7048 | /* 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] | 7049 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7050 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7051 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7052 | */ |
| 7053 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7054 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7055 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7056 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7057 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7058 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7059 | |
| 7060 | /* |
| 7061 | * Set up output mixers (0x0c - 0x0f) |
| 7062 | */ |
| 7063 | /* set vol=0 to output mixers */ |
| 7064 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7065 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7066 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7067 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7068 | /* set up input amps for analog loopback */ |
| 7069 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7070 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7071 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7072 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7073 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7074 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7075 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7076 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7077 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7078 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7079 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7080 | |
| 7081 | /* FIXME: use matrix-type input source selection */ |
| 7082 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7083 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7084 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7085 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7086 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7087 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7088 | /* Input mixer2 */ |
| 7089 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7090 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7091 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7092 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7093 | /* Input mixer3 */ |
| 7094 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7095 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7096 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7097 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7098 | |
| 7099 | { } |
| 7100 | }; |
| 7101 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7102 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7103 | #define alc882_loopbacks alc880_loopbacks |
| 7104 | #endif |
| 7105 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7106 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7107 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 7108 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 7109 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 7110 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 7111 | |
| 7112 | /* |
| 7113 | * configuration and preset |
| 7114 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7115 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 7116 | [ALC882_3ST_DIG] = "3stack-dig", |
| 7117 | [ALC882_6ST_DIG] = "6stack-dig", |
| 7118 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7119 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 7120 | [ALC882_TARGA] = "targa", |
| 7121 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 7122 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7123 | [ALC885_MACPRO] = "macpro", |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7124 | [ALC885_MB5] = "mb5", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7125 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7126 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7127 | [ALC882_AUTO] = "auto", |
| 7128 | }; |
| 7129 | |
| 7130 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 7131 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7132 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 7133 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7134 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7135 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 7136 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 7137 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7138 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 7139 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7140 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 7141 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 7142 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7143 | {} |
| 7144 | }; |
| 7145 | |
| 7146 | static struct alc_config_preset alc882_presets[] = { |
| 7147 | [ALC882_3ST_DIG] = { |
| 7148 | .mixers = { alc882_base_mixer }, |
| 7149 | .init_verbs = { alc882_init_verbs }, |
| 7150 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7151 | .dac_nids = alc882_dac_nids, |
| 7152 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7153 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7154 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 7155 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7156 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7157 | .input_mux = &alc882_capture_source, |
| 7158 | }, |
| 7159 | [ALC882_6ST_DIG] = { |
| 7160 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 7161 | .init_verbs = { alc882_init_verbs }, |
| 7162 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7163 | .dac_nids = alc882_dac_nids, |
| 7164 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7165 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7166 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 7167 | .channel_mode = alc882_sixstack_modes, |
| 7168 | .input_mux = &alc882_capture_source, |
| 7169 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7170 | [ALC882_ARIMA] = { |
| 7171 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 7172 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 7173 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7174 | .dac_nids = alc882_dac_nids, |
| 7175 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 7176 | .channel_mode = alc882_sixstack_modes, |
| 7177 | .input_mux = &alc882_capture_source, |
| 7178 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7179 | [ALC882_W2JC] = { |
| 7180 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 7181 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 7182 | alc880_gpio1_init_verbs }, |
| 7183 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7184 | .dac_nids = alc882_dac_nids, |
| 7185 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 7186 | .channel_mode = alc880_threestack_modes, |
| 7187 | .need_dac_fix = 1, |
| 7188 | .input_mux = &alc882_capture_source, |
| 7189 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7190 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7191 | [ALC885_MBP3] = { |
| 7192 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 7193 | .init_verbs = { alc885_mbp3_init_verbs, |
| 7194 | alc880_gpio1_init_verbs }, |
| 7195 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7196 | .dac_nids = alc882_dac_nids, |
| 7197 | .channel_mode = alc885_mbp_6ch_modes, |
| 7198 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 7199 | .input_mux = &alc882_capture_source, |
| 7200 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7201 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7202 | .unsol_event = alc_automute_amp_unsol_event, |
| 7203 | .init_hook = alc885_mbp3_init_hook, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7204 | }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7205 | [ALC885_MB5] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7206 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7207 | .init_verbs = { alc885_mb5_init_verbs, |
| 7208 | alc880_gpio1_init_verbs }, |
| 7209 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7210 | .dac_nids = alc882_dac_nids, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7211 | .channel_mode = alc885_mb5_6ch_modes, |
| 7212 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7213 | .input_mux = &mb5_capture_source, |
| 7214 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7215 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7216 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7217 | [ALC885_MACPRO] = { |
| 7218 | .mixers = { alc882_macpro_mixer }, |
| 7219 | .init_verbs = { alc882_macpro_init_verbs }, |
| 7220 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7221 | .dac_nids = alc882_dac_nids, |
| 7222 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7223 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7224 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 7225 | .channel_mode = alc882_ch_modes, |
| 7226 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7227 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7228 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7229 | [ALC885_IMAC24] = { |
| 7230 | .mixers = { alc885_imac24_mixer }, |
| 7231 | .init_verbs = { alc885_imac24_init_verbs }, |
| 7232 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7233 | .dac_nids = alc882_dac_nids, |
| 7234 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7235 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7236 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 7237 | .channel_mode = alc882_ch_modes, |
| 7238 | .input_mux = &alc882_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7239 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7240 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7241 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7242 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7243 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7244 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 7245 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7246 | .dac_nids = alc882_dac_nids, |
| 7247 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7248 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 7249 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7250 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7251 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 7252 | .channel_mode = alc882_3ST_6ch_modes, |
| 7253 | .need_dac_fix = 1, |
| 7254 | .input_mux = &alc882_capture_source, |
| 7255 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7256 | .init_hook = alc882_targa_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7257 | }, |
| 7258 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7259 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7260 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 7261 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7262 | .dac_nids = alc882_dac_nids, |
| 7263 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7264 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 7265 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7266 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7267 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 7268 | .channel_mode = alc882_3ST_6ch_modes, |
| 7269 | .need_dac_fix = 1, |
| 7270 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7271 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7272 | [ALC882_ASUS_A7M] = { |
| 7273 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 7274 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 7275 | alc880_gpio1_init_verbs, |
| 7276 | alc882_asus_a7m_verbs }, |
| 7277 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7278 | .dac_nids = alc882_dac_nids, |
| 7279 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7280 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 7281 | .channel_mode = alc880_threestack_modes, |
| 7282 | .need_dac_fix = 1, |
| 7283 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7284 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7285 | }; |
| 7286 | |
| 7287 | |
| 7288 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7289 | * Pin config fixes |
| 7290 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7291 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7292 | PINFIX_ABIT_AW9D_MAX |
| 7293 | }; |
| 7294 | |
| 7295 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 7296 | { 0x15, 0x01080104 }, /* side */ |
| 7297 | { 0x16, 0x01011012 }, /* rear */ |
| 7298 | { 0x17, 0x01016011 }, /* clfe */ |
| 7299 | { } |
| 7300 | }; |
| 7301 | |
| 7302 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 7303 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 7304 | }; |
| 7305 | |
| 7306 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 7307 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 7308 | {} |
| 7309 | }; |
| 7310 | |
| 7311 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7312 | * BIOS auto configuration |
| 7313 | */ |
| 7314 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7315 | hda_nid_t nid, int pin_type, |
| 7316 | int dac_idx) |
| 7317 | { |
| 7318 | /* set as output */ |
| 7319 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7320 | int idx; |
| 7321 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7322 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7323 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7324 | idx = 4; |
| 7325 | else |
| 7326 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7327 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7328 | |
| 7329 | } |
| 7330 | |
| 7331 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 7332 | { |
| 7333 | struct alc_spec *spec = codec->spec; |
| 7334 | int i; |
| 7335 | |
| 7336 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7337 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7338 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7339 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7340 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7341 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7342 | } |
| 7343 | } |
| 7344 | |
| 7345 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 7346 | { |
| 7347 | struct alc_spec *spec = codec->spec; |
| 7348 | hda_nid_t pin; |
| 7349 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7350 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7351 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7352 | /* use dac 0 */ |
| 7353 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7354 | pin = spec->autocfg.speaker_pins[0]; |
| 7355 | if (pin) |
| 7356 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7357 | } |
| 7358 | |
| 7359 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7360 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 7361 | |
| 7362 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 7363 | { |
| 7364 | struct alc_spec *spec = codec->spec; |
| 7365 | int i; |
| 7366 | |
| 7367 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7368 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7369 | if (!nid) |
| 7370 | continue; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 7371 | alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7372 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 7373 | snd_hda_codec_write(codec, nid, 0, |
| 7374 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7375 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7376 | } |
| 7377 | } |
| 7378 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7379 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 7380 | { |
| 7381 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7382 | int c; |
| 7383 | |
| 7384 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 7385 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 7386 | hda_nid_t nid = spec->capsrc_nids[c]; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7387 | unsigned int mux_idx; |
| 7388 | const struct hda_input_mux *imux; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7389 | int conns, mute, idx, item; |
| 7390 | |
| 7391 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 7392 | ARRAY_SIZE(conn_list)); |
| 7393 | if (conns < 0) |
| 7394 | continue; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7395 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 7396 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7397 | for (idx = 0; idx < conns; idx++) { |
| 7398 | /* if the current connection is the selected one, |
| 7399 | * unmute it as default - otherwise mute it |
| 7400 | */ |
| 7401 | mute = AMP_IN_MUTE(idx); |
| 7402 | for (item = 0; item < imux->num_items; item++) { |
| 7403 | if (imux->items[item].index == idx) { |
| 7404 | if (spec->cur_mux[c] == item) |
| 7405 | mute = AMP_IN_UNMUTE(idx); |
| 7406 | break; |
| 7407 | } |
| 7408 | } |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7409 | /* check if we have a selector or mixer |
| 7410 | * we could check for the widget type instead, but |
| 7411 | * just check for Amp-In presence (in case of mixer |
| 7412 | * without amp-in there is something wrong, this |
| 7413 | * function shouldn't be used or capsrc nid is wrong) |
| 7414 | */ |
| 7415 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
| 7416 | snd_hda_codec_write(codec, nid, 0, |
| 7417 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7418 | mute); |
| 7419 | else if (mute != AMP_IN_MUTE(idx)) |
| 7420 | snd_hda_codec_write(codec, nid, 0, |
| 7421 | AC_VERB_SET_CONNECT_SEL, |
| 7422 | idx); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7423 | } |
| 7424 | } |
| 7425 | } |
| 7426 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7427 | /* add mic boosts if needed */ |
| 7428 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 7429 | { |
| 7430 | struct alc_spec *spec = codec->spec; |
| 7431 | int err; |
| 7432 | hda_nid_t nid; |
| 7433 | |
| 7434 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7435 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7436 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7437 | "Mic Boost", |
| 7438 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7439 | if (err < 0) |
| 7440 | return err; |
| 7441 | } |
| 7442 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7443 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7444 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7445 | "Front Mic Boost", |
| 7446 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7447 | if (err < 0) |
| 7448 | return err; |
| 7449 | } |
| 7450 | return 0; |
| 7451 | } |
| 7452 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7453 | /* almost identical with ALC880 parser... */ |
| 7454 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 7455 | { |
| 7456 | struct alc_spec *spec = codec->spec; |
| 7457 | int err = alc880_parse_auto_config(codec); |
| 7458 | |
| 7459 | if (err < 0) |
| 7460 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7461 | else if (!err) |
| 7462 | return 0; /* no config found */ |
| 7463 | |
| 7464 | err = alc_auto_add_mic_boost(codec); |
| 7465 | if (err < 0) |
| 7466 | return err; |
| 7467 | |
| 7468 | /* hack - override the init verbs */ |
| 7469 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7470 | |
| 7471 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7472 | } |
| 7473 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7474 | /* additional initialization for auto-configuration model */ |
| 7475 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7476 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7477 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7478 | alc882_auto_init_multi_out(codec); |
| 7479 | alc882_auto_init_hp_out(codec); |
| 7480 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7481 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7482 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7483 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7484 | } |
| 7485 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7486 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7487 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7488 | static int patch_alc882(struct hda_codec *codec) |
| 7489 | { |
| 7490 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7491 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7492 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7493 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7494 | if (spec == NULL) |
| 7495 | return -ENOMEM; |
| 7496 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7497 | codec->spec = spec; |
| 7498 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7499 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7500 | alc882_models, |
| 7501 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7502 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7503 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7504 | /* Pick up systems that don't supply PCI SSID */ |
| 7505 | switch (codec->subsystem_id) { |
| 7506 | case 0x106b0c00: /* Mac Pro */ |
| 7507 | board_config = ALC885_MACPRO; |
| 7508 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7509 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7510 | case 0x106b2800: /* AppleTV */ |
Mark Eggleston | 3077e44 | 2009-01-31 17:57:54 +0100 | [diff] [blame] | 7511 | case 0x106b3e00: /* iMac 24 Aluminium */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7512 | board_config = ALC885_IMAC24; |
| 7513 | break; |
Luke Yelavich | 2d46638 | 2009-02-23 13:00:33 +1100 | [diff] [blame] | 7514 | case 0x106b00a0: /* MacBookPro3,1 - Another revision */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7515 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7516 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7517 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7518 | /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */ |
Luke Yelavich | 2a88464 | 2009-01-28 15:58:38 +1100 | [diff] [blame] | 7519 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7520 | board_config = ALC885_MBP3; |
| 7521 | break; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7522 | case 0x106b3f00: /* Macbook 5,1 */ |
Takashi Iwai | 7442f9d | 2009-05-14 18:20:33 +0200 | [diff] [blame] | 7523 | case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense |
| 7524 | * seems not working, so apparently |
| 7525 | * no perfect solution yet |
| 7526 | */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7527 | board_config = ALC885_MB5; |
| 7528 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7529 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7530 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7531 | if (codec->revision_id == 0x100101 || |
| 7532 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7533 | alc_free(codec); |
| 7534 | return patch_alc883(codec); |
| 7535 | } |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7536 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 7537 | "trying auto-probe from BIOS...\n", |
| 7538 | codec->chip_name); |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7539 | board_config = ALC882_AUTO; |
| 7540 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7541 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7542 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7543 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7544 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7545 | if (board_config == ALC882_AUTO) { |
| 7546 | /* automatic parse from the BIOS config */ |
| 7547 | err = alc882_parse_auto_config(codec); |
| 7548 | if (err < 0) { |
| 7549 | alc_free(codec); |
| 7550 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7551 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7552 | printk(KERN_INFO |
| 7553 | "hda_codec: Cannot set up configuration " |
| 7554 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7555 | board_config = ALC882_3ST_DIG; |
| 7556 | } |
| 7557 | } |
| 7558 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7559 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7560 | if (err < 0) { |
| 7561 | alc_free(codec); |
| 7562 | return err; |
| 7563 | } |
| 7564 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7565 | if (board_config != ALC882_AUTO) |
| 7566 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7567 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7568 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7569 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7570 | /* FIXME: setup DAC5 */ |
| 7571 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7572 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7573 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7574 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7575 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7576 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7577 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7578 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7579 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7580 | /* get type */ |
| 7581 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7582 | if (wcap != AC_WID_AUD_IN) { |
| 7583 | spec->adc_nids = alc882_adc_nids_alt; |
| 7584 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7585 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7586 | } else { |
| 7587 | spec->adc_nids = alc882_adc_nids; |
| 7588 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7589 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7590 | } |
| 7591 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7592 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7593 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7594 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7595 | spec->vmaster_nid = 0x0c; |
| 7596 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7597 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7598 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7599 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7600 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7601 | if (!spec->loopback.amplist) |
| 7602 | spec->loopback.amplist = alc882_loopbacks; |
| 7603 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7604 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7605 | |
| 7606 | return 0; |
| 7607 | } |
| 7608 | |
| 7609 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7610 | * ALC883 support |
| 7611 | * |
| 7612 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7613 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7614 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7615 | * 6-channel independent captures. |
| 7616 | * |
| 7617 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7618 | * driver yet). |
| 7619 | */ |
| 7620 | #define ALC883_DIGOUT_NID 0x06 |
| 7621 | #define ALC883_DIGIN_NID 0x0a |
| 7622 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7623 | #define ALC1200_DIGOUT_NID 0x10 |
| 7624 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7625 | static hda_nid_t alc883_dac_nids[4] = { |
| 7626 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7627 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7628 | }; |
| 7629 | |
| 7630 | static hda_nid_t alc883_adc_nids[2] = { |
| 7631 | /* ADC1-2 */ |
| 7632 | 0x08, 0x09, |
| 7633 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7634 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7635 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7636 | /* ADC1 */ |
| 7637 | 0x08, |
| 7638 | }; |
| 7639 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7640 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7641 | /* ADC2-1 */ |
| 7642 | 0x09, 0x08 |
| 7643 | }; |
| 7644 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7645 | #define alc889_adc_nids alc880_adc_nids |
| 7646 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7647 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7648 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7649 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7650 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7651 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7652 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7653 | /* input MUX */ |
| 7654 | /* FIXME: should be a matrix-type input source selection */ |
| 7655 | |
| 7656 | static struct hda_input_mux alc883_capture_source = { |
| 7657 | .num_items = 4, |
| 7658 | .items = { |
| 7659 | { "Mic", 0x0 }, |
| 7660 | { "Front Mic", 0x1 }, |
| 7661 | { "Line", 0x2 }, |
| 7662 | { "CD", 0x4 }, |
| 7663 | }, |
| 7664 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7665 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7666 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7667 | .num_items = 4, |
| 7668 | .items = { |
| 7669 | { "Mic", 0x1 }, |
| 7670 | { "Front Mic", 0x0 }, |
| 7671 | { "Line", 0x2 }, |
| 7672 | { "CD", 0x4 }, |
| 7673 | }, |
| 7674 | }; |
| 7675 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7676 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7677 | .num_items = 2, |
| 7678 | .items = { |
| 7679 | { "Mic", 0x1 }, |
| 7680 | { "Line", 0x2 }, |
| 7681 | }, |
| 7682 | }; |
| 7683 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7684 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7685 | .num_items = 4, |
| 7686 | .items = { |
| 7687 | { "Mic", 0x0 }, |
| 7688 | { "iMic", 0x1 }, |
| 7689 | { "Line", 0x2 }, |
| 7690 | { "CD", 0x4 }, |
| 7691 | }, |
| 7692 | }; |
| 7693 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7694 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7695 | .num_items = 2, |
| 7696 | .items = { |
| 7697 | { "Mic", 0x0 }, |
| 7698 | { "Int Mic", 0x1 }, |
| 7699 | }, |
| 7700 | }; |
| 7701 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7702 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7703 | .num_items = 3, |
| 7704 | .items = { |
| 7705 | { "Mic", 0x0 }, |
| 7706 | { "Front Mic", 0x1 }, |
| 7707 | { "Line", 0x4 }, |
| 7708 | }, |
| 7709 | }; |
| 7710 | |
| 7711 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7712 | .num_items = 2, |
| 7713 | .items = { |
| 7714 | { "Mic", 0x0 }, |
| 7715 | { "Line", 0x2 }, |
| 7716 | }, |
| 7717 | }; |
| 7718 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7719 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7720 | .num_items = 2, |
| 7721 | .items = { |
| 7722 | { "Mic", 0x0 }, |
| 7723 | /* Front Mic (0x01) unused */ |
| 7724 | { "Line", 0x2 }, |
| 7725 | /* Line 2 (0x03) unused */ |
| 7726 | /* CD (0x04) unsused? */ |
| 7727 | }, |
| 7728 | }; |
| 7729 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7730 | /* |
| 7731 | * 2ch mode |
| 7732 | */ |
| 7733 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7734 | { 2, NULL } |
| 7735 | }; |
| 7736 | |
| 7737 | /* |
| 7738 | * 2ch mode |
| 7739 | */ |
| 7740 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7741 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7742 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7743 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7744 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7745 | { } /* end */ |
| 7746 | }; |
| 7747 | |
| 7748 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7749 | * 4ch mode |
| 7750 | */ |
| 7751 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7752 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7753 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7754 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7755 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7756 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7757 | { } /* end */ |
| 7758 | }; |
| 7759 | |
| 7760 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7761 | * 6ch mode |
| 7762 | */ |
| 7763 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7764 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7765 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7766 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7767 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7768 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7769 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7770 | { } /* end */ |
| 7771 | }; |
| 7772 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7773 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7774 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7775 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7776 | { 6, alc883_3ST_ch6_init }, |
| 7777 | }; |
| 7778 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 7779 | |
| 7780 | /* |
| 7781 | * 2ch mode |
| 7782 | */ |
| 7783 | static struct hda_verb alc883_4ST_ch2_init[] = { |
Takashi Iwai | f03ecf5 | 2009-06-08 16:38:17 +0200 | [diff] [blame] | 7784 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 7785 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7786 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7787 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7788 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7789 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7790 | { } /* end */ |
| 7791 | }; |
| 7792 | |
| 7793 | /* |
| 7794 | * 4ch mode |
| 7795 | */ |
| 7796 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7797 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7798 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7799 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7800 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7801 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7802 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7803 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7804 | { } /* end */ |
| 7805 | }; |
| 7806 | |
| 7807 | /* |
| 7808 | * 6ch mode |
| 7809 | */ |
| 7810 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7811 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7812 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7813 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7814 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7815 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7816 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7817 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7818 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7819 | { } /* end */ |
| 7820 | }; |
| 7821 | |
| 7822 | /* |
| 7823 | * 8ch mode |
| 7824 | */ |
| 7825 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7826 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7827 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7828 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7829 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7830 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7831 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7832 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7833 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7834 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7835 | { } /* end */ |
| 7836 | }; |
| 7837 | |
| 7838 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7839 | { 2, alc883_4ST_ch2_init }, |
| 7840 | { 4, alc883_4ST_ch4_init }, |
| 7841 | { 6, alc883_4ST_ch6_init }, |
| 7842 | { 8, alc883_4ST_ch8_init }, |
| 7843 | }; |
| 7844 | |
| 7845 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7846 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7847 | * 2ch mode |
| 7848 | */ |
| 7849 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7850 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7851 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7852 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7853 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7854 | { } /* end */ |
| 7855 | }; |
| 7856 | |
| 7857 | /* |
| 7858 | * 4ch mode |
| 7859 | */ |
| 7860 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7861 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7862 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7863 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7864 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7865 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7866 | { } /* end */ |
| 7867 | }; |
| 7868 | |
| 7869 | /* |
| 7870 | * 6ch mode |
| 7871 | */ |
| 7872 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7873 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7874 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7875 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7876 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7877 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7878 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7879 | { } /* end */ |
| 7880 | }; |
| 7881 | |
| 7882 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7883 | { 2, alc883_3ST_ch2_intel_init }, |
| 7884 | { 4, alc883_3ST_ch4_intel_init }, |
| 7885 | { 6, alc883_3ST_ch6_intel_init }, |
| 7886 | }; |
| 7887 | |
| 7888 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7889 | * 6ch mode |
| 7890 | */ |
| 7891 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7892 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7893 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7894 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7895 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7896 | { } /* end */ |
| 7897 | }; |
| 7898 | |
| 7899 | /* |
| 7900 | * 8ch mode |
| 7901 | */ |
| 7902 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7903 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7904 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7905 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7906 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7907 | { } /* end */ |
| 7908 | }; |
| 7909 | |
| 7910 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7911 | { 6, alc883_sixstack_ch6_init }, |
| 7912 | { 8, alc883_sixstack_ch8_init }, |
| 7913 | }; |
| 7914 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7915 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7916 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7917 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7918 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7919 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7920 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7921 | { } /* end */ |
| 7922 | }; |
| 7923 | |
| 7924 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7925 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7926 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7927 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7928 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7929 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7930 | { } /* end */ |
| 7931 | }; |
| 7932 | |
| 7933 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7934 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7935 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7936 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7937 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7938 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7939 | { } /* end */ |
| 7940 | }; |
| 7941 | |
| 7942 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7943 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7944 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7945 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7946 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7947 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7948 | { } /* end */ |
| 7949 | }; |
| 7950 | |
| 7951 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7952 | { 2, alc889A_mb31_ch2_init }, |
| 7953 | { 4, alc889A_mb31_ch4_init }, |
| 7954 | { 5, alc889A_mb31_ch5_init }, |
| 7955 | { 6, alc889A_mb31_ch6_init }, |
| 7956 | }; |
| 7957 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7958 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7959 | /* eanable EAPD on medion laptop */ |
| 7960 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7961 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7962 | { } |
| 7963 | }; |
| 7964 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7965 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7966 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7967 | */ |
| 7968 | |
| 7969 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7970 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7971 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7972 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7973 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7974 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7975 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7976 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7977 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7978 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7979 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7980 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7981 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7982 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7983 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7984 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7985 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7986 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7987 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7988 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7989 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7990 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7991 | { } /* end */ |
| 7992 | }; |
| 7993 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7994 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7995 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7996 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7997 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7998 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7999 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8000 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8001 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8002 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8003 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8004 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8005 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8006 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8007 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8008 | { } /* end */ |
| 8009 | }; |
| 8010 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8011 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8012 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8013 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8014 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8015 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8016 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8017 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8018 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8019 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8020 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8021 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8022 | { } /* end */ |
| 8023 | }; |
| 8024 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8025 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8026 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8027 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8028 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8029 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8030 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8031 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8032 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8033 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8034 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8035 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8036 | { } /* end */ |
| 8037 | }; |
| 8038 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8039 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8040 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8041 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8042 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8043 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8044 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8045 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8046 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8047 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8048 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8049 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8050 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8051 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8052 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8053 | { } /* end */ |
| 8054 | }; |
| 8055 | |
| 8056 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8057 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8058 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8059 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8060 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8061 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8062 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8063 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8064 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8065 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8066 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8067 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8068 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8069 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8070 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8071 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8072 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8073 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8074 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8075 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8076 | { } /* end */ |
| 8077 | }; |
| 8078 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8079 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8080 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8081 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8082 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8083 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8084 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8085 | HDA_OUTPUT), |
| 8086 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8087 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8088 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8089 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8090 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8091 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8092 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8093 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8094 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8095 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8096 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8097 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8098 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8099 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8100 | { } /* end */ |
| 8101 | }; |
| 8102 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8103 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8104 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8105 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8106 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8107 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8108 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8109 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8110 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8111 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8112 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8113 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8114 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8115 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8116 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8117 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8118 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8119 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8120 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8121 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8122 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8123 | { } /* end */ |
| 8124 | }; |
| 8125 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8126 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8127 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8128 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8129 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8130 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8131 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8132 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8133 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8134 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8135 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8136 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8137 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8138 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8139 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8140 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8141 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8142 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8143 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8144 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8145 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8146 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8147 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8148 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8149 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8150 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8151 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8152 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8153 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8154 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8155 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8156 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8157 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8158 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8159 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8160 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8161 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8162 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8163 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8164 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8165 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8166 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8167 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8168 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8170 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8171 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8172 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8173 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8174 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8175 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8176 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8177 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8178 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8179 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8180 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8181 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8182 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8183 | { } /* end */ |
| 8184 | }; |
| 8185 | |
| 8186 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8187 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8188 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8189 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8190 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8191 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8192 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8194 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8195 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8196 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8197 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8198 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8199 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8200 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8201 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8202 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8203 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8204 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8205 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8206 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8207 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8208 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8209 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8210 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8211 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8212 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8213 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8214 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8215 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8216 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8217 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8218 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8219 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8220 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8221 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8223 | { } /* end */ |
| 8224 | }; |
| 8225 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8226 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8227 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8228 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8229 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8230 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8231 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8232 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8233 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8234 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8235 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8236 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8237 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8238 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8239 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8240 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8241 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8242 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8243 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8244 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8245 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8246 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8247 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8248 | { } /* end */ |
| 8249 | }; |
| 8250 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8251 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8252 | /* Output mixers */ |
| 8253 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8254 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8255 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8256 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8257 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8258 | HDA_OUTPUT), |
| 8259 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8260 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8261 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8262 | /* Output switches */ |
| 8263 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8264 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8265 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8266 | /* Boost mixers */ |
| 8267 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8268 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8269 | /* Input mixers */ |
| 8270 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8271 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8272 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8273 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8274 | { } /* end */ |
| 8275 | }; |
| 8276 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8277 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8278 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8279 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8280 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8281 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8282 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8283 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8284 | { } /* end */ |
| 8285 | }; |
| 8286 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8287 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8288 | .ops = &snd_hda_bind_vol, |
| 8289 | .values = { |
| 8290 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8291 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8292 | 0 |
| 8293 | }, |
| 8294 | }; |
| 8295 | |
| 8296 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8297 | .ops = &snd_hda_bind_sw, |
| 8298 | .values = { |
| 8299 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8300 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8301 | 0 |
| 8302 | }, |
| 8303 | }; |
| 8304 | |
| 8305 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8306 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8307 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8308 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8309 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8310 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8311 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8312 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8313 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8314 | { } /* end */ |
| 8315 | }; |
| 8316 | |
| 8317 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8318 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8319 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8320 | { |
| 8321 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8322 | /* .name = "Capture Source", */ |
| 8323 | .name = "Input Source", |
| 8324 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8325 | .info = alc_mux_enum_info, |
| 8326 | .get = alc_mux_enum_get, |
| 8327 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8328 | }, |
| 8329 | { } /* end */ |
| 8330 | }; |
| 8331 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8332 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8333 | { |
| 8334 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8335 | .name = "Channel Mode", |
| 8336 | .info = alc_ch_mode_info, |
| 8337 | .get = alc_ch_mode_get, |
| 8338 | .put = alc_ch_mode_put, |
| 8339 | }, |
| 8340 | { } /* end */ |
| 8341 | }; |
| 8342 | |
| 8343 | static struct hda_verb alc883_init_verbs[] = { |
| 8344 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8345 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8346 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8347 | /* ADC2: mute amp left and right */ |
| 8348 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8349 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8350 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8351 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8352 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8353 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8354 | /* Rear mixer */ |
| 8355 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8356 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8357 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8358 | /* CLFE mixer */ |
| 8359 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8360 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8361 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8362 | /* Side mixer */ |
| 8363 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8364 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8365 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8366 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8367 | /* mute analog input loopbacks */ |
| 8368 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8369 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8370 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8371 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8372 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8373 | |
| 8374 | /* Front Pin: output 0 (0x0c) */ |
| 8375 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8376 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8377 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8378 | /* Rear Pin: output 1 (0x0d) */ |
| 8379 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8380 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8381 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8382 | /* CLFE Pin: output 2 (0x0e) */ |
| 8383 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8384 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8385 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8386 | /* Side Pin: output 3 (0x0f) */ |
| 8387 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8388 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8389 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8390 | /* Mic (rear) pin: input vref at 80% */ |
| 8391 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8392 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8393 | /* Front Mic pin: input vref at 80% */ |
| 8394 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8395 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8396 | /* Line In pin: input */ |
| 8397 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8398 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8399 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8400 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8401 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8402 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8403 | /* CD pin widget for input */ |
| 8404 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8405 | |
| 8406 | /* FIXME: use matrix-type input source selection */ |
| 8407 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8408 | /* Input mixer2 */ |
| 8409 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8410 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8411 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8412 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8413 | /* Input mixer3 */ |
| 8414 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8415 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8416 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8417 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8418 | { } |
| 8419 | }; |
| 8420 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8421 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8422 | static void alc883_mitac_init_hook(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8423 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8424 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8425 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8426 | spec->autocfg.hp_pins[0] = 0x15; |
| 8427 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8428 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8429 | alc_automute_amp(codec); |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8430 | } |
| 8431 | |
| 8432 | /* auto-toggle front mic */ |
| 8433 | /* |
| 8434 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8435 | { |
| 8436 | unsigned int present; |
| 8437 | unsigned char bits; |
| 8438 | |
| 8439 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8440 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8441 | bits = present ? HDA_AMP_MUTE : 0; |
| 8442 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8443 | } |
| 8444 | */ |
| 8445 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8446 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8447 | /* HP */ |
| 8448 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8449 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8450 | /* Subwoofer */ |
| 8451 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8452 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8453 | |
| 8454 | /* enable unsolicited event */ |
| 8455 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8456 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8457 | |
| 8458 | { } /* end */ |
| 8459 | }; |
| 8460 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8461 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8462 | /* HP */ |
| 8463 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8464 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8465 | /* Int speaker */ |
| 8466 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8467 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8468 | |
| 8469 | /* enable unsolicited event */ |
| 8470 | {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] | 8471 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8472 | |
| 8473 | { } /* end */ |
| 8474 | }; |
| 8475 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8476 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8477 | /* HP */ |
| 8478 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8479 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8480 | /* Subwoofer */ |
| 8481 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8482 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8483 | |
| 8484 | /* enable unsolicited event */ |
| 8485 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8486 | |
| 8487 | { } /* end */ |
| 8488 | }; |
| 8489 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8490 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8491 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8492 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8493 | |
| 8494 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8495 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8496 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8497 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8498 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8499 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8500 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8501 | /* Connect Mic jack to CLFE */ |
| 8502 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8503 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8504 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8505 | /* Connect Line-in jack to Surround */ |
| 8506 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8507 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8508 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8509 | /* Connect HP out jack to Front */ |
| 8510 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8511 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8512 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8513 | |
| 8514 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8515 | |
| 8516 | { } /* end */ |
| 8517 | }; |
| 8518 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8519 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8520 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8521 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8522 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8523 | { } /* end */ |
| 8524 | }; |
| 8525 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8526 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8527 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8528 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8529 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8530 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8531 | { } /* end */ |
| 8532 | }; |
| 8533 | |
| 8534 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8535 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8536 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8537 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8538 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8539 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8540 | { } /* end */ |
| 8541 | }; |
| 8542 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8543 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8544 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8545 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8546 | |
| 8547 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8548 | |
| 8549 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8550 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8551 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8552 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8553 | { } /* end */ |
| 8554 | }; |
| 8555 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8556 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8557 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8558 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8559 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8560 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8561 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8562 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8563 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8564 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8565 | { } /* end */ |
| 8566 | }; |
| 8567 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8568 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8569 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8570 | { } |
| 8571 | }; |
| 8572 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8573 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8574 | /* HP */ |
| 8575 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8576 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8577 | |
| 8578 | /* enable unsolicited event */ |
| 8579 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8580 | |
| 8581 | { } /* end */ |
| 8582 | }; |
| 8583 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8584 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8585 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8586 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8587 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8588 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8589 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8590 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8591 | spec->autocfg.speaker_pins[2] = 0x18; |
| 8592 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8593 | } |
| 8594 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8595 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8596 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8597 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8598 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8599 | {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] | 8600 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8601 | }; |
| 8602 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8603 | /* |
| 8604 | * 2ch mode |
| 8605 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8606 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8607 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8608 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8609 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8610 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8611 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8612 | }; |
| 8613 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8614 | /* |
| 8615 | * 4ch mode |
| 8616 | */ |
| 8617 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8618 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8619 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8620 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8621 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8622 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8623 | { } /* end */ |
| 8624 | }; |
| 8625 | |
| 8626 | /* |
| 8627 | * 6ch mode |
| 8628 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8629 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8630 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8631 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8632 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8633 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8634 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8635 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8636 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8637 | }; |
| 8638 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8639 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8640 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8641 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8642 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8643 | }; |
| 8644 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8645 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8646 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8647 | { |
| 8648 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8649 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8650 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8651 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8652 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8653 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8654 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8655 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8656 | } |
| 8657 | |
| 8658 | /* toggle RCA according to the front-jack state */ |
| 8659 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8660 | { |
| 8661 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8662 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8663 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8664 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8665 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8666 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8667 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8668 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8669 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8670 | unsigned int res) |
| 8671 | { |
| 8672 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8673 | alc888_lenovo_ms7195_front_automute(codec); |
| 8674 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8675 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8676 | } |
| 8677 | |
| 8678 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8679 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8680 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8681 | |
| 8682 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8683 | |
| 8684 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8685 | { } /* end */ |
| 8686 | }; |
| 8687 | |
| 8688 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8689 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8690 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8691 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8692 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8693 | spec->autocfg.hp_pins[0] = 0x14; |
| 8694 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8695 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8696 | } |
| 8697 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8698 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8699 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8700 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8701 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8702 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8703 | { |
| 8704 | unsigned int present; |
| 8705 | |
| 8706 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8707 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8708 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8709 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8710 | } |
| 8711 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8712 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8713 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8714 | struct alc_spec *spec = codec->spec; |
| 8715 | |
| 8716 | spec->autocfg.hp_pins[0] = 0x15; |
| 8717 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8718 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8719 | alc883_clevo_m720_mic_automute(codec); |
| 8720 | } |
| 8721 | |
| 8722 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8723 | unsigned int res) |
| 8724 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8725 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8726 | case ALC880_MIC_EVENT: |
| 8727 | alc883_clevo_m720_mic_automute(codec); |
| 8728 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8729 | default: |
| 8730 | alc_automute_amp_unsol_event(codec, res); |
| 8731 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8732 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8733 | } |
| 8734 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8735 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8736 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8737 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8738 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8739 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8740 | spec->autocfg.hp_pins[0] = 0x14; |
| 8741 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8742 | alc_automute_amp(codec); |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8743 | } |
| 8744 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8745 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8746 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8747 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8748 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8749 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8750 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8751 | alc_automute_amp(codec); |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8752 | } |
| 8753 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8754 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8755 | { |
| 8756 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8757 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8758 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8759 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8760 | & AC_PINSENSE_PRESENCE; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8761 | bits = present ? HDA_AMP_MUTE : 0; |
| 8762 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8763 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8764 | } |
| 8765 | |
| 8766 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8767 | { |
| 8768 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8769 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8770 | |
| 8771 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8772 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8773 | bits = present ? HDA_AMP_MUTE : 0; |
| 8774 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8775 | HDA_AMP_MUTE, bits); |
| 8776 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8777 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8778 | } |
| 8779 | |
| 8780 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8781 | unsigned int res) |
| 8782 | { |
| 8783 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8784 | alc883_lenovo_101e_all_automute(codec); |
| 8785 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8786 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8787 | } |
| 8788 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8789 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8790 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8791 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8792 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8793 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8794 | spec->autocfg.hp_pins[0] = 0x14; |
| 8795 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8796 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8797 | alc_automute_amp(codec); |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8798 | } |
| 8799 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8800 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8801 | /* HP Pin: output 0 (0x0c) */ |
| 8802 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8803 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8804 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8805 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8806 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8807 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8808 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8809 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8810 | /* eanable EAPD on medion laptop */ |
| 8811 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8812 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8813 | /* enable unsolicited event */ |
| 8814 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8815 | { } |
| 8816 | }; |
| 8817 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8818 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8819 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8820 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8821 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8822 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8823 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8824 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8825 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8826 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8827 | alc_automute_amp(codec); |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8828 | } |
| 8829 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8830 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8831 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8832 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8833 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8834 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8835 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8836 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8837 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8838 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8839 | spec->autocfg.speaker_pins[4] = 0x1a; |
| 8840 | alc_automute_amp(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8841 | } |
| 8842 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8843 | static void alc883_vaiott_init_hook(struct hda_codec *codec) |
| 8844 | { |
| 8845 | struct alc_spec *spec = codec->spec; |
| 8846 | |
| 8847 | spec->autocfg.hp_pins[0] = 0x15; |
| 8848 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8849 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8850 | alc_automute_amp(codec); |
| 8851 | } |
| 8852 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8853 | /* |
| 8854 | * generic initialization of ADC, input mixers and output mixers |
| 8855 | */ |
| 8856 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8857 | /* |
| 8858 | * Unmute ADC0-2 and set the default input to mic-in |
| 8859 | */ |
| 8860 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8861 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8862 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8863 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8864 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8865 | /* 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] | 8866 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8867 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8868 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8869 | */ |
| 8870 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8871 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8872 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8873 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8874 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8875 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8876 | |
| 8877 | /* |
| 8878 | * Set up output mixers (0x0c - 0x0f) |
| 8879 | */ |
| 8880 | /* set vol=0 to output mixers */ |
| 8881 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8882 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8883 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8884 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8885 | /* set up input amps for analog loopback */ |
| 8886 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8887 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8888 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8889 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8890 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8891 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8892 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8893 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8894 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8895 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8896 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8897 | |
| 8898 | /* FIXME: use matrix-type input source selection */ |
| 8899 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8900 | /* Input mixer1 */ |
| 8901 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8902 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8903 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8904 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8905 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8906 | /* Input mixer2 */ |
| 8907 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8908 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8909 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8910 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8911 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8912 | |
| 8913 | { } |
| 8914 | }; |
| 8915 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8916 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8917 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8918 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8919 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8920 | /* enable unsolicited event */ |
| 8921 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8922 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8923 | { } /* end */ |
| 8924 | }; |
| 8925 | |
| 8926 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8927 | { |
| 8928 | unsigned int present; |
| 8929 | |
| 8930 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8931 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8932 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8933 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8934 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8935 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8936 | } |
| 8937 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8938 | static void alc883_M90V_init_hook(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8939 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8940 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8941 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8942 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8943 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8944 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8945 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8946 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8947 | } |
| 8948 | |
| 8949 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8950 | unsigned int res) |
| 8951 | { |
| 8952 | switch (res >> 26) { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8953 | case ALC880_MIC_EVENT: |
| 8954 | alc883_nb_mic_automute(codec); |
| 8955 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8956 | default: |
| 8957 | alc_sku_unsol_event(codec, res); |
| 8958 | break; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8959 | } |
| 8960 | } |
| 8961 | |
| 8962 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8963 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8964 | alc883_M90V_init_hook(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8965 | alc883_nb_mic_automute(codec); |
| 8966 | } |
| 8967 | |
| 8968 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8969 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8970 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8971 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8972 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8973 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8974 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8975 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8976 | /* enable unsolicited event */ |
| 8977 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8978 | { } /* end */ |
| 8979 | }; |
| 8980 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8981 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8982 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8983 | struct alc_spec *spec = codec->spec; |
| 8984 | |
| 8985 | spec->autocfg.hp_pins[0] = 0x14; |
| 8986 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8987 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8988 | } |
| 8989 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8990 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8991 | /* Init rear pin (used as headphone output) */ |
| 8992 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8993 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8994 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8995 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8996 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8997 | /* Init line 2 pin (used as headphone out by default) */ |
| 8998 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8999 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9000 | { } /* end */ |
| 9001 | }; |
| 9002 | |
| 9003 | /* Mute speakers according to the headphone jack state */ |
| 9004 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9005 | { |
| 9006 | unsigned int present; |
| 9007 | |
| 9008 | /* Mute only in 2ch or 4ch mode */ |
| 9009 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9010 | == 0x00) { |
| 9011 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9012 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 9013 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9014 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9015 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9016 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9017 | } |
| 9018 | } |
| 9019 | |
| 9020 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9021 | { |
| 9022 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9023 | alc889A_mb31_automute(codec); |
| 9024 | } |
| 9025 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9026 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9027 | #define alc883_loopbacks alc880_loopbacks |
| 9028 | #endif |
| 9029 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9030 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9031 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 9032 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9033 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9034 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 9035 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 9036 | |
| 9037 | /* |
| 9038 | * configuration and preset |
| 9039 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9040 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 9041 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 9042 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9043 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 9044 | [ALC883_6ST_DIG] = "6stack-dig", |
| 9045 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9046 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9047 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9048 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9049 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9050 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9051 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9052 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9053 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9054 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9055 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9056 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9057 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9058 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9059 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9060 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9061 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9062 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9063 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9064 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9065 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9066 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9067 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9068 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9069 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9070 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9071 | [ALC883_AUTO] = "auto", |
| 9072 | }; |
| 9073 | |
| 9074 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 9075 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9076 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9077 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9078 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9079 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9080 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9081 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9082 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9083 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9084 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 9085 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9086 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9087 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9088 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9089 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | b3bdb30 | 2009-02-18 13:16:26 +0100 | [diff] [blame] | 9090 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), |
Takashi Iwai | 9468350 | 2009-02-13 09:31:20 +0100 | [diff] [blame] | 9091 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9092 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9093 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9094 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9095 | ALC888_ACER_ASPIRE_6530G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9096 | /* default Acer -- disabled as it causes more problems. |
| 9097 | * model=auto should work fine now |
| 9098 | */ |
| 9099 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9100 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9101 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9102 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9103 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9104 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9105 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9106 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9107 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9108 | 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] | 9109 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9110 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9111 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9112 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9113 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9114 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9115 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9116 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9117 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9118 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 9119 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9120 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9121 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9122 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 9123 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9124 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9125 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9126 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9127 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9128 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9129 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9130 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9131 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 9132 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9133 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9134 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9135 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9136 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9137 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9138 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9139 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9140 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9141 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9142 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9143 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9144 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9145 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9146 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9147 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9148 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9149 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9150 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9151 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9152 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9153 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9154 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9155 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9156 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9157 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9158 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9159 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9160 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9161 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9162 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9163 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9164 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9165 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9166 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 9167 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9168 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9169 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9170 | {} |
| 9171 | }; |
| 9172 | |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9173 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9174 | ALC1200_DIGOUT_NID, 0, |
| 9175 | }; |
| 9176 | |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9177 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9178 | ALC883_DIGOUT_NID, 0, |
| 9179 | }; |
| 9180 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9181 | static struct alc_config_preset alc883_presets[] = { |
| 9182 | [ALC883_3ST_2ch_DIG] = { |
| 9183 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9184 | .init_verbs = { alc883_init_verbs }, |
| 9185 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9186 | .dac_nids = alc883_dac_nids, |
| 9187 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9188 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9189 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9190 | .channel_mode = alc883_3ST_2ch_modes, |
| 9191 | .input_mux = &alc883_capture_source, |
| 9192 | }, |
| 9193 | [ALC883_3ST_6ch_DIG] = { |
| 9194 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9195 | .init_verbs = { alc883_init_verbs }, |
| 9196 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9197 | .dac_nids = alc883_dac_nids, |
| 9198 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9199 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9200 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9201 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9202 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9203 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9204 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9205 | [ALC883_3ST_6ch] = { |
| 9206 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9207 | .init_verbs = { alc883_init_verbs }, |
| 9208 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9209 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9210 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9211 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9212 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9213 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9214 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9215 | [ALC883_3ST_6ch_INTEL] = { |
| 9216 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9217 | .init_verbs = { alc883_init_verbs }, |
| 9218 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9219 | .dac_nids = alc883_dac_nids, |
| 9220 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9221 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9222 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9223 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9224 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9225 | .need_dac_fix = 1, |
| 9226 | .input_mux = &alc883_3stack_6ch_intel, |
| 9227 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9228 | [ALC883_6ST_DIG] = { |
| 9229 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9230 | .init_verbs = { alc883_init_verbs }, |
| 9231 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9232 | .dac_nids = alc883_dac_nids, |
| 9233 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9234 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9235 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9236 | .channel_mode = alc883_sixstack_modes, |
| 9237 | .input_mux = &alc883_capture_source, |
| 9238 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9239 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9240 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
| 9241 | .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9242 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9243 | .dac_nids = alc883_dac_nids, |
| 9244 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9245 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9246 | .channel_mode = alc883_3ST_6ch_modes, |
| 9247 | .need_dac_fix = 1, |
| 9248 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9249 | .unsol_event = alc883_targa_unsol_event, |
| 9250 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9251 | }, |
| 9252 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9253 | .mixers = { alc883_targa_2ch_mixer}, |
| 9254 | .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9255 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9256 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9257 | .adc_nids = alc883_adc_nids_alt, |
| 9258 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9259 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9260 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9261 | .channel_mode = alc883_3ST_2ch_modes, |
| 9262 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9263 | .unsol_event = alc883_targa_unsol_event, |
| 9264 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9265 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9266 | [ALC883_TARGA_8ch_DIG] = { |
| 9267 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9268 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9269 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9270 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9271 | .dac_nids = alc883_dac_nids, |
| 9272 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9273 | .adc_nids = alc883_adc_nids_rev, |
| 9274 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9275 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9276 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9277 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9278 | .channel_mode = alc883_4ST_8ch_modes, |
| 9279 | .need_dac_fix = 1, |
| 9280 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9281 | .unsol_event = alc883_targa_unsol_event, |
| 9282 | .init_hook = alc883_targa_init_hook, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9283 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9284 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9285 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9286 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9287 | * and the headphone jack. Turn this on and rely on the |
| 9288 | * standard mute methods whenever the user wants to turn |
| 9289 | * these outputs off. |
| 9290 | */ |
| 9291 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9292 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9293 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9294 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9295 | .channel_mode = alc883_3ST_2ch_modes, |
| 9296 | .input_mux = &alc883_capture_source, |
| 9297 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9298 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9299 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9300 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9301 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9302 | .dac_nids = alc883_dac_nids, |
| 9303 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9304 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9305 | .channel_mode = alc883_3ST_2ch_modes, |
| 9306 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9307 | .unsol_event = alc_automute_amp_unsol_event, |
| 9308 | .init_hook = alc883_acer_aspire_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9309 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9310 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9311 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9312 | alc883_chmode_mixer }, |
| 9313 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9314 | alc888_acer_aspire_4930g_verbs }, |
| 9315 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9316 | .dac_nids = alc883_dac_nids, |
| 9317 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9318 | .adc_nids = alc883_adc_nids_rev, |
| 9319 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9320 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9321 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9322 | .channel_mode = alc883_3ST_6ch_modes, |
| 9323 | .need_dac_fix = 1, |
| 9324 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9325 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9326 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9327 | .unsol_event = alc_automute_amp_unsol_event, |
| 9328 | .init_hook = alc888_acer_aspire_4930g_init_hook, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9329 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9330 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9331 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9332 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9333 | alc888_acer_aspire_6530g_verbs }, |
| 9334 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9335 | .dac_nids = alc883_dac_nids, |
| 9336 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9337 | .adc_nids = alc883_adc_nids_rev, |
| 9338 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9339 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9340 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9341 | .channel_mode = alc883_3ST_2ch_modes, |
| 9342 | .num_mux_defs = |
| 9343 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9344 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9345 | .unsol_event = alc_automute_amp_unsol_event, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 9346 | .init_hook = alc888_acer_aspire_6530g_init_hook, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9347 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9348 | [ALC888_ACER_ASPIRE_8930G] = { |
| 9349 | .mixers = { alc888_base_mixer, |
| 9350 | alc883_chmode_mixer }, |
| 9351 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9352 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9353 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9354 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9355 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9356 | .adc_nids = alc889_adc_nids, |
| 9357 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9358 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9359 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9360 | .channel_mode = alc883_3ST_6ch_modes, |
| 9361 | .need_dac_fix = 1, |
| 9362 | .const_channel_count = 6, |
| 9363 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9364 | ARRAY_SIZE(alc889_capture_sources), |
| 9365 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9366 | .unsol_event = alc_automute_amp_unsol_event, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9367 | .init_hook = alc889_acer_aspire_8930g_init_hook, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9368 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9369 | [ALC883_MEDION] = { |
| 9370 | .mixers = { alc883_fivestack_mixer, |
| 9371 | alc883_chmode_mixer }, |
| 9372 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9373 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9374 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9375 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9376 | .adc_nids = alc883_adc_nids_alt, |
| 9377 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9378 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9379 | .channel_mode = alc883_sixstack_modes, |
| 9380 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9381 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9382 | [ALC883_MEDION_MD2] = { |
| 9383 | .mixers = { alc883_medion_md2_mixer}, |
| 9384 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9385 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9386 | .dac_nids = alc883_dac_nids, |
| 9387 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9388 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9389 | .channel_mode = alc883_3ST_2ch_modes, |
| 9390 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9391 | .unsol_event = alc_automute_amp_unsol_event, |
| 9392 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9393 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9394 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9395 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9396 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9397 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9398 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9399 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9400 | .channel_mode = alc883_3ST_2ch_modes, |
| 9401 | .input_mux = &alc883_capture_source, |
| 9402 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9403 | [ALC883_CLEVO_M720] = { |
| 9404 | .mixers = { alc883_clevo_m720_mixer }, |
| 9405 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9406 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9407 | .dac_nids = alc883_dac_nids, |
| 9408 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9409 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9410 | .channel_mode = alc883_3ST_2ch_modes, |
| 9411 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9412 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9413 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9414 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9415 | [ALC883_LENOVO_101E_2ch] = { |
| 9416 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9417 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9418 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9419 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9420 | .adc_nids = alc883_adc_nids_alt, |
| 9421 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9422 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9423 | .channel_mode = alc883_3ST_2ch_modes, |
| 9424 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9425 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9426 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9427 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9428 | [ALC883_LENOVO_NB0763] = { |
| 9429 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9430 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9431 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9432 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9433 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9434 | .channel_mode = alc883_3ST_2ch_modes, |
| 9435 | .need_dac_fix = 1, |
| 9436 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9437 | .unsol_event = alc_automute_amp_unsol_event, |
| 9438 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9439 | }, |
| 9440 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9441 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9442 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9443 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9444 | .dac_nids = alc883_dac_nids, |
| 9445 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9446 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9447 | .channel_mode = alc883_3ST_6ch_modes, |
| 9448 | .need_dac_fix = 1, |
| 9449 | .input_mux = &alc883_capture_source, |
| 9450 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9451 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9452 | }, |
| 9453 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9454 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9455 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9456 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9457 | .dac_nids = alc883_dac_nids, |
| 9458 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9459 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9460 | .channel_mode = alc883_3ST_2ch_modes, |
| 9461 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9462 | .unsol_event = alc_automute_amp_unsol_event, |
| 9463 | .init_hook = alc883_haier_w66_init_hook, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9464 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9465 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9466 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9467 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9468 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9469 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9470 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9471 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9472 | .need_dac_fix = 1, |
| 9473 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9474 | .unsol_event = alc_automute_amp_unsol_event, |
| 9475 | .init_hook = alc888_3st_hp_init_hook, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9476 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9477 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9478 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9479 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9480 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9481 | .dac_nids = alc883_dac_nids, |
| 9482 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9483 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9484 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9485 | .channel_mode = alc883_sixstack_modes, |
| 9486 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9487 | .unsol_event = alc_automute_amp_unsol_event, |
| 9488 | .init_hook = alc888_6st_dell_init_hook, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9489 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9490 | [ALC883_MITAC] = { |
| 9491 | .mixers = { alc883_mitac_mixer }, |
| 9492 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9493 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9494 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9495 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9496 | .channel_mode = alc883_3ST_2ch_modes, |
| 9497 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9498 | .unsol_event = alc_automute_amp_unsol_event, |
| 9499 | .init_hook = alc883_mitac_init_hook, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9500 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9501 | [ALC883_FUJITSU_PI2515] = { |
| 9502 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9503 | .init_verbs = { alc883_init_verbs, |
| 9504 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9505 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9506 | .dac_nids = alc883_dac_nids, |
| 9507 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9508 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9509 | .channel_mode = alc883_3ST_2ch_modes, |
| 9510 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9511 | .unsol_event = alc_automute_amp_unsol_event, |
| 9512 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9513 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9514 | [ALC888_FUJITSU_XA3530] = { |
| 9515 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9516 | .init_verbs = { alc883_init_verbs, |
| 9517 | alc888_fujitsu_xa3530_verbs }, |
| 9518 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9519 | .dac_nids = alc883_dac_nids, |
| 9520 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9521 | .adc_nids = alc883_adc_nids_rev, |
| 9522 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9523 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9524 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9525 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9526 | .num_mux_defs = |
| 9527 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9528 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9529 | .unsol_event = alc_automute_amp_unsol_event, |
| 9530 | .init_hook = alc888_fujitsu_xa3530_init_hook, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9531 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9532 | [ALC888_LENOVO_SKY] = { |
| 9533 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9534 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9535 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9536 | .dac_nids = alc883_dac_nids, |
| 9537 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9538 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9539 | .channel_mode = alc883_sixstack_modes, |
| 9540 | .need_dac_fix = 1, |
| 9541 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9542 | .unsol_event = alc_automute_amp_unsol_event, |
| 9543 | .init_hook = alc888_lenovo_sky_init_hook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9544 | }, |
| 9545 | [ALC888_ASUS_M90V] = { |
| 9546 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9547 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9548 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9549 | .dac_nids = alc883_dac_nids, |
| 9550 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9551 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9552 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9553 | .channel_mode = alc883_3ST_6ch_modes, |
| 9554 | .need_dac_fix = 1, |
| 9555 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9556 | .unsol_event = alc883_mode2_unsol_event, |
| 9557 | .init_hook = alc883_mode2_inithook, |
| 9558 | }, |
| 9559 | [ALC888_ASUS_EEE1601] = { |
| 9560 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9561 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9562 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9563 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9564 | .dac_nids = alc883_dac_nids, |
| 9565 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9566 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9567 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9568 | .channel_mode = alc883_3ST_2ch_modes, |
| 9569 | .need_dac_fix = 1, |
| 9570 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9571 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9572 | .init_hook = alc883_eee1601_inithook, |
| 9573 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9574 | [ALC1200_ASUS_P5Q] = { |
| 9575 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9576 | .init_verbs = { alc883_init_verbs }, |
| 9577 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9578 | .dac_nids = alc883_dac_nids, |
| 9579 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9580 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9581 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9582 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9583 | .channel_mode = alc883_sixstack_modes, |
| 9584 | .input_mux = &alc883_capture_source, |
| 9585 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9586 | [ALC889A_MB31] = { |
| 9587 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9588 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9589 | alc880_gpio1_init_verbs }, |
| 9590 | .adc_nids = alc883_adc_nids, |
| 9591 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9592 | .dac_nids = alc883_dac_nids, |
| 9593 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9594 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9595 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9596 | .input_mux = &alc889A_mb31_capture_source, |
| 9597 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9598 | .unsol_event = alc889A_mb31_unsol_event, |
| 9599 | .init_hook = alc889A_mb31_automute, |
| 9600 | }, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9601 | [ALC883_SONY_VAIO_TT] = { |
| 9602 | .mixers = { alc883_vaiott_mixer }, |
| 9603 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9604 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9605 | .dac_nids = alc883_dac_nids, |
| 9606 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9607 | .channel_mode = alc883_3ST_2ch_modes, |
| 9608 | .input_mux = &alc883_capture_source, |
| 9609 | .unsol_event = alc_automute_amp_unsol_event, |
| 9610 | .init_hook = alc883_vaiott_init_hook, |
| 9611 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9612 | }; |
| 9613 | |
| 9614 | |
| 9615 | /* |
| 9616 | * BIOS auto configuration |
| 9617 | */ |
| 9618 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9619 | hda_nid_t nid, int pin_type, |
| 9620 | int dac_idx) |
| 9621 | { |
| 9622 | /* set as output */ |
| 9623 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9624 | int idx; |
| 9625 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9626 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9627 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9628 | idx = 4; |
| 9629 | else |
| 9630 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9631 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9632 | |
| 9633 | } |
| 9634 | |
| 9635 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 9636 | { |
| 9637 | struct alc_spec *spec = codec->spec; |
| 9638 | int i; |
| 9639 | |
| 9640 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9641 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9642 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9643 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9644 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9645 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9646 | } |
| 9647 | } |
| 9648 | |
| 9649 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 9650 | { |
| 9651 | struct alc_spec *spec = codec->spec; |
| 9652 | hda_nid_t pin; |
| 9653 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9654 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9655 | if (pin) /* connect to front */ |
| 9656 | /* use dac 0 */ |
| 9657 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9658 | pin = spec->autocfg.speaker_pins[0]; |
| 9659 | if (pin) |
| 9660 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9661 | } |
| 9662 | |
| 9663 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9664 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 9665 | |
| 9666 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 9667 | { |
| 9668 | struct alc_spec *spec = codec->spec; |
| 9669 | int i; |
| 9670 | |
| 9671 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9672 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9673 | if (alc883_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 9674 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 9675 | if (nid != ALC883_PIN_CD_NID && |
| 9676 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9677 | snd_hda_codec_write(codec, nid, 0, |
| 9678 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9679 | AMP_OUT_MUTE); |
| 9680 | } |
| 9681 | } |
| 9682 | } |
| 9683 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9684 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 9685 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9686 | /* almost identical with ALC880 parser... */ |
| 9687 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 9688 | { |
| 9689 | struct alc_spec *spec = codec->spec; |
| 9690 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9691 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 9692 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9693 | |
| 9694 | if (err < 0) |
| 9695 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9696 | else if (!err) |
| 9697 | return 0; /* no config found */ |
| 9698 | |
| 9699 | err = alc_auto_add_mic_boost(codec); |
| 9700 | if (err < 0) |
| 9701 | return err; |
| 9702 | |
| 9703 | /* hack - override the init verbs */ |
| 9704 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9705 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9706 | /* setup input_mux for ALC889 */ |
| 9707 | if (codec->vendor_id == 0x10ec0889) { |
| 9708 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9709 | * because it's under 0x18 |
| 9710 | */ |
| 9711 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9712 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9713 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9714 | for (i = 1; i < 3; i++) |
| 9715 | memcpy(&spec->private_imux[i], |
| 9716 | &spec->private_imux[0], |
| 9717 | sizeof(spec->private_imux[0])); |
| 9718 | imux->items[imux->num_items].label = "Int DMic"; |
| 9719 | imux->items[imux->num_items].index = 0x0b; |
| 9720 | imux->num_items++; |
| 9721 | spec->num_mux_defs = 3; |
| 9722 | spec->input_mux = spec->private_imux; |
| 9723 | } |
| 9724 | } |
| 9725 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9726 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9727 | } |
| 9728 | |
| 9729 | /* additional initialization for auto-configuration model */ |
| 9730 | static void alc883_auto_init(struct hda_codec *codec) |
| 9731 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9732 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9733 | alc883_auto_init_multi_out(codec); |
| 9734 | alc883_auto_init_hp_out(codec); |
| 9735 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9736 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9737 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9738 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9739 | } |
| 9740 | |
| 9741 | static int patch_alc883(struct hda_codec *codec) |
| 9742 | { |
| 9743 | struct alc_spec *spec; |
| 9744 | int err, board_config; |
| 9745 | |
| 9746 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9747 | if (spec == NULL) |
| 9748 | return -ENOMEM; |
| 9749 | |
| 9750 | codec->spec = spec; |
| 9751 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9752 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9753 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9754 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9755 | alc883_models, |
| 9756 | alc883_cfg_tbl); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9757 | if (board_config < 0 || board_config >= ALC883_MODEL_LAST) { |
| 9758 | /* Pick up systems that don't supply PCI SSID */ |
| 9759 | switch (codec->subsystem_id) { |
| 9760 | case 0x106b3600: /* Macbook 3.1 */ |
| 9761 | board_config = ALC889A_MB31; |
| 9762 | break; |
| 9763 | default: |
| 9764 | printk(KERN_INFO |
| 9765 | "hda_codec: Unknown model for %s, trying " |
| 9766 | "auto-probe from BIOS...\n", codec->chip_name); |
| 9767 | board_config = ALC883_AUTO; |
| 9768 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9769 | } |
| 9770 | |
| 9771 | if (board_config == ALC883_AUTO) { |
| 9772 | /* automatic parse from the BIOS config */ |
| 9773 | err = alc883_parse_auto_config(codec); |
| 9774 | if (err < 0) { |
| 9775 | alc_free(codec); |
| 9776 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9777 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9778 | printk(KERN_INFO |
| 9779 | "hda_codec: Cannot set up configuration " |
| 9780 | "from BIOS. Using base mode...\n"); |
| 9781 | board_config = ALC883_3ST_2ch_DIG; |
| 9782 | } |
| 9783 | } |
| 9784 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9785 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9786 | if (err < 0) { |
| 9787 | alc_free(codec); |
| 9788 | return err; |
| 9789 | } |
| 9790 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9791 | if (board_config != ALC883_AUTO) |
| 9792 | setup_preset(spec, &alc883_presets[board_config]); |
| 9793 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9794 | switch (codec->vendor_id) { |
| 9795 | case 0x10ec0888: |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9796 | if (!spec->num_adc_nids) { |
| 9797 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9798 | spec->adc_nids = alc883_adc_nids; |
| 9799 | } |
| 9800 | if (!spec->capsrc_nids) |
| 9801 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9802 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9803 | break; |
| 9804 | case 0x10ec0889: |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9805 | if (!spec->num_adc_nids) { |
| 9806 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9807 | spec->adc_nids = alc889_adc_nids; |
| 9808 | } |
| 9809 | if (!spec->capsrc_nids) |
| 9810 | spec->capsrc_nids = alc889_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9811 | break; |
| 9812 | default: |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9813 | if (!spec->num_adc_nids) { |
| 9814 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9815 | spec->adc_nids = alc883_adc_nids; |
| 9816 | } |
| 9817 | if (!spec->capsrc_nids) |
| 9818 | spec->capsrc_nids = alc883_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9819 | break; |
| 9820 | } |
| 9821 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9822 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9823 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9824 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9825 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9826 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9827 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9828 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9829 | if (!spec->cap_mixer) |
| 9830 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9831 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9832 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9833 | spec->vmaster_nid = 0x0c; |
| 9834 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9835 | codec->patch_ops = alc_patch_ops; |
| 9836 | if (board_config == ALC883_AUTO) |
| 9837 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9838 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9839 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9840 | if (!spec->loopback.amplist) |
| 9841 | spec->loopback.amplist = alc883_loopbacks; |
| 9842 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9843 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9844 | |
| 9845 | return 0; |
| 9846 | } |
| 9847 | |
| 9848 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9849 | * ALC262 support |
| 9850 | */ |
| 9851 | |
| 9852 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9853 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9854 | |
| 9855 | #define alc262_dac_nids alc260_dac_nids |
| 9856 | #define alc262_adc_nids alc882_adc_nids |
| 9857 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9858 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9859 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9860 | |
| 9861 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9862 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9863 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9864 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9865 | /* ADC0 */ |
| 9866 | 0x09 |
| 9867 | }; |
| 9868 | |
| 9869 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9870 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9871 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9872 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9873 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9874 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9875 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9876 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9877 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9880 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9881 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9882 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9883 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9884 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9885 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9886 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9887 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9888 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9889 | }; |
| 9890 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9891 | /* update HP, line and mono-out pins according to the master switch */ |
| 9892 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9893 | { |
| 9894 | struct alc_spec *spec = codec->spec; |
| 9895 | int val = spec->master_sw; |
| 9896 | |
| 9897 | /* HP & line-out */ |
| 9898 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9899 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9900 | val ? PIN_HP : 0); |
| 9901 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9902 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9903 | val ? PIN_HP : 0); |
| 9904 | /* mono (speaker) depending on the HP jack sense */ |
| 9905 | val = val && !spec->jack_present; |
| 9906 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9907 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9908 | val ? PIN_OUT : 0); |
| 9909 | } |
| 9910 | |
| 9911 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9912 | { |
| 9913 | struct alc_spec *spec = codec->spec; |
| 9914 | unsigned int presence; |
| 9915 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9916 | AC_VERB_GET_PIN_SENSE, 0); |
| 9917 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9918 | alc262_hp_master_update(codec); |
| 9919 | } |
| 9920 | |
| 9921 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9922 | { |
| 9923 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9924 | return; |
| 9925 | alc262_hp_bpc_automute(codec); |
| 9926 | } |
| 9927 | |
| 9928 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9929 | { |
| 9930 | struct alc_spec *spec = codec->spec; |
| 9931 | unsigned int presence; |
| 9932 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9933 | AC_VERB_GET_PIN_SENSE, 0); |
| 9934 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9935 | alc262_hp_master_update(codec); |
| 9936 | } |
| 9937 | |
| 9938 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9939 | unsigned int res) |
| 9940 | { |
| 9941 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9942 | return; |
| 9943 | alc262_hp_wildwest_automute(codec); |
| 9944 | } |
| 9945 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9946 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9947 | |
| 9948 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9949 | struct snd_ctl_elem_value *ucontrol) |
| 9950 | { |
| 9951 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9952 | struct alc_spec *spec = codec->spec; |
| 9953 | int val = !!*ucontrol->value.integer.value; |
| 9954 | |
| 9955 | if (val == spec->master_sw) |
| 9956 | return 0; |
| 9957 | spec->master_sw = val; |
| 9958 | alc262_hp_master_update(codec); |
| 9959 | return 1; |
| 9960 | } |
| 9961 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9962 | #define ALC262_HP_MASTER_SWITCH \ |
| 9963 | { \ |
| 9964 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9965 | .name = "Master Playback Switch", \ |
| 9966 | .info = snd_ctl_boolean_mono_info, \ |
| 9967 | .get = alc262_hp_master_sw_get, \ |
| 9968 | .put = alc262_hp_master_sw_put, \ |
| 9969 | } |
| 9970 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9971 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9972 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9973 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9974 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9975 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9976 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9977 | HDA_OUTPUT), |
| 9978 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9979 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9980 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9981 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9982 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9983 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9984 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9985 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9986 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9987 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9988 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9989 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9990 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9991 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9992 | { } /* end */ |
| 9993 | }; |
| 9994 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9995 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9996 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9997 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9998 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9999 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10000 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10001 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10002 | HDA_OUTPUT), |
| 10003 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10004 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10005 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10006 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10007 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10008 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10009 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10010 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10011 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10012 | { } /* end */ |
| 10013 | }; |
| 10014 | |
| 10015 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10016 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10017 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10018 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10019 | { } /* end */ |
| 10020 | }; |
| 10021 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10022 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10023 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10024 | { |
| 10025 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10026 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10027 | spec->autocfg.hp_pins[0] = 0x15; |
| 10028 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
| 10029 | alc_automute_amp(codec); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10030 | } |
| 10031 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10032 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10033 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10034 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10035 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10036 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10037 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10038 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10039 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10040 | { } /* end */ |
| 10041 | }; |
| 10042 | |
| 10043 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10044 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10045 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10046 | |
| 10047 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10048 | { } |
| 10049 | }; |
| 10050 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10051 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10052 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10053 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10054 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10055 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10056 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10057 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10058 | { } /* end */ |
| 10059 | }; |
| 10060 | |
| 10061 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10062 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10063 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10064 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10065 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10066 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10067 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10068 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10069 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10070 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10071 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10072 | {} |
| 10073 | }; |
| 10074 | |
| 10075 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10076 | .num_items = 1, |
| 10077 | .items = { |
| 10078 | { "Line", 0x1 }, |
| 10079 | }, |
| 10080 | }; |
| 10081 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10082 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10083 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10084 | { |
| 10085 | struct alc_spec *spec = codec->spec; |
| 10086 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10087 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10088 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10089 | unsigned int mute; |
| 10090 | |
| 10091 | /* HP */ |
| 10092 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10093 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10094 | HDA_AMP_MUTE, mute); |
| 10095 | /* mute internal speaker per jack sense */ |
| 10096 | if (spec->jack_present) |
| 10097 | mute = HDA_AMP_MUTE; |
| 10098 | if (line_nid) |
| 10099 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10100 | HDA_AMP_MUTE, mute); |
| 10101 | if (speaker_nid && speaker_nid != line_nid) |
| 10102 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10103 | HDA_AMP_MUTE, mute); |
| 10104 | } |
| 10105 | |
| 10106 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10107 | |
| 10108 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10109 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10110 | { |
| 10111 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10112 | struct alc_spec *spec = codec->spec; |
| 10113 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10114 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10115 | if (val == spec->master_sw) |
| 10116 | return 0; |
| 10117 | spec->master_sw = val; |
| 10118 | alc262_hippo_master_update(codec); |
| 10119 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10120 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10121 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10122 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10123 | { \ |
| 10124 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10125 | .name = "Master Playback Switch", \ |
| 10126 | .info = snd_ctl_boolean_mono_info, \ |
| 10127 | .get = alc262_hippo_master_sw_get, \ |
| 10128 | .put = alc262_hippo_master_sw_put, \ |
| 10129 | } |
| 10130 | |
| 10131 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10132 | ALC262_HIPPO_MASTER_SWITCH, |
| 10133 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10134 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10135 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10136 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10137 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10138 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10139 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10140 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10141 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10142 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10143 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10144 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10145 | { } /* end */ |
| 10146 | }; |
| 10147 | |
| 10148 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10149 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10150 | ALC262_HIPPO_MASTER_SWITCH, |
| 10151 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10152 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10153 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10154 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10155 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10156 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10157 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10158 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10159 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10160 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10161 | { } /* end */ |
| 10162 | }; |
| 10163 | |
| 10164 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10165 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10166 | { |
| 10167 | struct alc_spec *spec = codec->spec; |
| 10168 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10169 | unsigned int present; |
| 10170 | |
| 10171 | /* need to execute and sync at first */ |
| 10172 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10173 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 10174 | AC_VERB_GET_PIN_SENSE, 0); |
| 10175 | spec->jack_present = (present & 0x80000000) != 0; |
| 10176 | alc262_hippo_master_update(codec); |
| 10177 | } |
| 10178 | |
| 10179 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10180 | { |
| 10181 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10182 | return; |
| 10183 | alc262_hippo_automute(codec); |
| 10184 | } |
| 10185 | |
| 10186 | static void alc262_hippo_init_hook(struct hda_codec *codec) |
| 10187 | { |
| 10188 | struct alc_spec *spec = codec->spec; |
| 10189 | |
| 10190 | spec->autocfg.hp_pins[0] = 0x15; |
| 10191 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10192 | alc262_hippo_automute(codec); |
| 10193 | } |
| 10194 | |
| 10195 | static void alc262_hippo1_init_hook(struct hda_codec *codec) |
| 10196 | { |
| 10197 | struct alc_spec *spec = codec->spec; |
| 10198 | |
| 10199 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10200 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10201 | alc262_hippo_automute(codec); |
| 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 | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10258 | static void alc262_tyan_init_hook(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; |
| 10264 | alc_automute_amp(codec); |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10265 | } |
| 10266 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10267 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10268 | #define alc262_capture_mixer alc882_capture_mixer |
| 10269 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10270 | |
| 10271 | /* |
| 10272 | * generic initialization of ADC, input mixers and output mixers |
| 10273 | */ |
| 10274 | static struct hda_verb alc262_init_verbs[] = { |
| 10275 | /* |
| 10276 | * Unmute ADC0-2 and set the default input to mic-in |
| 10277 | */ |
| 10278 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10279 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10280 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10281 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10282 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10283 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10284 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10285 | /* 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] | 10286 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10287 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10288 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10289 | */ |
| 10290 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10291 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10292 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10295 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10296 | |
| 10297 | /* |
| 10298 | * Set up output mixers (0x0c - 0x0e) |
| 10299 | */ |
| 10300 | /* set vol=0 to output mixers */ |
| 10301 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10302 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10303 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10304 | /* set up input amps for analog loopback */ |
| 10305 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10308 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10310 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10311 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10312 | |
| 10313 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10314 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10315 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10316 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10317 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10318 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10319 | |
| 10320 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10321 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10322 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10323 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10324 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10325 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10326 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10327 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10328 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10329 | /* FIXME: use matrix-type input source selection */ |
| 10330 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10331 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10332 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10333 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10334 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10335 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10336 | /* Input mixer2 */ |
| 10337 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10338 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10339 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10340 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10341 | /* Input mixer3 */ |
| 10342 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10343 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10344 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10345 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10346 | |
| 10347 | { } |
| 10348 | }; |
| 10349 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10350 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10351 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10352 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10353 | { } |
| 10354 | }; |
| 10355 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10356 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 10357 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10358 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10359 | {} |
| 10360 | }; |
| 10361 | |
| 10362 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10363 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10364 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10365 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10366 | |
| 10367 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10368 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10369 | {} |
| 10370 | }; |
| 10371 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10372 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10373 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10374 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10375 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10376 | |
| 10377 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10378 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10379 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10380 | }; |
| 10381 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10382 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 10383 | .num_items = 2, |
| 10384 | .items = { |
| 10385 | { "Int DMic", 0x9 }, |
| 10386 | { "Mic", 0x0 }, |
| 10387 | }, |
| 10388 | }; |
| 10389 | |
| 10390 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10391 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10392 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10393 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10394 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10395 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10396 | { } /* end */ |
| 10397 | }; |
| 10398 | |
| 10399 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10400 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10401 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10402 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10403 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10404 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10405 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10406 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10407 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10408 | {} |
| 10409 | }; |
| 10410 | |
| 10411 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 10412 | { |
| 10413 | unsigned int present; |
| 10414 | |
| 10415 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10416 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10417 | snd_hda_codec_write(codec, 0x22, 0, |
| 10418 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 10419 | } |
| 10420 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10421 | |
| 10422 | /* unsolicited event for HP jack sensing */ |
| 10423 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 10424 | unsigned int res) |
| 10425 | { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10426 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10427 | alc262_dmic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10428 | else |
| 10429 | alc_sku_unsol_event(codec, res); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10430 | } |
| 10431 | |
| 10432 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 10433 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10434 | struct alc_spec *spec = codec->spec; |
| 10435 | |
| 10436 | spec->autocfg.hp_pins[0] = 0x15; |
| 10437 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10438 | alc_automute_pin(codec); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10439 | alc262_dmic_automute(codec); |
| 10440 | } |
| 10441 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10442 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10443 | * nec model |
| 10444 | * 0x15 = headphone |
| 10445 | * 0x16 = internal speaker |
| 10446 | * 0x18 = external mic |
| 10447 | */ |
| 10448 | |
| 10449 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10450 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10451 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10452 | |
| 10453 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10454 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10455 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10456 | |
| 10457 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10458 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10459 | { } /* end */ |
| 10460 | }; |
| 10461 | |
| 10462 | static struct hda_verb alc262_nec_verbs[] = { |
| 10463 | /* Unmute Speaker */ |
| 10464 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10465 | |
| 10466 | /* Headphone */ |
| 10467 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10468 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10469 | |
| 10470 | /* External mic to headphone */ |
| 10471 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10472 | /* External mic to speaker */ |
| 10473 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10474 | {} |
| 10475 | }; |
| 10476 | |
| 10477 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10478 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10479 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10480 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10481 | */ |
| 10482 | |
| 10483 | #define ALC_HP_EVENT 0x37 |
| 10484 | |
| 10485 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10486 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10487 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10488 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10489 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10490 | {} |
| 10491 | }; |
| 10492 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10493 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10494 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10495 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10496 | {} |
| 10497 | }; |
| 10498 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10499 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10500 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10501 | .items = { |
| 10502 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10503 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10504 | { "CD", 0x4 }, |
| 10505 | }, |
| 10506 | }; |
| 10507 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10508 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10509 | .num_items = 5, |
| 10510 | .items = { |
| 10511 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10512 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10513 | { "Line", 0x2 }, |
| 10514 | { "CD", 0x4 }, |
| 10515 | { "AUX IN", 0x6 }, |
| 10516 | }, |
| 10517 | }; |
| 10518 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10519 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10520 | .num_items = 4, |
| 10521 | .items = { |
| 10522 | { "Mic", 0x0 }, |
| 10523 | { "Front Mic", 0x2 }, |
| 10524 | { "Line", 0x1 }, |
| 10525 | { "CD", 0x4 }, |
| 10526 | }, |
| 10527 | }; |
| 10528 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10529 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10530 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10531 | { |
| 10532 | struct alc_spec *spec = codec->spec; |
| 10533 | unsigned int mute; |
| 10534 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10535 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10536 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10537 | /* need to execute and sync at first */ |
| 10538 | 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] | 10539 | /* check laptop HP jack */ |
| 10540 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10541 | AC_VERB_GET_PIN_SENSE, 0); |
| 10542 | /* need to execute and sync at first */ |
| 10543 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10544 | /* check docking HP jack */ |
| 10545 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10546 | AC_VERB_GET_PIN_SENSE, 0); |
| 10547 | if (present & AC_PINSENSE_PRESENCE) |
| 10548 | spec->jack_present = 1; |
| 10549 | else |
| 10550 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10551 | spec->sense_updated = 1; |
| 10552 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10553 | /* unmute internal speaker only if both HPs are unplugged and |
| 10554 | * master switch is on |
| 10555 | */ |
| 10556 | if (spec->jack_present) |
| 10557 | mute = HDA_AMP_MUTE; |
| 10558 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10559 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10560 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10561 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10562 | } |
| 10563 | |
| 10564 | /* unsolicited event for HP jack sensing */ |
| 10565 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10566 | unsigned int res) |
| 10567 | { |
| 10568 | if ((res >> 26) != ALC_HP_EVENT) |
| 10569 | return; |
| 10570 | alc262_fujitsu_automute(codec, 1); |
| 10571 | } |
| 10572 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10573 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10574 | { |
| 10575 | alc262_fujitsu_automute(codec, 1); |
| 10576 | } |
| 10577 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10578 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10579 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10580 | .ops = &snd_hda_bind_vol, |
| 10581 | .values = { |
| 10582 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10583 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10584 | 0 |
| 10585 | }, |
| 10586 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10587 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10588 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10589 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10590 | { |
| 10591 | struct alc_spec *spec = codec->spec; |
| 10592 | unsigned int mute; |
| 10593 | |
| 10594 | if (force || !spec->sense_updated) { |
| 10595 | unsigned int present_int_hp; |
| 10596 | /* need to execute and sync at first */ |
| 10597 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10598 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10599 | AC_VERB_GET_PIN_SENSE, 0); |
| 10600 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10601 | spec->sense_updated = 1; |
| 10602 | } |
| 10603 | if (spec->jack_present) { |
| 10604 | /* mute internal speaker */ |
| 10605 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10606 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10607 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10608 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10609 | } else { |
| 10610 | /* unmute internal speaker if necessary */ |
| 10611 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10612 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10613 | HDA_AMP_MUTE, mute); |
| 10614 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10615 | HDA_AMP_MUTE, mute); |
| 10616 | } |
| 10617 | } |
| 10618 | |
| 10619 | /* unsolicited event for HP jack sensing */ |
| 10620 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10621 | unsigned int res) |
| 10622 | { |
| 10623 | if ((res >> 26) != ALC_HP_EVENT) |
| 10624 | return; |
| 10625 | alc262_lenovo_3000_automute(codec, 1); |
| 10626 | } |
| 10627 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10628 | /* bind hp and internal speaker mute (with plug check) */ |
| 10629 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10630 | struct snd_ctl_elem_value *ucontrol) |
| 10631 | { |
| 10632 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10633 | long *valp = ucontrol->value.integer.value; |
| 10634 | int change; |
| 10635 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10636 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10637 | HDA_AMP_MUTE, |
| 10638 | valp ? 0 : HDA_AMP_MUTE); |
| 10639 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10640 | HDA_AMP_MUTE, |
| 10641 | valp ? 0 : HDA_AMP_MUTE); |
| 10642 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10643 | if (change) |
| 10644 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10645 | return change; |
| 10646 | } |
| 10647 | |
| 10648 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10649 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10650 | { |
| 10651 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10652 | .name = "Master Playback Switch", |
| 10653 | .info = snd_hda_mixer_amp_switch_info, |
| 10654 | .get = snd_hda_mixer_amp_switch_get, |
| 10655 | .put = alc262_fujitsu_master_sw_put, |
| 10656 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10657 | }, |
| 10658 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10659 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10660 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10661 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10662 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10663 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10664 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10665 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10666 | { } /* end */ |
| 10667 | }; |
| 10668 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10669 | /* bind hp and internal speaker mute (with plug check) */ |
| 10670 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10671 | struct snd_ctl_elem_value *ucontrol) |
| 10672 | { |
| 10673 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10674 | long *valp = ucontrol->value.integer.value; |
| 10675 | int change; |
| 10676 | |
| 10677 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10678 | HDA_AMP_MUTE, |
| 10679 | valp ? 0 : HDA_AMP_MUTE); |
| 10680 | |
| 10681 | if (change) |
| 10682 | alc262_lenovo_3000_automute(codec, 0); |
| 10683 | return change; |
| 10684 | } |
| 10685 | |
| 10686 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10687 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10688 | { |
| 10689 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10690 | .name = "Master Playback Switch", |
| 10691 | .info = snd_hda_mixer_amp_switch_info, |
| 10692 | .get = snd_hda_mixer_amp_switch_get, |
| 10693 | .put = alc262_lenovo_3000_master_sw_put, |
| 10694 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10695 | }, |
| 10696 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10697 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10698 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10699 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10700 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10701 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10702 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10703 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10704 | { } /* end */ |
| 10705 | }; |
| 10706 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10707 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10708 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10709 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10710 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10711 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10712 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10713 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10714 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10715 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10716 | { } /* end */ |
| 10717 | }; |
| 10718 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10719 | /* additional init verbs for Benq laptops */ |
| 10720 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10721 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10722 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10723 | {} |
| 10724 | }; |
| 10725 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10726 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10727 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10728 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10729 | |
| 10730 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10731 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10732 | {} |
| 10733 | }; |
| 10734 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10735 | /* Samsung Q1 Ultra Vista model setup */ |
| 10736 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10737 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10738 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10739 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10740 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10741 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10742 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10743 | { } /* end */ |
| 10744 | }; |
| 10745 | |
| 10746 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10747 | /* output mixer */ |
| 10748 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10749 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10750 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10751 | /* speaker */ |
| 10752 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10753 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10754 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10755 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10756 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10757 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10758 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10759 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10760 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10761 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10762 | /* internal mic */ |
| 10763 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10764 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10765 | /* ADC, choose mic */ |
| 10766 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10767 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10768 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10769 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10770 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10771 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10772 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10773 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10774 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10775 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10776 | {} |
| 10777 | }; |
| 10778 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10779 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10780 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10781 | { |
| 10782 | struct alc_spec *spec = codec->spec; |
| 10783 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10784 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10785 | mute = 0; |
| 10786 | /* auto-mute only when HP is used as HP */ |
| 10787 | if (!spec->cur_mux[0]) { |
| 10788 | unsigned int present; |
| 10789 | /* need to execute and sync at first */ |
| 10790 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10791 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10792 | AC_VERB_GET_PIN_SENSE, 0); |
| 10793 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10794 | if (spec->jack_present) |
| 10795 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10796 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10797 | /* mute/unmute internal speaker */ |
| 10798 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10799 | HDA_AMP_MUTE, mute); |
| 10800 | /* mute/unmute HP */ |
| 10801 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10802 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10803 | } |
| 10804 | |
| 10805 | /* unsolicited event for HP jack sensing */ |
| 10806 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10807 | unsigned int res) |
| 10808 | { |
| 10809 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10810 | return; |
| 10811 | alc262_ultra_automute(codec); |
| 10812 | } |
| 10813 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10814 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10815 | .num_items = 2, |
| 10816 | .items = { |
| 10817 | { "Mic", 0x1 }, |
| 10818 | { "Headphone", 0x7 }, |
| 10819 | }, |
| 10820 | }; |
| 10821 | |
| 10822 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10823 | struct snd_ctl_elem_value *ucontrol) |
| 10824 | { |
| 10825 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10826 | struct alc_spec *spec = codec->spec; |
| 10827 | int ret; |
| 10828 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10829 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10830 | if (!ret) |
| 10831 | return 0; |
| 10832 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10833 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10834 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10835 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10836 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10837 | return ret; |
| 10838 | } |
| 10839 | |
| 10840 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10841 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10842 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10843 | { |
| 10844 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10845 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10846 | .info = alc_mux_enum_info, |
| 10847 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10848 | .put = alc262_ultra_mux_enum_put, |
| 10849 | }, |
| 10850 | { } /* end */ |
| 10851 | }; |
| 10852 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10853 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10854 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10855 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10856 | { |
| 10857 | hda_nid_t nid; |
| 10858 | int err; |
| 10859 | |
| 10860 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10861 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10862 | spec->multiout.dac_nids[0] = 2; |
| 10863 | |
| 10864 | nid = cfg->line_out_pins[0]; |
| 10865 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10866 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10867 | "Front Playback Volume", |
| 10868 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10869 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10870 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10871 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10872 | "Front Playback Switch", |
| 10873 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10874 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10875 | return err; |
| 10876 | } |
| 10877 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10878 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10879 | if (nid) { |
| 10880 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10881 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10882 | "Speaker Playback Volume", |
| 10883 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10884 | HDA_OUTPUT)); |
| 10885 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10886 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10887 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10888 | "Speaker Playback Switch", |
| 10889 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10890 | HDA_OUTPUT)); |
| 10891 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10892 | return err; |
| 10893 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10894 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10895 | "Speaker Playback Switch", |
| 10896 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10897 | HDA_OUTPUT)); |
| 10898 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10899 | return err; |
| 10900 | } |
| 10901 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10902 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10903 | if (nid) { |
| 10904 | /* spec->multiout.hp_nid = 2; */ |
| 10905 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10906 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10907 | "Headphone Playback Volume", |
| 10908 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10909 | HDA_OUTPUT)); |
| 10910 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10911 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10912 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10913 | "Headphone Playback Switch", |
| 10914 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10915 | HDA_OUTPUT)); |
| 10916 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10917 | return err; |
| 10918 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10919 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10920 | "Headphone Playback Switch", |
| 10921 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10922 | HDA_OUTPUT)); |
| 10923 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10924 | return err; |
| 10925 | } |
| 10926 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10927 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10928 | } |
| 10929 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 10930 | static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10931 | const struct auto_pin_cfg *cfg) |
| 10932 | { |
| 10933 | int err; |
| 10934 | |
| 10935 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 10936 | if (err < 0) |
| 10937 | return err; |
| 10938 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 10939 | * because it's under 0x18 |
| 10940 | */ |
| 10941 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 10942 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 10943 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 10944 | imux->items[imux->num_items].label = "Int Mic"; |
| 10945 | imux->items[imux->num_items].index = 0x09; |
| 10946 | imux->num_items++; |
| 10947 | } |
| 10948 | return 0; |
| 10949 | } |
| 10950 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10951 | |
| 10952 | /* |
| 10953 | * generic initialization of ADC, input mixers and output mixers |
| 10954 | */ |
| 10955 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10956 | /* |
| 10957 | * Unmute ADC0-2 and set the default input to mic-in |
| 10958 | */ |
| 10959 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10960 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10961 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10962 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10963 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10964 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10965 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10966 | /* 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] | 10967 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10968 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10969 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10970 | */ |
| 10971 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10972 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10973 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10974 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10975 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10976 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10977 | |
| 10978 | /* |
| 10979 | * Set up output mixers (0x0c - 0x0f) |
| 10980 | */ |
| 10981 | /* set vol=0 to output mixers */ |
| 10982 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10983 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10984 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10985 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10986 | /* set up input amps for analog loopback */ |
| 10987 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10988 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10989 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10990 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10991 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10992 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10993 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10994 | |
| 10995 | /* FIXME: use matrix-type input source selection */ |
| 10996 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10997 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10998 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10999 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11000 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11001 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11002 | /* Input mixer2 */ |
| 11003 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11004 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11005 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11006 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11007 | /* Input mixer3 */ |
| 11008 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11009 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11010 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11011 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11012 | |
| 11013 | { } |
| 11014 | }; |
| 11015 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11016 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11017 | /* |
| 11018 | * Unmute ADC0-2 and set the default input to mic-in |
| 11019 | */ |
| 11020 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11021 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11022 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11023 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11024 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11025 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11026 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11027 | /* 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] | 11028 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11029 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11030 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11031 | */ |
| 11032 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11033 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11034 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11035 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11036 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11037 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11038 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11040 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11041 | /* |
| 11042 | * Set up output mixers (0x0c - 0x0e) |
| 11043 | */ |
| 11044 | /* set vol=0 to output mixers */ |
| 11045 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11046 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11047 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11048 | |
| 11049 | /* set up input amps for analog loopback */ |
| 11050 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11051 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11052 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11053 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11054 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11055 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11056 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11057 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11058 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11059 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11060 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11061 | |
| 11062 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11063 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11064 | |
| 11065 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11066 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11067 | |
| 11068 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11069 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11070 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11071 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11072 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11073 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11074 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11075 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11076 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11077 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11078 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11079 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11080 | |
| 11081 | |
| 11082 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11083 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11084 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11085 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11086 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11087 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11088 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11089 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11090 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11091 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11092 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11093 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11094 | /* Input mixer2 */ |
| 11095 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11096 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11097 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11098 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11099 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11100 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11101 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11102 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11103 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11104 | /* Input mixer3 */ |
| 11105 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11106 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11107 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11108 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11109 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11110 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11112 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11113 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11114 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11115 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11116 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11117 | { } |
| 11118 | }; |
| 11119 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11120 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11121 | /* |
| 11122 | * Unmute ADC0-2 and set the default input to mic-in |
| 11123 | */ |
| 11124 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11125 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11126 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11127 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11128 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11129 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11130 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11131 | /* 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] | 11132 | * mixer widget |
| 11133 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11134 | * panel mic (mic 2) |
| 11135 | */ |
| 11136 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11137 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11138 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11139 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11140 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11141 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11142 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11143 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11144 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11145 | /* |
| 11146 | * Set up output mixers (0x0c - 0x0e) |
| 11147 | */ |
| 11148 | /* set vol=0 to output mixers */ |
| 11149 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11150 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11151 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11152 | |
| 11153 | /* set up input amps for analog loopback */ |
| 11154 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11155 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11156 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11157 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11158 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11159 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11160 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11161 | |
| 11162 | |
| 11163 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11164 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11165 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11166 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11167 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11168 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11169 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11170 | |
| 11171 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11172 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11173 | |
| 11174 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11175 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11176 | |
| 11177 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11178 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11179 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11180 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11181 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11182 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11183 | |
| 11184 | /* FIXME: use matrix-type input source selection */ |
| 11185 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11186 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11187 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11188 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11189 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11190 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11191 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11192 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11193 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11194 | /* Input mixer2 */ |
| 11195 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11196 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11197 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11198 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11199 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11200 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11201 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11202 | /* Input mixer3 */ |
| 11203 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11204 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11205 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11206 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11207 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11208 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11209 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11210 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11211 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11212 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11213 | { } |
| 11214 | }; |
| 11215 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11216 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11217 | |
| 11218 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11219 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11220 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11221 | |
| 11222 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11223 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11224 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11225 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11226 | |
| 11227 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11228 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11229 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11230 | {} |
| 11231 | }; |
| 11232 | |
| 11233 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11234 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11235 | #define alc262_loopbacks alc880_loopbacks |
| 11236 | #endif |
| 11237 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11238 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11239 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11240 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11241 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11242 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11243 | |
| 11244 | /* |
| 11245 | * BIOS auto configuration |
| 11246 | */ |
| 11247 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11248 | { |
| 11249 | struct alc_spec *spec = codec->spec; |
| 11250 | int err; |
| 11251 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11252 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11253 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11254 | alc262_ignore); |
| 11255 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11256 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11257 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11258 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11259 | spec->multiout.max_channels = 2; |
| 11260 | spec->no_analog = 1; |
| 11261 | goto dig_only; |
| 11262 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11263 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11264 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11265 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11266 | if (err < 0) |
| 11267 | return err; |
| 11268 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11269 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11270 | return err; |
| 11271 | |
| 11272 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11273 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11274 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11275 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11276 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11277 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11278 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11279 | if (spec->autocfg.dig_in_pin) |
| 11280 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11281 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11282 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11283 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11284 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11285 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11286 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11287 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11288 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11289 | err = alc_auto_add_mic_boost(codec); |
| 11290 | if (err < 0) |
| 11291 | return err; |
| 11292 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11293 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11294 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11295 | return 1; |
| 11296 | } |
| 11297 | |
| 11298 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11299 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11300 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11301 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11302 | |
| 11303 | |
| 11304 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11305 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11306 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11307 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11308 | alc262_auto_init_multi_out(codec); |
| 11309 | alc262_auto_init_hp_out(codec); |
| 11310 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11311 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11312 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11313 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11314 | } |
| 11315 | |
| 11316 | /* |
| 11317 | * configuration and preset |
| 11318 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11319 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11320 | [ALC262_BASIC] = "basic", |
| 11321 | [ALC262_HIPPO] = "hippo", |
| 11322 | [ALC262_HIPPO_1] = "hippo_1", |
| 11323 | [ALC262_FUJITSU] = "fujitsu", |
| 11324 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11325 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11326 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11327 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11328 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11329 | [ALC262_BENQ_T31] = "benq-t31", |
| 11330 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11331 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11332 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11333 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11334 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11335 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11336 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11337 | [ALC262_AUTO] = "auto", |
| 11338 | }; |
| 11339 | |
| 11340 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11341 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11342 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11343 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11344 | ALC262_HP_BPC), |
| 11345 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11346 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11347 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11348 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11349 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11350 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11351 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11352 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11353 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11354 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11355 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11356 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11357 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11358 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11359 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11360 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11361 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11362 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11363 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11364 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11365 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11366 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11367 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11368 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11369 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11370 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11371 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11372 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11373 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11374 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11375 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11376 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11377 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11378 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11379 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11380 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11381 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11382 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11383 | {} |
| 11384 | }; |
| 11385 | |
| 11386 | static struct alc_config_preset alc262_presets[] = { |
| 11387 | [ALC262_BASIC] = { |
| 11388 | .mixers = { alc262_base_mixer }, |
| 11389 | .init_verbs = { alc262_init_verbs }, |
| 11390 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11391 | .dac_nids = alc262_dac_nids, |
| 11392 | .hp_nid = 0x03, |
| 11393 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11394 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11395 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11396 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11397 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11398 | .mixers = { alc262_hippo_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11399 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 11400 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11401 | .dac_nids = alc262_dac_nids, |
| 11402 | .hp_nid = 0x03, |
| 11403 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11404 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11405 | .channel_mode = alc262_modes, |
| 11406 | .input_mux = &alc262_capture_source, |
| 11407 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11408 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11409 | }, |
| 11410 | [ALC262_HIPPO_1] = { |
| 11411 | .mixers = { alc262_hippo1_mixer }, |
| 11412 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11413 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11414 | .dac_nids = alc262_dac_nids, |
| 11415 | .hp_nid = 0x02, |
| 11416 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11417 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11418 | .channel_mode = alc262_modes, |
| 11419 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11420 | .unsol_event = alc262_hippo_unsol_event, |
| 11421 | .init_hook = alc262_hippo1_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11422 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11423 | [ALC262_FUJITSU] = { |
| 11424 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11425 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11426 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11427 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11428 | .dac_nids = alc262_dac_nids, |
| 11429 | .hp_nid = 0x03, |
| 11430 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11431 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11432 | .channel_mode = alc262_modes, |
| 11433 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11434 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11435 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11436 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11437 | [ALC262_HP_BPC] = { |
| 11438 | .mixers = { alc262_HP_BPC_mixer }, |
| 11439 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11440 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11441 | .dac_nids = alc262_dac_nids, |
| 11442 | .hp_nid = 0x03, |
| 11443 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11444 | .channel_mode = alc262_modes, |
| 11445 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11446 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11447 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11448 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11449 | [ALC262_HP_BPC_D7000_WF] = { |
| 11450 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11451 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11452 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11453 | .dac_nids = alc262_dac_nids, |
| 11454 | .hp_nid = 0x03, |
| 11455 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11456 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11457 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11458 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11459 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11460 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11461 | [ALC262_HP_BPC_D7000_WL] = { |
| 11462 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11463 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11464 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11465 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11466 | .dac_nids = alc262_dac_nids, |
| 11467 | .hp_nid = 0x03, |
| 11468 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11469 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11470 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11471 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11472 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11473 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11474 | [ALC262_HP_TC_T5735] = { |
| 11475 | .mixers = { alc262_hp_t5735_mixer }, |
| 11476 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11477 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11478 | .dac_nids = alc262_dac_nids, |
| 11479 | .hp_nid = 0x03, |
| 11480 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11481 | .channel_mode = alc262_modes, |
| 11482 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11483 | .unsol_event = alc_automute_amp_unsol_event, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11484 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11485 | }, |
| 11486 | [ALC262_HP_RP5700] = { |
| 11487 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11488 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11489 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11490 | .dac_nids = alc262_dac_nids, |
| 11491 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11492 | .channel_mode = alc262_modes, |
| 11493 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11494 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11495 | [ALC262_BENQ_ED8] = { |
| 11496 | .mixers = { alc262_base_mixer }, |
| 11497 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11498 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11499 | .dac_nids = alc262_dac_nids, |
| 11500 | .hp_nid = 0x03, |
| 11501 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11502 | .channel_mode = alc262_modes, |
| 11503 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11504 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11505 | [ALC262_SONY_ASSAMD] = { |
| 11506 | .mixers = { alc262_sony_mixer }, |
| 11507 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11508 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11509 | .dac_nids = alc262_dac_nids, |
| 11510 | .hp_nid = 0x02, |
| 11511 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11512 | .channel_mode = alc262_modes, |
| 11513 | .input_mux = &alc262_capture_source, |
| 11514 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11515 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11516 | }, |
| 11517 | [ALC262_BENQ_T31] = { |
| 11518 | .mixers = { alc262_benq_t31_mixer }, |
| 11519 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 11520 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11521 | .dac_nids = alc262_dac_nids, |
| 11522 | .hp_nid = 0x03, |
| 11523 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11524 | .channel_mode = alc262_modes, |
| 11525 | .input_mux = &alc262_capture_source, |
| 11526 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11527 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11528 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11529 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11530 | .mixers = { alc262_ultra_mixer }, |
| 11531 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11532 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11533 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11534 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11535 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11536 | .channel_mode = alc262_modes, |
| 11537 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11538 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11539 | .capsrc_nids = alc262_capsrc_nids, |
| 11540 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11541 | .unsol_event = alc262_ultra_unsol_event, |
| 11542 | .init_hook = alc262_ultra_automute, |
| 11543 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11544 | [ALC262_LENOVO_3000] = { |
| 11545 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11546 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11547 | alc262_lenovo_3000_unsol_verbs }, |
| 11548 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11549 | .dac_nids = alc262_dac_nids, |
| 11550 | .hp_nid = 0x03, |
| 11551 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11552 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11553 | .channel_mode = alc262_modes, |
| 11554 | .input_mux = &alc262_fujitsu_capture_source, |
| 11555 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11556 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11557 | [ALC262_NEC] = { |
| 11558 | .mixers = { alc262_nec_mixer }, |
| 11559 | .init_verbs = { alc262_nec_verbs }, |
| 11560 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11561 | .dac_nids = alc262_dac_nids, |
| 11562 | .hp_nid = 0x03, |
| 11563 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11564 | .channel_mode = alc262_modes, |
| 11565 | .input_mux = &alc262_capture_source, |
| 11566 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11567 | [ALC262_TOSHIBA_S06] = { |
| 11568 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11569 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11570 | alc262_eapd_verbs }, |
| 11571 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11572 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11573 | .dac_nids = alc262_dac_nids, |
| 11574 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11575 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11576 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11577 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11578 | .channel_mode = alc262_modes, |
| 11579 | .input_mux = &alc262_dmic_capture_source, |
| 11580 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11581 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11582 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11583 | [ALC262_TOSHIBA_RX1] = { |
| 11584 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11585 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11586 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11587 | .dac_nids = alc262_dac_nids, |
| 11588 | .hp_nid = 0x03, |
| 11589 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11590 | .channel_mode = alc262_modes, |
| 11591 | .input_mux = &alc262_capture_source, |
| 11592 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11593 | .init_hook = alc262_hippo_init_hook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11594 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11595 | [ALC262_TYAN] = { |
| 11596 | .mixers = { alc262_tyan_mixer }, |
| 11597 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11598 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11599 | .dac_nids = alc262_dac_nids, |
| 11600 | .hp_nid = 0x02, |
| 11601 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11602 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11603 | .channel_mode = alc262_modes, |
| 11604 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11605 | .unsol_event = alc_automute_amp_unsol_event, |
| 11606 | .init_hook = alc262_tyan_init_hook, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11607 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11608 | }; |
| 11609 | |
| 11610 | static int patch_alc262(struct hda_codec *codec) |
| 11611 | { |
| 11612 | struct alc_spec *spec; |
| 11613 | int board_config; |
| 11614 | int err; |
| 11615 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11616 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11617 | if (spec == NULL) |
| 11618 | return -ENOMEM; |
| 11619 | |
| 11620 | codec->spec = spec; |
| 11621 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11622 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11623 | * under-run |
| 11624 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11625 | { |
| 11626 | int tmp; |
| 11627 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11628 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11629 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11630 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11631 | } |
| 11632 | #endif |
| 11633 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11634 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11635 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11636 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11637 | alc262_models, |
| 11638 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11639 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11640 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 11641 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 11642 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11643 | board_config = ALC262_AUTO; |
| 11644 | } |
| 11645 | |
| 11646 | if (board_config == ALC262_AUTO) { |
| 11647 | /* automatic parse from the BIOS config */ |
| 11648 | err = alc262_parse_auto_config(codec); |
| 11649 | if (err < 0) { |
| 11650 | alc_free(codec); |
| 11651 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11652 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11653 | printk(KERN_INFO |
| 11654 | "hda_codec: Cannot set up configuration " |
| 11655 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11656 | board_config = ALC262_BASIC; |
| 11657 | } |
| 11658 | } |
| 11659 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11660 | if (!spec->no_analog) { |
| 11661 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11662 | if (err < 0) { |
| 11663 | alc_free(codec); |
| 11664 | return err; |
| 11665 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11666 | } |
| 11667 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11668 | if (board_config != ALC262_AUTO) |
| 11669 | setup_preset(spec, &alc262_presets[board_config]); |
| 11670 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11671 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11672 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11673 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11674 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11675 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11676 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11677 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11678 | int i; |
| 11679 | /* check whether the digital-mic has to be supported */ |
| 11680 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11681 | if (spec->input_mux->items[i].index >= 9) |
| 11682 | break; |
| 11683 | } |
| 11684 | if (i < spec->input_mux->num_items) { |
| 11685 | /* use only ADC0 */ |
| 11686 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11687 | spec->num_adc_nids = 1; |
| 11688 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11689 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11690 | /* all analog inputs */ |
| 11691 | /* check whether NID 0x07 is valid */ |
| 11692 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11693 | |
| 11694 | /* get type */ |
| 11695 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 11696 | if (wcap != AC_WID_AUD_IN) { |
| 11697 | spec->adc_nids = alc262_adc_nids_alt; |
| 11698 | spec->num_adc_nids = |
| 11699 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11700 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11701 | } else { |
| 11702 | spec->adc_nids = alc262_adc_nids; |
| 11703 | spec->num_adc_nids = |
| 11704 | ARRAY_SIZE(alc262_adc_nids); |
| 11705 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11706 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11707 | } |
| 11708 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11709 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11710 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11711 | if (!spec->no_analog) |
| 11712 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11713 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11714 | spec->vmaster_nid = 0x0c; |
| 11715 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11716 | codec->patch_ops = alc_patch_ops; |
| 11717 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11718 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11719 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11720 | if (!spec->loopback.amplist) |
| 11721 | spec->loopback.amplist = alc262_loopbacks; |
| 11722 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11723 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11724 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11725 | return 0; |
| 11726 | } |
| 11727 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11728 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11729 | * ALC268 channel source setting (2 channel) |
| 11730 | */ |
| 11731 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11732 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11733 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11734 | static hda_nid_t alc268_dac_nids[2] = { |
| 11735 | /* front, hp */ |
| 11736 | 0x02, 0x03 |
| 11737 | }; |
| 11738 | |
| 11739 | static hda_nid_t alc268_adc_nids[2] = { |
| 11740 | /* ADC0-1 */ |
| 11741 | 0x08, 0x07 |
| 11742 | }; |
| 11743 | |
| 11744 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11745 | /* ADC0 */ |
| 11746 | 0x08 |
| 11747 | }; |
| 11748 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11749 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11750 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11751 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11752 | /* output mixer control */ |
| 11753 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11754 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11755 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11756 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11757 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11758 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11759 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11760 | { } |
| 11761 | }; |
| 11762 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11763 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11764 | /* output mixer control */ |
| 11765 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11766 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11767 | ALC262_HIPPO_MASTER_SWITCH, |
| 11768 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11769 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11770 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11771 | { } |
| 11772 | }; |
| 11773 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11774 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11775 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11776 | .ops = &snd_hda_bind_sw, |
| 11777 | .values = { |
| 11778 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11779 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11780 | 0 |
| 11781 | }, |
| 11782 | }; |
| 11783 | |
| 11784 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11785 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11786 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11787 | { } |
| 11788 | }; |
| 11789 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11790 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11791 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11792 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11793 | { } |
| 11794 | }; |
| 11795 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11796 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11797 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11798 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11799 | { } /* end */ |
| 11800 | }; |
| 11801 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11802 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11803 | .num_items = 2, |
| 11804 | .items = { |
| 11805 | { "i-Mic", 0x6 }, |
| 11806 | { "E-Mic", 0x0 }, |
| 11807 | }, |
| 11808 | }; |
| 11809 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11810 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11811 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11812 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11813 | .ops = &snd_hda_bind_vol, |
| 11814 | .values = { |
| 11815 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11816 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11817 | 0 |
| 11818 | }, |
| 11819 | }; |
| 11820 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11821 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11822 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11823 | { |
| 11824 | struct alc_spec *spec = codec->spec; |
| 11825 | unsigned int mute; |
| 11826 | |
| 11827 | if (force || !spec->sense_updated) { |
| 11828 | unsigned int present; |
| 11829 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11830 | AC_VERB_GET_PIN_SENSE, 0); |
| 11831 | spec->jack_present = (present & 0x80000000) != 0; |
| 11832 | spec->sense_updated = 1; |
| 11833 | } |
| 11834 | if (spec->jack_present) |
| 11835 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11836 | else /* unmute internal speaker if necessary */ |
| 11837 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11838 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11839 | HDA_AMP_MUTE, mute); |
| 11840 | } |
| 11841 | |
| 11842 | |
| 11843 | /* bind hp and internal speaker mute (with plug check) */ |
| 11844 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11845 | struct snd_ctl_elem_value *ucontrol) |
| 11846 | { |
| 11847 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11848 | long *valp = ucontrol->value.integer.value; |
| 11849 | int change; |
| 11850 | |
| 11851 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11852 | HDA_AMP_MUTE, |
| 11853 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11854 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11855 | HDA_AMP_MUTE, |
| 11856 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11857 | if (change) |
| 11858 | alc268_acer_automute(codec, 0); |
| 11859 | return change; |
| 11860 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11861 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11862 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11863 | /* output mixer control */ |
| 11864 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11865 | { |
| 11866 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11867 | .name = "Master Playback Switch", |
| 11868 | .info = snd_hda_mixer_amp_switch_info, |
| 11869 | .get = snd_hda_mixer_amp_switch_get, |
| 11870 | .put = alc268_acer_master_sw_put, |
| 11871 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11872 | }, |
| 11873 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11874 | { } |
| 11875 | }; |
| 11876 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11877 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11878 | /* output mixer control */ |
| 11879 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11880 | { |
| 11881 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11882 | .name = "Master Playback Switch", |
| 11883 | .info = snd_hda_mixer_amp_switch_info, |
| 11884 | .get = snd_hda_mixer_amp_switch_get, |
| 11885 | .put = alc268_acer_master_sw_put, |
| 11886 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11887 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11888 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11889 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11890 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11891 | { } |
| 11892 | }; |
| 11893 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11894 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11895 | /* output mixer control */ |
| 11896 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11897 | { |
| 11898 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11899 | .name = "Master Playback Switch", |
| 11900 | .info = snd_hda_mixer_amp_switch_info, |
| 11901 | .get = snd_hda_mixer_amp_switch_get, |
| 11902 | .put = alc268_acer_master_sw_put, |
| 11903 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11904 | }, |
| 11905 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11906 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11907 | { } |
| 11908 | }; |
| 11909 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11910 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11911 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11912 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11913 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11914 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11915 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11916 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11917 | { } |
| 11918 | }; |
| 11919 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11920 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11921 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11922 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11923 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11924 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11925 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11926 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11927 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11928 | { } |
| 11929 | }; |
| 11930 | |
| 11931 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11932 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
| 11933 | #define alc268_toshiba_init_hook alc262_hippo_init_hook |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11934 | |
| 11935 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11936 | unsigned int res) |
| 11937 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11938 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11939 | return; |
| 11940 | alc268_acer_automute(codec, 1); |
| 11941 | } |
| 11942 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11943 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11944 | { |
| 11945 | alc268_acer_automute(codec, 1); |
| 11946 | } |
| 11947 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11948 | /* toggle speaker-output according to the hp-jack state */ |
| 11949 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11950 | { |
| 11951 | unsigned int present; |
| 11952 | unsigned char bits; |
| 11953 | |
| 11954 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11955 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11956 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11957 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11958 | AMP_IN_MUTE(0), bits); |
| 11959 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11960 | AMP_IN_MUTE(0), bits); |
| 11961 | } |
| 11962 | |
| 11963 | |
| 11964 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11965 | { |
| 11966 | unsigned int present; |
| 11967 | |
| 11968 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11969 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11970 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11971 | present ? 0x0 : 0x6); |
| 11972 | } |
| 11973 | |
| 11974 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11975 | unsigned int res) |
| 11976 | { |
| 11977 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11978 | alc268_aspire_one_speaker_automute(codec); |
| 11979 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11980 | alc268_acer_mic_automute(codec); |
| 11981 | } |
| 11982 | |
| 11983 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11984 | { |
| 11985 | alc268_aspire_one_speaker_automute(codec); |
| 11986 | alc268_acer_mic_automute(codec); |
| 11987 | } |
| 11988 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11989 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11990 | /* output mixer control */ |
| 11991 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11992 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11993 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11994 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11995 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11996 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11997 | { } |
| 11998 | }; |
| 11999 | |
| 12000 | static struct hda_verb alc268_dell_verbs[] = { |
| 12001 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12002 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12003 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12004 | { } |
| 12005 | }; |
| 12006 | |
| 12007 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12008 | static void alc268_dell_init_hook(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12009 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12010 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12011 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12012 | spec->autocfg.hp_pins[0] = 0x15; |
| 12013 | spec->autocfg.speaker_pins[0] = 0x14; |
| 12014 | alc_automute_pin(codec); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12015 | } |
| 12016 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12017 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12018 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12019 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12020 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12021 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12022 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12023 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12024 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12025 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12026 | { } |
| 12027 | }; |
| 12028 | |
| 12029 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12030 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12031 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12032 | { } |
| 12033 | }; |
| 12034 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12035 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 12036 | { |
| 12037 | unsigned int present; |
| 12038 | |
| 12039 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12040 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12041 | snd_hda_codec_write(codec, 0x23, 0, |
| 12042 | AC_VERB_SET_CONNECT_SEL, |
| 12043 | present ? 0x00 : 0x01); |
| 12044 | } |
| 12045 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12046 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12047 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12048 | struct alc_spec *spec = codec->spec; |
| 12049 | |
| 12050 | spec->autocfg.hp_pins[0] = 0x15; |
| 12051 | spec->autocfg.speaker_pins[0] = 0x14; |
| 12052 | alc_automute_pin(codec); |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12053 | alc267_quanta_il1_mic_automute(codec); |
| 12054 | } |
| 12055 | |
| 12056 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 12057 | unsigned int res) |
| 12058 | { |
| 12059 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12060 | case ALC880_MIC_EVENT: |
| 12061 | alc267_quanta_il1_mic_automute(codec); |
| 12062 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12063 | default: |
| 12064 | alc_sku_unsol_event(codec, res); |
| 12065 | break; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12066 | } |
| 12067 | } |
| 12068 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12069 | /* |
| 12070 | * generic initialization of ADC, input mixers and output mixers |
| 12071 | */ |
| 12072 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12073 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12074 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12075 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12076 | |
| 12077 | /* |
| 12078 | * Set up output mixers (0x0c - 0x0e) |
| 12079 | */ |
| 12080 | /* set vol=0 to output mixers */ |
| 12081 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12082 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12083 | |
| 12084 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12085 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12086 | |
| 12087 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12088 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12089 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12090 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12091 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12092 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12093 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12094 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12095 | |
| 12096 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12097 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12098 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12099 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12100 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12101 | |
| 12102 | /* set PCBEEP vol = 0, mute connections */ |
| 12103 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12104 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12105 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12106 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12107 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12108 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12109 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12110 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12111 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12112 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12113 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12114 | { } |
| 12115 | }; |
| 12116 | |
| 12117 | /* |
| 12118 | * generic initialization of ADC, input mixers and output mixers |
| 12119 | */ |
| 12120 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12121 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12122 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12123 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12124 | |
| 12125 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12126 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12127 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12128 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12129 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12130 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12131 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12132 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12133 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12134 | |
| 12135 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12136 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12137 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12138 | /* set PCBEEP vol = 0, mute connections */ |
| 12139 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12140 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12141 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12142 | |
| 12143 | { } |
| 12144 | }; |
| 12145 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12146 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12147 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12148 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12149 | { |
| 12150 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12151 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12152 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12153 | */ |
| 12154 | /* .name = "Capture Source", */ |
| 12155 | .name = "Input Source", |
| 12156 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12157 | .info = alc_mux_enum_info, |
| 12158 | .get = alc_mux_enum_get, |
| 12159 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12160 | }, |
| 12161 | { } /* end */ |
| 12162 | }; |
| 12163 | |
| 12164 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12165 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12166 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12167 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12168 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12169 | { |
| 12170 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12171 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12172 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12173 | */ |
| 12174 | /* .name = "Capture Source", */ |
| 12175 | .name = "Input Source", |
| 12176 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12177 | .info = alc_mux_enum_info, |
| 12178 | .get = alc_mux_enum_get, |
| 12179 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12180 | }, |
| 12181 | { } /* end */ |
| 12182 | }; |
| 12183 | |
| 12184 | static struct hda_input_mux alc268_capture_source = { |
| 12185 | .num_items = 4, |
| 12186 | .items = { |
| 12187 | { "Mic", 0x0 }, |
| 12188 | { "Front Mic", 0x1 }, |
| 12189 | { "Line", 0x2 }, |
| 12190 | { "CD", 0x3 }, |
| 12191 | }, |
| 12192 | }; |
| 12193 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12194 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12195 | .num_items = 3, |
| 12196 | .items = { |
| 12197 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12198 | { "Internal Mic", 0x1 }, |
| 12199 | { "Line", 0x2 }, |
| 12200 | }, |
| 12201 | }; |
| 12202 | |
| 12203 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12204 | .num_items = 3, |
| 12205 | .items = { |
| 12206 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12207 | { "Internal Mic", 0x6 }, |
| 12208 | { "Line", 0x2 }, |
| 12209 | }, |
| 12210 | }; |
| 12211 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12212 | #ifdef CONFIG_SND_DEBUG |
| 12213 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12214 | /* Volume widgets */ |
| 12215 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12216 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12217 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12218 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12219 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12220 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12221 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12222 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12223 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12224 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12225 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12226 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12227 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12228 | /* The below appears problematic on some hardwares */ |
| 12229 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12230 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12231 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12232 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12233 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12234 | |
| 12235 | /* Modes for retasking pin widgets */ |
| 12236 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12237 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12238 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12239 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12240 | |
| 12241 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12242 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12243 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12244 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12245 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12246 | |
| 12247 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12248 | * The ALC268 does not have an SPDIF input. |
| 12249 | */ |
| 12250 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12251 | |
| 12252 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12253 | * this output to turn on an external amplifier. |
| 12254 | */ |
| 12255 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12256 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12257 | |
| 12258 | { } /* end */ |
| 12259 | }; |
| 12260 | #endif |
| 12261 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12262 | /* create input playback/capture controls for the given pin */ |
| 12263 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12264 | const char *ctlname, int idx) |
| 12265 | { |
| 12266 | char name[32]; |
| 12267 | int err; |
| 12268 | |
| 12269 | sprintf(name, "%s Playback Volume", ctlname); |
| 12270 | if (nid == 0x14) { |
| 12271 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12272 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 12273 | HDA_OUTPUT)); |
| 12274 | if (err < 0) |
| 12275 | return err; |
| 12276 | } else if (nid == 0x15) { |
| 12277 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12278 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 12279 | HDA_OUTPUT)); |
| 12280 | if (err < 0) |
| 12281 | return err; |
| 12282 | } else |
| 12283 | return -1; |
| 12284 | sprintf(name, "%s Playback Switch", ctlname); |
| 12285 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12286 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 12287 | if (err < 0) |
| 12288 | return err; |
| 12289 | return 0; |
| 12290 | } |
| 12291 | |
| 12292 | /* add playback controls from the parsed DAC table */ |
| 12293 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12294 | const struct auto_pin_cfg *cfg) |
| 12295 | { |
| 12296 | hda_nid_t nid; |
| 12297 | int err; |
| 12298 | |
| 12299 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 12300 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12301 | spec->multiout.dac_nids[0] = 2; |
| 12302 | spec->multiout.dac_nids[1] = 3; |
| 12303 | |
| 12304 | nid = cfg->line_out_pins[0]; |
| 12305 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12306 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12307 | |
| 12308 | nid = cfg->speaker_pins[0]; |
| 12309 | if (nid == 0x1d) { |
| 12310 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12311 | "Speaker Playback Volume", |
| 12312 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12313 | if (err < 0) |
| 12314 | return err; |
| 12315 | } |
| 12316 | nid = cfg->hp_pins[0]; |
| 12317 | if (nid) |
| 12318 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12319 | |
| 12320 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12321 | if (nid == 0x16) { |
| 12322 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12323 | "Mono Playback Switch", |
| 12324 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 12325 | if (err < 0) |
| 12326 | return err; |
| 12327 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12328 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12329 | } |
| 12330 | |
| 12331 | /* create playback/capture controls for input pins */ |
| 12332 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12333 | const struct auto_pin_cfg *cfg) |
| 12334 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12335 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12336 | int i, idx1; |
| 12337 | |
| 12338 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12339 | switch(cfg->input_pins[i]) { |
| 12340 | case 0x18: |
| 12341 | idx1 = 0; /* Mic 1 */ |
| 12342 | break; |
| 12343 | case 0x19: |
| 12344 | idx1 = 1; /* Mic 2 */ |
| 12345 | break; |
| 12346 | case 0x1a: |
| 12347 | idx1 = 2; /* Line In */ |
| 12348 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12349 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12350 | idx1 = 3; /* CD */ |
| 12351 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 12352 | case 0x12: |
| 12353 | case 0x13: |
| 12354 | idx1 = 6; /* digital mics */ |
| 12355 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12356 | default: |
| 12357 | continue; |
| 12358 | } |
| 12359 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 12360 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12361 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12362 | } |
| 12363 | return 0; |
| 12364 | } |
| 12365 | |
| 12366 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12367 | { |
| 12368 | struct alc_spec *spec = codec->spec; |
| 12369 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12370 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12371 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12372 | unsigned int dac_vol1, dac_vol2; |
| 12373 | |
| 12374 | if (speaker_nid) { |
| 12375 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12376 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 12377 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12378 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12379 | AMP_IN_UNMUTE(1)); |
| 12380 | snd_hda_codec_write(codec, 0x10, 0, |
| 12381 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12382 | AMP_IN_UNMUTE(1)); |
| 12383 | } else { |
| 12384 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12385 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12386 | snd_hda_codec_write(codec, 0x10, 0, |
| 12387 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12388 | } |
| 12389 | |
| 12390 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12391 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12392 | dac_vol2 = AMP_OUT_ZERO; |
| 12393 | else if (line_nid == 0x15) |
| 12394 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12395 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12396 | dac_vol2 = AMP_OUT_ZERO; |
| 12397 | else if (hp_nid == 0x15) |
| 12398 | dac_vol1 = AMP_OUT_ZERO; |
| 12399 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12400 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12401 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12402 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12403 | |
| 12404 | snd_hda_codec_write(codec, 0x02, 0, |
| 12405 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12406 | snd_hda_codec_write(codec, 0x03, 0, |
| 12407 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12408 | } |
| 12409 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12410 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12411 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12412 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12413 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12414 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12415 | |
| 12416 | /* |
| 12417 | * BIOS auto configuration |
| 12418 | */ |
| 12419 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12420 | { |
| 12421 | struct alc_spec *spec = codec->spec; |
| 12422 | int err; |
| 12423 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12424 | |
| 12425 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12426 | alc268_ignore); |
| 12427 | if (err < 0) |
| 12428 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12429 | if (!spec->autocfg.line_outs) { |
| 12430 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12431 | spec->multiout.max_channels = 2; |
| 12432 | spec->no_analog = 1; |
| 12433 | goto dig_only; |
| 12434 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12435 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12436 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12437 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12438 | if (err < 0) |
| 12439 | return err; |
| 12440 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12441 | if (err < 0) |
| 12442 | return err; |
| 12443 | |
| 12444 | spec->multiout.max_channels = 2; |
| 12445 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12446 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12447 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12448 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12449 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12450 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12451 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12452 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12453 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12454 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12455 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12456 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12457 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12458 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12459 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12460 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12461 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12462 | err = alc_auto_add_mic_boost(codec); |
| 12463 | if (err < 0) |
| 12464 | return err; |
| 12465 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12466 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12467 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12468 | return 1; |
| 12469 | } |
| 12470 | |
| 12471 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12472 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12473 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12474 | |
| 12475 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12476 | static void alc268_auto_init(struct hda_codec *codec) |
| 12477 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12478 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12479 | alc268_auto_init_multi_out(codec); |
| 12480 | alc268_auto_init_hp_out(codec); |
| 12481 | alc268_auto_init_mono_speaker_out(codec); |
| 12482 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12483 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12484 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12485 | } |
| 12486 | |
| 12487 | /* |
| 12488 | * configuration and preset |
| 12489 | */ |
| 12490 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12491 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12492 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12493 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12494 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12495 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12496 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12497 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12498 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12499 | #ifdef CONFIG_SND_DEBUG |
| 12500 | [ALC268_TEST] = "test", |
| 12501 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12502 | [ALC268_AUTO] = "auto", |
| 12503 | }; |
| 12504 | |
| 12505 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12506 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12507 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12508 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12509 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12510 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12511 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12512 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12513 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12514 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12515 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
| 12516 | ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12517 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12518 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
| 12519 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12520 | ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12521 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12522 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12523 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12524 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12525 | {} |
| 12526 | }; |
| 12527 | |
| 12528 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12529 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12530 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12531 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12532 | alc267_quanta_il1_verbs }, |
| 12533 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12534 | .dac_nids = alc268_dac_nids, |
| 12535 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12536 | .adc_nids = alc268_adc_nids_alt, |
| 12537 | .hp_nid = 0x03, |
| 12538 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12539 | .channel_mode = alc268_modes, |
| 12540 | .input_mux = &alc268_capture_source, |
| 12541 | .unsol_event = alc267_quanta_il1_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12542 | .init_hook = alc267_quanta_il1_init_hook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12543 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12544 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12545 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12546 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12547 | .init_verbs = { alc268_base_init_verbs }, |
| 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 | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12553 | .hp_nid = 0x03, |
| 12554 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12555 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12556 | .channel_mode = alc268_modes, |
| 12557 | .input_mux = &alc268_capture_source, |
| 12558 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12559 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12560 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12561 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12562 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12563 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12564 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12565 | .dac_nids = alc268_dac_nids, |
| 12566 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12567 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12568 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12569 | .hp_nid = 0x03, |
| 12570 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12571 | .channel_mode = alc268_modes, |
| 12572 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12573 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12574 | .init_hook = alc268_toshiba_init_hook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12575 | }, |
| 12576 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12577 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12578 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12579 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12580 | alc268_acer_verbs }, |
| 12581 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12582 | .dac_nids = alc268_dac_nids, |
| 12583 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12584 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12585 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12586 | .hp_nid = 0x02, |
| 12587 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12588 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12589 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12590 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12591 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12592 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12593 | [ALC268_ACER_DMIC] = { |
| 12594 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12595 | alc268_beep_mixer }, |
| 12596 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12597 | alc268_acer_verbs }, |
| 12598 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12599 | .dac_nids = alc268_dac_nids, |
| 12600 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12601 | .adc_nids = alc268_adc_nids_alt, |
| 12602 | .capsrc_nids = alc268_capsrc_nids, |
| 12603 | .hp_nid = 0x02, |
| 12604 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12605 | .channel_mode = alc268_modes, |
| 12606 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12607 | .unsol_event = alc268_acer_unsol_event, |
| 12608 | .init_hook = alc268_acer_init_hook, |
| 12609 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12610 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12611 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12612 | alc268_beep_mixer, |
| 12613 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12614 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12615 | alc268_acer_aspire_one_verbs }, |
| 12616 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12617 | .dac_nids = alc268_dac_nids, |
| 12618 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12619 | .adc_nids = alc268_adc_nids_alt, |
| 12620 | .capsrc_nids = alc268_capsrc_nids, |
| 12621 | .hp_nid = 0x03, |
| 12622 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12623 | .channel_mode = alc268_modes, |
| 12624 | .input_mux = &alc268_acer_lc_capture_source, |
| 12625 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12626 | .init_hook = alc268_acer_lc_init_hook, |
| 12627 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12628 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12629 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12630 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12631 | alc268_dell_verbs }, |
| 12632 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12633 | .dac_nids = alc268_dac_nids, |
| 12634 | .hp_nid = 0x02, |
| 12635 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12636 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12637 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12638 | .init_hook = alc268_dell_init_hook, |
| 12639 | .input_mux = &alc268_capture_source, |
| 12640 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12641 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12642 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12643 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12644 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12645 | alc268_toshiba_verbs }, |
| 12646 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12647 | .dac_nids = alc268_dac_nids, |
| 12648 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12649 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12650 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12651 | .hp_nid = 0x03, |
| 12652 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12653 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12654 | .channel_mode = alc268_modes, |
| 12655 | .input_mux = &alc268_capture_source, |
| 12656 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12657 | .init_hook = alc268_toshiba_init_hook |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12658 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12659 | #ifdef CONFIG_SND_DEBUG |
| 12660 | [ALC268_TEST] = { |
| 12661 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12662 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12663 | alc268_volume_init_verbs }, |
| 12664 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12665 | .dac_nids = alc268_dac_nids, |
| 12666 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12667 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12668 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12669 | .hp_nid = 0x03, |
| 12670 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12671 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12672 | .channel_mode = alc268_modes, |
| 12673 | .input_mux = &alc268_capture_source, |
| 12674 | }, |
| 12675 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12676 | }; |
| 12677 | |
| 12678 | static int patch_alc268(struct hda_codec *codec) |
| 12679 | { |
| 12680 | struct alc_spec *spec; |
| 12681 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12682 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12683 | |
| 12684 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12685 | if (spec == NULL) |
| 12686 | return -ENOMEM; |
| 12687 | |
| 12688 | codec->spec = spec; |
| 12689 | |
| 12690 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12691 | alc268_models, |
| 12692 | alc268_cfg_tbl); |
| 12693 | |
| 12694 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 12695 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 12696 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12697 | board_config = ALC268_AUTO; |
| 12698 | } |
| 12699 | |
| 12700 | if (board_config == ALC268_AUTO) { |
| 12701 | /* automatic parse from the BIOS config */ |
| 12702 | err = alc268_parse_auto_config(codec); |
| 12703 | if (err < 0) { |
| 12704 | alc_free(codec); |
| 12705 | return err; |
| 12706 | } else if (!err) { |
| 12707 | printk(KERN_INFO |
| 12708 | "hda_codec: Cannot set up configuration " |
| 12709 | "from BIOS. Using base mode...\n"); |
| 12710 | board_config = ALC268_3ST; |
| 12711 | } |
| 12712 | } |
| 12713 | |
| 12714 | if (board_config != ALC268_AUTO) |
| 12715 | setup_preset(spec, &alc268_presets[board_config]); |
| 12716 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12717 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12718 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12719 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12720 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12721 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12722 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12723 | has_beep = 0; |
| 12724 | for (i = 0; i < spec->num_mixers; i++) { |
| 12725 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12726 | has_beep = 1; |
| 12727 | break; |
| 12728 | } |
| 12729 | } |
| 12730 | |
| 12731 | if (has_beep) { |
| 12732 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12733 | if (err < 0) { |
| 12734 | alc_free(codec); |
| 12735 | return err; |
| 12736 | } |
| 12737 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12738 | /* override the amp caps for beep generator */ |
| 12739 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12740 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12741 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12742 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12743 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12744 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12745 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12746 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12747 | /* check whether NID 0x07 is valid */ |
| 12748 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12749 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12750 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12751 | /* get type */ |
| 12752 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12753 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12754 | spec->adc_nids = alc268_adc_nids_alt; |
| 12755 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12756 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12757 | } else { |
| 12758 | spec->adc_nids = alc268_adc_nids; |
| 12759 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12760 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12761 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12762 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12763 | /* set default input source */ |
| 12764 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12765 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12766 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12767 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12768 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12769 | |
| 12770 | spec->vmaster_nid = 0x02; |
| 12771 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12772 | codec->patch_ops = alc_patch_ops; |
| 12773 | if (board_config == ALC268_AUTO) |
| 12774 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12775 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12776 | codec->proc_widget_hook = print_realtek_coef; |
| 12777 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12778 | return 0; |
| 12779 | } |
| 12780 | |
| 12781 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12782 | * ALC269 channel source setting (2 channel) |
| 12783 | */ |
| 12784 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12785 | |
| 12786 | #define alc269_dac_nids alc260_dac_nids |
| 12787 | |
| 12788 | static hda_nid_t alc269_adc_nids[1] = { |
| 12789 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12790 | 0x08, |
| 12791 | }; |
| 12792 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12793 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12794 | 0x23, |
| 12795 | }; |
| 12796 | |
| 12797 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12798 | * not a mux! |
| 12799 | */ |
| 12800 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12801 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12802 | .num_items = 2, |
| 12803 | .items = { |
| 12804 | { "i-Mic", 0x5 }, |
| 12805 | { "e-Mic", 0x0 }, |
| 12806 | }, |
| 12807 | }; |
| 12808 | |
| 12809 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12810 | .num_items = 2, |
| 12811 | .items = { |
| 12812 | { "i-Mic", 0x1 }, |
| 12813 | { "e-Mic", 0x0 }, |
| 12814 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12815 | }; |
| 12816 | |
| 12817 | #define alc269_modes alc260_modes |
| 12818 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12819 | |
| 12820 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12821 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12822 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12823 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12824 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12825 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12826 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12827 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12828 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12829 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12830 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12831 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12832 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12833 | { } /* end */ |
| 12834 | }; |
| 12835 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12836 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12837 | /* output mixer control */ |
| 12838 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12839 | { |
| 12840 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12841 | .name = "Master Playback Switch", |
| 12842 | .info = snd_hda_mixer_amp_switch_info, |
| 12843 | .get = snd_hda_mixer_amp_switch_get, |
| 12844 | .put = alc268_acer_master_sw_put, |
| 12845 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12846 | }, |
| 12847 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12848 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12849 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12850 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12851 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12852 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12853 | { } |
| 12854 | }; |
| 12855 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12856 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12857 | /* output mixer control */ |
| 12858 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12859 | { |
| 12860 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12861 | .name = "Master Playback Switch", |
| 12862 | .info = snd_hda_mixer_amp_switch_info, |
| 12863 | .get = snd_hda_mixer_amp_switch_get, |
| 12864 | .put = alc268_acer_master_sw_put, |
| 12865 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12866 | }, |
| 12867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12869 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12870 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12871 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12872 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12873 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12874 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12875 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12876 | { } |
| 12877 | }; |
| 12878 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12879 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame^] | 12880 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12881 | HDA_CODEC_MUTE("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12882 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12883 | HDA_CODEC_MUTE("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12884 | { } /* end */ |
| 12885 | }; |
| 12886 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12887 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12888 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12889 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12890 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12891 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12892 | { } /* end */ |
| 12893 | }; |
| 12894 | |
| 12895 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame^] | 12896 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12897 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12898 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12899 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12900 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12901 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12902 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12903 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12904 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12905 | { } |
| 12906 | }; |
| 12907 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12908 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12909 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12910 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12911 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12912 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12913 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12914 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12915 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12916 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12917 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12918 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12919 | { } |
| 12920 | }; |
| 12921 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12922 | /* toggle speaker-output according to the hp-jack state */ |
| 12923 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12924 | { |
| 12925 | unsigned int present; |
| 12926 | unsigned char bits; |
| 12927 | |
| 12928 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12929 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12930 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12931 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12932 | AMP_IN_MUTE(0), bits); |
| 12933 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12934 | AMP_IN_MUTE(0), bits); |
| 12935 | |
| 12936 | snd_hda_codec_write(codec, 0x20, 0, |
| 12937 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12938 | snd_hda_codec_write(codec, 0x20, 0, |
| 12939 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12940 | |
| 12941 | snd_hda_codec_write(codec, 0x20, 0, |
| 12942 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12943 | snd_hda_codec_write(codec, 0x20, 0, |
| 12944 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12945 | } |
| 12946 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12947 | /* toggle speaker-output according to the hp-jacks state */ |
| 12948 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12949 | { |
| 12950 | unsigned int present; |
| 12951 | unsigned char bits; |
| 12952 | |
| 12953 | /* Check laptop headphone socket */ |
| 12954 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12955 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12956 | |
| 12957 | /* Check port replicator headphone socket */ |
| 12958 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12959 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12960 | |
| 12961 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12962 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12963 | AMP_IN_MUTE(0), bits); |
| 12964 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12965 | AMP_IN_MUTE(0), bits); |
| 12966 | |
| 12967 | snd_hda_codec_write(codec, 0x20, 0, |
| 12968 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12969 | snd_hda_codec_write(codec, 0x20, 0, |
| 12970 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12971 | |
| 12972 | snd_hda_codec_write(codec, 0x20, 0, |
| 12973 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12974 | snd_hda_codec_write(codec, 0x20, 0, |
| 12975 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12976 | } |
| 12977 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12978 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12979 | { |
| 12980 | unsigned int present; |
| 12981 | |
| 12982 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12983 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12984 | snd_hda_codec_write(codec, 0x23, 0, |
| 12985 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12986 | } |
| 12987 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12988 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12989 | { |
| 12990 | unsigned int present_laptop; |
| 12991 | unsigned int present_dock; |
| 12992 | |
| 12993 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12994 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12995 | |
| 12996 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12997 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12998 | |
| 12999 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13000 | if (present_dock) |
| 13001 | snd_hda_codec_write(codec, 0x23, 0, |
| 13002 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13003 | if (present_laptop) |
| 13004 | snd_hda_codec_write(codec, 0x23, 0, |
| 13005 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13006 | if (!present_dock && !present_laptop) |
| 13007 | snd_hda_codec_write(codec, 0x23, 0, |
| 13008 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13009 | } |
| 13010 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13011 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13012 | unsigned int res) |
| 13013 | { |
| 13014 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13015 | alc269_quanta_fl1_speaker_automute(codec); |
| 13016 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13017 | alc269_quanta_fl1_mic_automute(codec); |
| 13018 | } |
| 13019 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13020 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13021 | unsigned int res) |
| 13022 | { |
| 13023 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13024 | alc269_lifebook_speaker_automute(codec); |
| 13025 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13026 | alc269_lifebook_mic_autoswitch(codec); |
| 13027 | } |
| 13028 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13029 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13030 | { |
| 13031 | alc269_quanta_fl1_speaker_automute(codec); |
| 13032 | alc269_quanta_fl1_mic_automute(codec); |
| 13033 | } |
| 13034 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13035 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13036 | { |
| 13037 | alc269_lifebook_speaker_automute(codec); |
| 13038 | alc269_lifebook_mic_autoswitch(codec); |
| 13039 | } |
| 13040 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13041 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 13042 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13043 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13044 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13045 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13046 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13047 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13048 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13049 | {} |
| 13050 | }; |
| 13051 | |
| 13052 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 13053 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13054 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13055 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13056 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13057 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13058 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13059 | {} |
| 13060 | }; |
| 13061 | |
| 13062 | /* toggle speaker-output according to the hp-jack state */ |
| 13063 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13064 | { |
| 13065 | unsigned int present; |
| 13066 | unsigned char bits; |
| 13067 | |
| 13068 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13069 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13070 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13071 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13072 | AMP_IN_MUTE(0), bits); |
| 13073 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13074 | AMP_IN_MUTE(0), bits); |
| 13075 | } |
| 13076 | |
| 13077 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 13078 | { |
| 13079 | unsigned int present; |
| 13080 | |
| 13081 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13082 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13083 | snd_hda_codec_write(codec, 0x23, 0, |
| 13084 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 13085 | } |
| 13086 | |
| 13087 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 13088 | { |
| 13089 | unsigned int present; |
| 13090 | |
| 13091 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13092 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13093 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13094 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13095 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13096 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13097 | } |
| 13098 | |
| 13099 | /* unsolicited event for HP jack sensing */ |
| 13100 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 13101 | unsigned int res) |
| 13102 | { |
| 13103 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13104 | alc269_speaker_automute(codec); |
| 13105 | |
| 13106 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13107 | alc269_eeepc_dmic_automute(codec); |
| 13108 | } |
| 13109 | |
| 13110 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 13111 | { |
| 13112 | alc269_speaker_automute(codec); |
| 13113 | alc269_eeepc_dmic_automute(codec); |
| 13114 | } |
| 13115 | |
| 13116 | /* unsolicited event for HP jack sensing */ |
| 13117 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 13118 | unsigned int res) |
| 13119 | { |
| 13120 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13121 | alc269_speaker_automute(codec); |
| 13122 | |
| 13123 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13124 | alc269_eeepc_amic_automute(codec); |
| 13125 | } |
| 13126 | |
| 13127 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 13128 | { |
| 13129 | alc269_speaker_automute(codec); |
| 13130 | alc269_eeepc_amic_automute(codec); |
| 13131 | } |
| 13132 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13133 | /* |
| 13134 | * generic initialization of ADC, input mixers and output mixers |
| 13135 | */ |
| 13136 | static struct hda_verb alc269_init_verbs[] = { |
| 13137 | /* |
| 13138 | * Unmute ADC0 and set the default input to mic-in |
| 13139 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13140 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13141 | |
| 13142 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 13143 | * analog-loopback mixer widget |
| 13144 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 13145 | * front panel mic (mic 2) |
| 13146 | */ |
| 13147 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 13148 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13149 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13150 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13151 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13152 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13153 | |
| 13154 | /* |
| 13155 | * Set up output mixers (0x0c - 0x0e) |
| 13156 | */ |
| 13157 | /* set vol=0 to output mixers */ |
| 13158 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13159 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13160 | |
| 13161 | /* set up input amps for analog loopback */ |
| 13162 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13163 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13164 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13165 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13166 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13167 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13168 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13169 | |
| 13170 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13171 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13172 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13173 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13174 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13175 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13176 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13177 | |
| 13178 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13179 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13180 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13181 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13182 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13183 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13184 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13185 | |
| 13186 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13187 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13188 | |
| 13189 | /* FIXME: use matrix-type input source selection */ |
| 13190 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13191 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13192 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13193 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13194 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13195 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13196 | |
| 13197 | /* set EAPD */ |
| 13198 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13199 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13200 | { } |
| 13201 | }; |
| 13202 | |
| 13203 | /* add playback controls from the parsed DAC table */ |
| 13204 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13205 | const struct auto_pin_cfg *cfg) |
| 13206 | { |
| 13207 | hda_nid_t nid; |
| 13208 | int err; |
| 13209 | |
| 13210 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 13211 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13212 | spec->multiout.dac_nids[0] = 2; |
| 13213 | |
| 13214 | nid = cfg->line_out_pins[0]; |
| 13215 | if (nid) { |
| 13216 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13217 | "Front Playback Volume", |
| 13218 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 13219 | if (err < 0) |
| 13220 | return err; |
| 13221 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13222 | "Front Playback Switch", |
| 13223 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13224 | if (err < 0) |
| 13225 | return err; |
| 13226 | } |
| 13227 | |
| 13228 | nid = cfg->speaker_pins[0]; |
| 13229 | if (nid) { |
| 13230 | if (!cfg->line_out_pins[0]) { |
| 13231 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13232 | "Speaker Playback Volume", |
| 13233 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13234 | HDA_OUTPUT)); |
| 13235 | if (err < 0) |
| 13236 | return err; |
| 13237 | } |
| 13238 | if (nid == 0x16) { |
| 13239 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13240 | "Speaker Playback Switch", |
| 13241 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13242 | HDA_OUTPUT)); |
| 13243 | if (err < 0) |
| 13244 | return err; |
| 13245 | } else { |
| 13246 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13247 | "Speaker Playback Switch", |
| 13248 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13249 | HDA_OUTPUT)); |
| 13250 | if (err < 0) |
| 13251 | return err; |
| 13252 | } |
| 13253 | } |
| 13254 | nid = cfg->hp_pins[0]; |
| 13255 | if (nid) { |
| 13256 | /* spec->multiout.hp_nid = 2; */ |
| 13257 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 13258 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13259 | "Headphone Playback Volume", |
| 13260 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13261 | HDA_OUTPUT)); |
| 13262 | if (err < 0) |
| 13263 | return err; |
| 13264 | } |
| 13265 | if (nid == 0x16) { |
| 13266 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13267 | "Headphone Playback Switch", |
| 13268 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13269 | HDA_OUTPUT)); |
| 13270 | if (err < 0) |
| 13271 | return err; |
| 13272 | } else { |
| 13273 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13274 | "Headphone Playback Switch", |
| 13275 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13276 | HDA_OUTPUT)); |
| 13277 | if (err < 0) |
| 13278 | return err; |
| 13279 | } |
| 13280 | } |
| 13281 | return 0; |
| 13282 | } |
| 13283 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13284 | #define alc269_auto_create_analog_input_ctls \ |
| 13285 | alc262_auto_create_analog_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13286 | |
| 13287 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13288 | #define alc269_loopbacks alc880_loopbacks |
| 13289 | #endif |
| 13290 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13291 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13292 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13293 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13294 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13295 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13296 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13297 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13298 | .substreams = 1, |
| 13299 | .channels_min = 2, |
| 13300 | .channels_max = 8, |
| 13301 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13302 | /* NID is set in alc_build_pcms */ |
| 13303 | .ops = { |
| 13304 | .open = alc880_playback_pcm_open, |
| 13305 | .prepare = alc880_playback_pcm_prepare, |
| 13306 | .cleanup = alc880_playback_pcm_cleanup |
| 13307 | }, |
| 13308 | }; |
| 13309 | |
| 13310 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13311 | .substreams = 1, |
| 13312 | .channels_min = 2, |
| 13313 | .channels_max = 2, |
| 13314 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13315 | /* NID is set in alc_build_pcms */ |
| 13316 | }; |
| 13317 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13318 | /* |
| 13319 | * BIOS auto configuration |
| 13320 | */ |
| 13321 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13322 | { |
| 13323 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13324 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13325 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13326 | |
| 13327 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13328 | alc269_ignore); |
| 13329 | if (err < 0) |
| 13330 | return err; |
| 13331 | |
| 13332 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13333 | if (err < 0) |
| 13334 | return err; |
| 13335 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13336 | if (err < 0) |
| 13337 | return err; |
| 13338 | |
| 13339 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13340 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13341 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13342 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13343 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13344 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13345 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13346 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13347 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13348 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13349 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13350 | /* set default input source */ |
| 13351 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13352 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13353 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13354 | |
| 13355 | err = alc_auto_add_mic_boost(codec); |
| 13356 | if (err < 0) |
| 13357 | return err; |
| 13358 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13359 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13360 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13361 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13362 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13363 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13364 | return 1; |
| 13365 | } |
| 13366 | |
| 13367 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 13368 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 13369 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13370 | |
| 13371 | |
| 13372 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13373 | static void alc269_auto_init(struct hda_codec *codec) |
| 13374 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13375 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13376 | alc269_auto_init_multi_out(codec); |
| 13377 | alc269_auto_init_hp_out(codec); |
| 13378 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13379 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13380 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13381 | } |
| 13382 | |
| 13383 | /* |
| 13384 | * configuration and preset |
| 13385 | */ |
| 13386 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13387 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13388 | [ALC269_QUANTA_FL1] = "quanta", |
| 13389 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13390 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13391 | [ALC269_FUJITSU] = "fujitsu", |
| 13392 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13393 | }; |
| 13394 | |
| 13395 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13396 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13397 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13398 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13399 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13400 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13401 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13402 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13403 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13404 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13405 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13406 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13407 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13408 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13409 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13410 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13411 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13412 | {} |
| 13413 | }; |
| 13414 | |
| 13415 | static struct alc_config_preset alc269_presets[] = { |
| 13416 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13417 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13418 | .init_verbs = { alc269_init_verbs }, |
| 13419 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13420 | .dac_nids = alc269_dac_nids, |
| 13421 | .hp_nid = 0x03, |
| 13422 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13423 | .channel_mode = alc269_modes, |
| 13424 | .input_mux = &alc269_capture_source, |
| 13425 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13426 | [ALC269_QUANTA_FL1] = { |
| 13427 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13428 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13429 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13430 | .dac_nids = alc269_dac_nids, |
| 13431 | .hp_nid = 0x03, |
| 13432 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13433 | .channel_mode = alc269_modes, |
| 13434 | .input_mux = &alc269_capture_source, |
| 13435 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 13436 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13437 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13438 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13439 | .mixers = { alc269_eeepc_mixer }, |
| 13440 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13441 | .init_verbs = { alc269_init_verbs, |
| 13442 | alc269_eeepc_amic_init_verbs }, |
| 13443 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13444 | .dac_nids = alc269_dac_nids, |
| 13445 | .hp_nid = 0x03, |
| 13446 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13447 | .channel_mode = alc269_modes, |
| 13448 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 13449 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 13450 | .init_hook = alc269_eeepc_amic_inithook, |
| 13451 | }, |
| 13452 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13453 | .mixers = { alc269_eeepc_mixer }, |
| 13454 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13455 | .init_verbs = { alc269_init_verbs, |
| 13456 | alc269_eeepc_dmic_init_verbs }, |
| 13457 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13458 | .dac_nids = alc269_dac_nids, |
| 13459 | .hp_nid = 0x03, |
| 13460 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13461 | .channel_mode = alc269_modes, |
| 13462 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13463 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13464 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13465 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13466 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13467 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13468 | .cap_mixer = alc269_epc_capture_mixer, |
| 13469 | .init_verbs = { alc269_init_verbs, |
| 13470 | alc269_eeepc_dmic_init_verbs }, |
| 13471 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13472 | .dac_nids = alc269_dac_nids, |
| 13473 | .hp_nid = 0x03, |
| 13474 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13475 | .channel_mode = alc269_modes, |
| 13476 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13477 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13478 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13479 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13480 | [ALC269_LIFEBOOK] = { |
| 13481 | .mixers = { alc269_lifebook_mixer }, |
| 13482 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13483 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13484 | .dac_nids = alc269_dac_nids, |
| 13485 | .hp_nid = 0x03, |
| 13486 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13487 | .channel_mode = alc269_modes, |
| 13488 | .input_mux = &alc269_capture_source, |
| 13489 | .unsol_event = alc269_lifebook_unsol_event, |
| 13490 | .init_hook = alc269_lifebook_init_hook, |
| 13491 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13492 | }; |
| 13493 | |
| 13494 | static int patch_alc269(struct hda_codec *codec) |
| 13495 | { |
| 13496 | struct alc_spec *spec; |
| 13497 | int board_config; |
| 13498 | int err; |
| 13499 | |
| 13500 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13501 | if (spec == NULL) |
| 13502 | return -ENOMEM; |
| 13503 | |
| 13504 | codec->spec = spec; |
| 13505 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13506 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13507 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13508 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13509 | alc269_models, |
| 13510 | alc269_cfg_tbl); |
| 13511 | |
| 13512 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 13513 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 13514 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13515 | board_config = ALC269_AUTO; |
| 13516 | } |
| 13517 | |
| 13518 | if (board_config == ALC269_AUTO) { |
| 13519 | /* automatic parse from the BIOS config */ |
| 13520 | err = alc269_parse_auto_config(codec); |
| 13521 | if (err < 0) { |
| 13522 | alc_free(codec); |
| 13523 | return err; |
| 13524 | } else if (!err) { |
| 13525 | printk(KERN_INFO |
| 13526 | "hda_codec: Cannot set up configuration " |
| 13527 | "from BIOS. Using base mode...\n"); |
| 13528 | board_config = ALC269_BASIC; |
| 13529 | } |
| 13530 | } |
| 13531 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13532 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13533 | if (err < 0) { |
| 13534 | alc_free(codec); |
| 13535 | return err; |
| 13536 | } |
| 13537 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13538 | if (board_config != ALC269_AUTO) |
| 13539 | setup_preset(spec, &alc269_presets[board_config]); |
| 13540 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13541 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13542 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13543 | * fix the sample rate of analog I/O to 44.1kHz |
| 13544 | */ |
| 13545 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13546 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13547 | } else { |
| 13548 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13549 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13550 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13551 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13552 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13553 | |
| 13554 | spec->adc_nids = alc269_adc_nids; |
| 13555 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13556 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13557 | if (!spec->cap_mixer) |
| 13558 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13559 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13560 | |
| 13561 | codec->patch_ops = alc_patch_ops; |
| 13562 | if (board_config == ALC269_AUTO) |
| 13563 | spec->init_hook = alc269_auto_init; |
| 13564 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13565 | if (!spec->loopback.amplist) |
| 13566 | spec->loopback.amplist = alc269_loopbacks; |
| 13567 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13568 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13569 | |
| 13570 | return 0; |
| 13571 | } |
| 13572 | |
| 13573 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13574 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13575 | */ |
| 13576 | |
| 13577 | /* |
| 13578 | * set the path ways for 2 channel output |
| 13579 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13580 | */ |
| 13581 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13582 | /* set pin widget 1Ah (line in) for input */ |
| 13583 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13584 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13585 | * the vref |
| 13586 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13587 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13588 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13589 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13590 | #if 0 |
| 13591 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13592 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13593 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13594 | { } /* end */ |
| 13595 | }; |
| 13596 | /* |
| 13597 | * 6ch mode |
| 13598 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13599 | */ |
| 13600 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13601 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13602 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13603 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13604 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13605 | |
| 13606 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13607 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13608 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13609 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13610 | #if 0 |
| 13611 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13612 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13613 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13614 | { } /* end */ |
| 13615 | }; |
| 13616 | |
| 13617 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13618 | { 2, alc861_threestack_ch2_init }, |
| 13619 | { 6, alc861_threestack_ch6_init }, |
| 13620 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13621 | /* Set mic1 as input and unmute the mixer */ |
| 13622 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13623 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13624 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13625 | { } /* end */ |
| 13626 | }; |
| 13627 | /* Set mic1 as output and mute mixer */ |
| 13628 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13629 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13630 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13631 | { } /* end */ |
| 13632 | }; |
| 13633 | |
| 13634 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13635 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13636 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13637 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13638 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13639 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13640 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13641 | /* set pin widget 1Ah (line in) for input */ |
| 13642 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13643 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13644 | * the vref |
| 13645 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13646 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13647 | |
| 13648 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13649 | #if 0 |
| 13650 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13651 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13652 | #endif |
| 13653 | { } /* end */ |
| 13654 | }; |
| 13655 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13656 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13657 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13658 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13659 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13660 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13661 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13662 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13663 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13664 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13665 | |
| 13666 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13667 | #if 0 |
| 13668 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13669 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13670 | #endif |
| 13671 | { } /* end */ |
| 13672 | }; |
| 13673 | |
| 13674 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13675 | { 2, alc861_asus_ch2_init }, |
| 13676 | { 6, alc861_asus_ch6_init }, |
| 13677 | }; |
| 13678 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13679 | /* patch-ALC861 */ |
| 13680 | |
| 13681 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13682 | /* output mixer control */ |
| 13683 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13684 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13685 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13686 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13687 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13688 | |
| 13689 | /*Input mixer control */ |
| 13690 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13691 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13692 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13693 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13694 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13695 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13696 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13697 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13698 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13699 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13700 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13701 | { } /* end */ |
| 13702 | }; |
| 13703 | |
| 13704 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13705 | /* output mixer control */ |
| 13706 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13707 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13708 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13709 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13710 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13711 | |
| 13712 | /* Input mixer control */ |
| 13713 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13714 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13715 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13716 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13717 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13718 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13719 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13720 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13721 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13722 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13723 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13724 | { |
| 13725 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13726 | .name = "Channel Mode", |
| 13727 | .info = alc_ch_mode_info, |
| 13728 | .get = alc_ch_mode_get, |
| 13729 | .put = alc_ch_mode_put, |
| 13730 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13731 | }, |
| 13732 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13733 | }; |
| 13734 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13735 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13736 | /* output mixer control */ |
| 13737 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13738 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13739 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13740 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13741 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13742 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13743 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13744 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13745 | /* output mixer control */ |
| 13746 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13747 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13748 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13749 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13750 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13751 | |
| 13752 | /* Input mixer control */ |
| 13753 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13754 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13755 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13756 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13757 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13758 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13759 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13760 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13761 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13762 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13763 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13764 | { |
| 13765 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13766 | .name = "Channel Mode", |
| 13767 | .info = alc_ch_mode_info, |
| 13768 | .get = alc_ch_mode_get, |
| 13769 | .put = alc_ch_mode_put, |
| 13770 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13771 | }, |
| 13772 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13773 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13774 | |
| 13775 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13776 | /* output mixer control */ |
| 13777 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13778 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13779 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13780 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13781 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13782 | |
| 13783 | /* Input mixer control */ |
| 13784 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13785 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13786 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13787 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13788 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13789 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13790 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13791 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13792 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13793 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13794 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13795 | { |
| 13796 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13797 | .name = "Channel Mode", |
| 13798 | .info = alc_ch_mode_info, |
| 13799 | .get = alc_ch_mode_get, |
| 13800 | .put = alc_ch_mode_put, |
| 13801 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13802 | }, |
| 13803 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13804 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13805 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13806 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13807 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13808 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13809 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13810 | { } |
| 13811 | }; |
| 13812 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13813 | /* |
| 13814 | * generic initialization of ADC, input mixers and output mixers |
| 13815 | */ |
| 13816 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13817 | /* |
| 13818 | * Unmute ADC0 and set the default input to mic-in |
| 13819 | */ |
| 13820 | /* port-A for surround (rear panel) */ |
| 13821 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13822 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13823 | /* port-B for mic-in (rear panel) with vref */ |
| 13824 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13825 | /* port-C for line-in (rear panel) */ |
| 13826 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13827 | /* port-D for Front */ |
| 13828 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13829 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13830 | /* port-E for HP out (front panel) */ |
| 13831 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13832 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13833 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13834 | /* port-F for mic-in (front panel) with vref */ |
| 13835 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13836 | /* port-G for CLFE (rear panel) */ |
| 13837 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13838 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13839 | /* port-H for side (rear panel) */ |
| 13840 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13841 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13842 | /* CD-in */ |
| 13843 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13844 | /* route front mic to ADC1*/ |
| 13845 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13846 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13847 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13848 | /* Unmute DAC0~3 & spdif out*/ |
| 13849 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13850 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13851 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13852 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13853 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13854 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13855 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13856 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13857 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13858 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13859 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13860 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13861 | /* Unmute Stereo Mixer 15 */ |
| 13862 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13863 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13864 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13866 | |
| 13867 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13868 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13869 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13870 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13871 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13872 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13873 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13874 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13875 | /* hp used DAC 3 (Front) */ |
| 13876 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13877 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13878 | |
| 13879 | { } |
| 13880 | }; |
| 13881 | |
| 13882 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13883 | /* |
| 13884 | * Unmute ADC0 and set the default input to mic-in |
| 13885 | */ |
| 13886 | /* port-A for surround (rear panel) */ |
| 13887 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13888 | /* port-B for mic-in (rear panel) with vref */ |
| 13889 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13890 | /* port-C for line-in (rear panel) */ |
| 13891 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13892 | /* port-D for Front */ |
| 13893 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13894 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13895 | /* port-E for HP out (front panel) */ |
| 13896 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13897 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13898 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13899 | /* port-F for mic-in (front panel) with vref */ |
| 13900 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13901 | /* port-G for CLFE (rear panel) */ |
| 13902 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13903 | /* port-H for side (rear panel) */ |
| 13904 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13905 | /* CD-in */ |
| 13906 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13907 | /* route front mic to ADC1*/ |
| 13908 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13909 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13910 | /* Unmute DAC0~3 & spdif out*/ |
| 13911 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13912 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13913 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13914 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13915 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13916 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13917 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13918 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13919 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13920 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13921 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13922 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13923 | /* Unmute Stereo Mixer 15 */ |
| 13924 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13925 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13926 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13927 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13928 | |
| 13929 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13930 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13931 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13932 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13933 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13934 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13935 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13936 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13937 | /* hp used DAC 3 (Front) */ |
| 13938 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13939 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13940 | { } |
| 13941 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13942 | |
| 13943 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13944 | /* |
| 13945 | * Unmute ADC0 and set the default input to mic-in |
| 13946 | */ |
| 13947 | /* port-A for surround (rear panel) */ |
| 13948 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13949 | /* port-B for mic-in (rear panel) with vref */ |
| 13950 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13951 | /* port-C for line-in (rear panel) */ |
| 13952 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13953 | /* port-D for Front */ |
| 13954 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13955 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13956 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13957 | /* this has to be set to VREF80 */ |
| 13958 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13959 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13960 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13961 | /* port-F for mic-in (front panel) with vref */ |
| 13962 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13963 | /* port-G for CLFE (rear panel) */ |
| 13964 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13965 | /* port-H for side (rear panel) */ |
| 13966 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13967 | /* CD-in */ |
| 13968 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13969 | /* route front mic to ADC1*/ |
| 13970 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13971 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13972 | /* Unmute DAC0~3 & spdif out*/ |
| 13973 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13974 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13975 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13976 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13977 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13978 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13979 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13980 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13981 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13982 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13983 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13984 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13985 | /* Unmute Stereo Mixer 15 */ |
| 13986 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13987 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13988 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13989 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13990 | |
| 13991 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13992 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13993 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13994 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13995 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13996 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13997 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13998 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13999 | /* hp used DAC 3 (Front) */ |
| 14000 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14001 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14002 | { } |
| 14003 | }; |
| 14004 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14005 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 14006 | /* |
| 14007 | * Unmute ADC0 and set the default input to mic-in |
| 14008 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14009 | /* port-A for surround (rear panel) |
| 14010 | * according to codec#0 this is the HP jack |
| 14011 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14012 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 14013 | /* route front PCM to HP */ |
| 14014 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14015 | /* port-B for mic-in (rear panel) with vref */ |
| 14016 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14017 | /* port-C for line-in (rear panel) */ |
| 14018 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14019 | /* port-D for Front */ |
| 14020 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14021 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14022 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14023 | /* this has to be set to VREF80 */ |
| 14024 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14025 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14026 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14027 | /* port-F for mic-in (front panel) with vref */ |
| 14028 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14029 | /* port-G for CLFE (rear panel) */ |
| 14030 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14031 | /* port-H for side (rear panel) */ |
| 14032 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14033 | /* CD-in */ |
| 14034 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14035 | /* route front mic to ADC1*/ |
| 14036 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14037 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14038 | /* Unmute DAC0~3 & spdif out*/ |
| 14039 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14040 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14041 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14042 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14043 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14044 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14045 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14046 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14047 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14048 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14049 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14050 | /* Unmute Stereo Mixer 15 */ |
| 14051 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14052 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14053 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14054 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14055 | |
| 14056 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14057 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14058 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14059 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14060 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14061 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14062 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14063 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14064 | /* hp used DAC 3 (Front) */ |
| 14065 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14066 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14067 | { } |
| 14068 | }; |
| 14069 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14070 | /* additional init verbs for ASUS laptops */ |
| 14071 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14072 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14073 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14074 | { } |
| 14075 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14076 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14077 | /* |
| 14078 | * generic initialization of ADC, input mixers and output mixers |
| 14079 | */ |
| 14080 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14081 | /* |
| 14082 | * Unmute ADC0 and set the default input to mic-in |
| 14083 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14084 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14085 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14086 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14087 | /* Unmute DAC0~3 & spdif out*/ |
| 14088 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14089 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14090 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14091 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14092 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14093 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14094 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14095 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14096 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14097 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14098 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14099 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14100 | /* Unmute Stereo Mixer 15 */ |
| 14101 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14102 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14103 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14104 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14105 | |
| 14106 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14107 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14108 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14109 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14110 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14111 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14112 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14113 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14114 | |
| 14115 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14116 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14117 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14118 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14119 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14120 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14121 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14122 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14123 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14124 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14125 | |
| 14126 | { } |
| 14127 | }; |
| 14128 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14129 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14130 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14131 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14132 | { } |
| 14133 | }; |
| 14134 | |
| 14135 | /* toggle speaker-output according to the hp-jack state */ |
| 14136 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14137 | { |
| 14138 | unsigned int present; |
| 14139 | |
| 14140 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 14141 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14142 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14143 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14144 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14145 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14146 | } |
| 14147 | |
| 14148 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14149 | unsigned int res) |
| 14150 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14151 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14152 | alc861_toshiba_automute(codec); |
| 14153 | } |
| 14154 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14155 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14156 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14157 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14158 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14159 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14160 | |
| 14161 | |
| 14162 | #define ALC861_DIGOUT_NID 0x07 |
| 14163 | |
| 14164 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14165 | { 8, NULL } |
| 14166 | }; |
| 14167 | |
| 14168 | static hda_nid_t alc861_dac_nids[4] = { |
| 14169 | /* front, surround, clfe, side */ |
| 14170 | 0x03, 0x06, 0x05, 0x04 |
| 14171 | }; |
| 14172 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14173 | static hda_nid_t alc660_dac_nids[3] = { |
| 14174 | /* front, clfe, surround */ |
| 14175 | 0x03, 0x05, 0x06 |
| 14176 | }; |
| 14177 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14178 | static hda_nid_t alc861_adc_nids[1] = { |
| 14179 | /* ADC0-2 */ |
| 14180 | 0x08, |
| 14181 | }; |
| 14182 | |
| 14183 | static struct hda_input_mux alc861_capture_source = { |
| 14184 | .num_items = 5, |
| 14185 | .items = { |
| 14186 | { "Mic", 0x0 }, |
| 14187 | { "Front Mic", 0x3 }, |
| 14188 | { "Line", 0x1 }, |
| 14189 | { "CD", 0x4 }, |
| 14190 | { "Mixer", 0x5 }, |
| 14191 | }, |
| 14192 | }; |
| 14193 | |
| 14194 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14195 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 14196 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14197 | { |
| 14198 | int i; |
| 14199 | hda_nid_t nid; |
| 14200 | |
| 14201 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14202 | for (i = 0; i < cfg->line_outs; i++) { |
| 14203 | nid = cfg->line_out_pins[i]; |
| 14204 | if (nid) { |
| 14205 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 14206 | continue; |
| 14207 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 14208 | } |
| 14209 | } |
| 14210 | spec->multiout.num_dacs = cfg->line_outs; |
| 14211 | return 0; |
| 14212 | } |
| 14213 | |
| 14214 | /* add playback controls from the parsed DAC table */ |
| 14215 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14216 | const struct auto_pin_cfg *cfg) |
| 14217 | { |
| 14218 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14219 | static const char *chname[4] = { |
| 14220 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14221 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14222 | hda_nid_t nid; |
| 14223 | int i, idx, err; |
| 14224 | |
| 14225 | for (i = 0; i < cfg->line_outs; i++) { |
| 14226 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14227 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14228 | continue; |
| 14229 | if (nid == 0x05) { |
| 14230 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14231 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14232 | "Center Playback Switch", |
| 14233 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 14234 | HDA_OUTPUT)); |
| 14235 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14236 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14237 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14238 | "LFE Playback Switch", |
| 14239 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 14240 | HDA_OUTPUT)); |
| 14241 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14242 | return err; |
| 14243 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14244 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 14245 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14246 | if (nid == alc861_dac_nids[idx]) |
| 14247 | break; |
| 14248 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14249 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14250 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 14251 | HDA_OUTPUT)); |
| 14252 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14253 | return err; |
| 14254 | } |
| 14255 | } |
| 14256 | return 0; |
| 14257 | } |
| 14258 | |
| 14259 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 14260 | { |
| 14261 | int err; |
| 14262 | hda_nid_t nid; |
| 14263 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14264 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14265 | return 0; |
| 14266 | |
| 14267 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 14268 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14269 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 14270 | "Headphone Playback Switch", |
| 14271 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 14272 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14273 | return err; |
| 14274 | spec->multiout.hp_nid = nid; |
| 14275 | } |
| 14276 | return 0; |
| 14277 | } |
| 14278 | |
| 14279 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14280 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 14281 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14282 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14283 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14284 | int i, err, idx, idx1; |
| 14285 | |
| 14286 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14287 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14288 | case 0x0c: |
| 14289 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14290 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14291 | break; |
| 14292 | case 0x0f: |
| 14293 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14294 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14295 | break; |
| 14296 | case 0x0d: |
| 14297 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14298 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14299 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14300 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14301 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14302 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14303 | break; |
| 14304 | case 0x11: |
| 14305 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14306 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14307 | break; |
| 14308 | default: |
| 14309 | continue; |
| 14310 | } |
| 14311 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14312 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14313 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14314 | if (err < 0) |
| 14315 | return err; |
| 14316 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14317 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14318 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14319 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14320 | } |
| 14321 | return 0; |
| 14322 | } |
| 14323 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14324 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14325 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14326 | int pin_type, int dac_idx) |
| 14327 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14328 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14329 | pin_type); |
| 14330 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14331 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14332 | } |
| 14333 | |
| 14334 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14335 | { |
| 14336 | struct alc_spec *spec = codec->spec; |
| 14337 | int i; |
| 14338 | |
| 14339 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14340 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14341 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14342 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14343 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14344 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14345 | } |
| 14346 | } |
| 14347 | |
| 14348 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14349 | { |
| 14350 | struct alc_spec *spec = codec->spec; |
| 14351 | hda_nid_t pin; |
| 14352 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 14353 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14354 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14355 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 14356 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14357 | pin = spec->autocfg.speaker_pins[0]; |
| 14358 | if (pin) |
| 14359 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14360 | } |
| 14361 | |
| 14362 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14363 | { |
| 14364 | struct alc_spec *spec = codec->spec; |
| 14365 | int i; |
| 14366 | |
| 14367 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14368 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14369 | if (nid >= 0x0c && nid <= 0x11) |
| 14370 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14371 | } |
| 14372 | } |
| 14373 | |
| 14374 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14375 | /* return 1 if successful, 0 if the proper config is not found, |
| 14376 | * or a negative error code |
| 14377 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14378 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14379 | { |
| 14380 | struct alc_spec *spec = codec->spec; |
| 14381 | int err; |
| 14382 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14383 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14384 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14385 | alc861_ignore); |
| 14386 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14387 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14388 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14389 | return 0; /* can't find valid BIOS pin config */ |
| 14390 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14391 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14392 | if (err < 0) |
| 14393 | return err; |
| 14394 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14395 | if (err < 0) |
| 14396 | return err; |
| 14397 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 14398 | if (err < 0) |
| 14399 | return err; |
| 14400 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14401 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14402 | return err; |
| 14403 | |
| 14404 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14405 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14406 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14407 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14408 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14409 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14410 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14411 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14412 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14413 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14414 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14415 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14416 | |
| 14417 | spec->adc_nids = alc861_adc_nids; |
| 14418 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14419 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14420 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14421 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14422 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14423 | return 1; |
| 14424 | } |
| 14425 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14426 | /* additional initialization for auto-configuration model */ |
| 14427 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14428 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14429 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14430 | alc861_auto_init_multi_out(codec); |
| 14431 | alc861_auto_init_hp_out(codec); |
| 14432 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14433 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14434 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14435 | } |
| 14436 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14437 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14438 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14439 | { 0x15, HDA_INPUT, 0 }, |
| 14440 | { 0x15, HDA_INPUT, 1 }, |
| 14441 | { 0x15, HDA_INPUT, 2 }, |
| 14442 | { 0x15, HDA_INPUT, 3 }, |
| 14443 | { } /* end */ |
| 14444 | }; |
| 14445 | #endif |
| 14446 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14447 | |
| 14448 | /* |
| 14449 | * configuration and preset |
| 14450 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14451 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14452 | [ALC861_3ST] = "3stack", |
| 14453 | [ALC660_3ST] = "3stack-660", |
| 14454 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14455 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14456 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14457 | [ALC861_TOSHIBA] = "toshiba", |
| 14458 | [ALC861_ASUS] = "asus", |
| 14459 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14460 | [ALC861_AUTO] = "auto", |
| 14461 | }; |
| 14462 | |
| 14463 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14464 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14465 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14466 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14467 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14468 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14469 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14470 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14471 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14472 | * Any other models that need this preset? |
| 14473 | */ |
| 14474 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14475 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14476 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14477 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14478 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14479 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14480 | /* FIXME: the below seems conflict */ |
| 14481 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14482 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14483 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14484 | {} |
| 14485 | }; |
| 14486 | |
| 14487 | static struct alc_config_preset alc861_presets[] = { |
| 14488 | [ALC861_3ST] = { |
| 14489 | .mixers = { alc861_3ST_mixer }, |
| 14490 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14491 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14492 | .dac_nids = alc861_dac_nids, |
| 14493 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14494 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14495 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14496 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14497 | .adc_nids = alc861_adc_nids, |
| 14498 | .input_mux = &alc861_capture_source, |
| 14499 | }, |
| 14500 | [ALC861_3ST_DIG] = { |
| 14501 | .mixers = { alc861_base_mixer }, |
| 14502 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14503 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14504 | .dac_nids = alc861_dac_nids, |
| 14505 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14506 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14507 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14508 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14509 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14510 | .adc_nids = alc861_adc_nids, |
| 14511 | .input_mux = &alc861_capture_source, |
| 14512 | }, |
| 14513 | [ALC861_6ST_DIG] = { |
| 14514 | .mixers = { alc861_base_mixer }, |
| 14515 | .init_verbs = { alc861_base_init_verbs }, |
| 14516 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14517 | .dac_nids = alc861_dac_nids, |
| 14518 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14519 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14520 | .channel_mode = alc861_8ch_modes, |
| 14521 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14522 | .adc_nids = alc861_adc_nids, |
| 14523 | .input_mux = &alc861_capture_source, |
| 14524 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14525 | [ALC660_3ST] = { |
| 14526 | .mixers = { alc861_3ST_mixer }, |
| 14527 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14528 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14529 | .dac_nids = alc660_dac_nids, |
| 14530 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14531 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14532 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14533 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14534 | .adc_nids = alc861_adc_nids, |
| 14535 | .input_mux = &alc861_capture_source, |
| 14536 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14537 | [ALC861_UNIWILL_M31] = { |
| 14538 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14539 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14540 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14541 | .dac_nids = alc861_dac_nids, |
| 14542 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14543 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14544 | .channel_mode = alc861_uniwill_m31_modes, |
| 14545 | .need_dac_fix = 1, |
| 14546 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14547 | .adc_nids = alc861_adc_nids, |
| 14548 | .input_mux = &alc861_capture_source, |
| 14549 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14550 | [ALC861_TOSHIBA] = { |
| 14551 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14552 | .init_verbs = { alc861_base_init_verbs, |
| 14553 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14554 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14555 | .dac_nids = alc861_dac_nids, |
| 14556 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14557 | .channel_mode = alc883_3ST_2ch_modes, |
| 14558 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14559 | .adc_nids = alc861_adc_nids, |
| 14560 | .input_mux = &alc861_capture_source, |
| 14561 | .unsol_event = alc861_toshiba_unsol_event, |
| 14562 | .init_hook = alc861_toshiba_automute, |
| 14563 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14564 | [ALC861_ASUS] = { |
| 14565 | .mixers = { alc861_asus_mixer }, |
| 14566 | .init_verbs = { alc861_asus_init_verbs }, |
| 14567 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14568 | .dac_nids = alc861_dac_nids, |
| 14569 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14570 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14571 | .channel_mode = alc861_asus_modes, |
| 14572 | .need_dac_fix = 1, |
| 14573 | .hp_nid = 0x06, |
| 14574 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14575 | .adc_nids = alc861_adc_nids, |
| 14576 | .input_mux = &alc861_capture_source, |
| 14577 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14578 | [ALC861_ASUS_LAPTOP] = { |
| 14579 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14580 | .init_verbs = { alc861_asus_init_verbs, |
| 14581 | alc861_asus_laptop_init_verbs }, |
| 14582 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14583 | .dac_nids = alc861_dac_nids, |
| 14584 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14585 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14586 | .channel_mode = alc883_3ST_2ch_modes, |
| 14587 | .need_dac_fix = 1, |
| 14588 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14589 | .adc_nids = alc861_adc_nids, |
| 14590 | .input_mux = &alc861_capture_source, |
| 14591 | }, |
| 14592 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14593 | |
| 14594 | |
| 14595 | static int patch_alc861(struct hda_codec *codec) |
| 14596 | { |
| 14597 | struct alc_spec *spec; |
| 14598 | int board_config; |
| 14599 | int err; |
| 14600 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14601 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14602 | if (spec == NULL) |
| 14603 | return -ENOMEM; |
| 14604 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14605 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14606 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14607 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14608 | alc861_models, |
| 14609 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14610 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14611 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 14612 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 14613 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14614 | board_config = ALC861_AUTO; |
| 14615 | } |
| 14616 | |
| 14617 | if (board_config == ALC861_AUTO) { |
| 14618 | /* automatic parse from the BIOS config */ |
| 14619 | err = alc861_parse_auto_config(codec); |
| 14620 | if (err < 0) { |
| 14621 | alc_free(codec); |
| 14622 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14623 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14624 | printk(KERN_INFO |
| 14625 | "hda_codec: Cannot set up configuration " |
| 14626 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14627 | board_config = ALC861_3ST_DIG; |
| 14628 | } |
| 14629 | } |
| 14630 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14631 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14632 | if (err < 0) { |
| 14633 | alc_free(codec); |
| 14634 | return err; |
| 14635 | } |
| 14636 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14637 | if (board_config != ALC861_AUTO) |
| 14638 | setup_preset(spec, &alc861_presets[board_config]); |
| 14639 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14640 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14641 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14642 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14643 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14644 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14645 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14646 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14647 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14648 | spec->vmaster_nid = 0x03; |
| 14649 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14650 | codec->patch_ops = alc_patch_ops; |
| 14651 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14652 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14653 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14654 | if (!spec->loopback.amplist) |
| 14655 | spec->loopback.amplist = alc861_loopbacks; |
| 14656 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14657 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14658 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14659 | return 0; |
| 14660 | } |
| 14661 | |
| 14662 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14663 | * ALC861-VD support |
| 14664 | * |
| 14665 | * Based on ALC882 |
| 14666 | * |
| 14667 | * In addition, an independent DAC |
| 14668 | */ |
| 14669 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14670 | |
| 14671 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14672 | /* front, surr, clfe, side surr */ |
| 14673 | 0x02, 0x03, 0x04, 0x05 |
| 14674 | }; |
| 14675 | |
| 14676 | /* dac_nids for ALC660vd are in a different order - according to |
| 14677 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14678 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14679 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14680 | * - and it is the same as in 861vd. |
| 14681 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14682 | */ |
| 14683 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14684 | /* front, rear, clfe, rear_surr */ |
| 14685 | 0x02, 0x04, 0x03 |
| 14686 | }; |
| 14687 | |
| 14688 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14689 | /* ADC0 */ |
| 14690 | 0x09, |
| 14691 | }; |
| 14692 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14693 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14694 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14695 | /* input MUX */ |
| 14696 | /* FIXME: should be a matrix-type input source selection */ |
| 14697 | static struct hda_input_mux alc861vd_capture_source = { |
| 14698 | .num_items = 4, |
| 14699 | .items = { |
| 14700 | { "Mic", 0x0 }, |
| 14701 | { "Front Mic", 0x1 }, |
| 14702 | { "Line", 0x2 }, |
| 14703 | { "CD", 0x4 }, |
| 14704 | }, |
| 14705 | }; |
| 14706 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14707 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14708 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14709 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14710 | { "Ext Mic", 0x0 }, |
| 14711 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14712 | }, |
| 14713 | }; |
| 14714 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14715 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14716 | .num_items = 2, |
| 14717 | .items = { |
| 14718 | { "Front Mic", 0x0 }, |
| 14719 | { "ATAPI Mic", 0x1 }, |
| 14720 | }, |
| 14721 | }; |
| 14722 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14723 | /* |
| 14724 | * 2ch mode |
| 14725 | */ |
| 14726 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14727 | { 2, NULL } |
| 14728 | }; |
| 14729 | |
| 14730 | /* |
| 14731 | * 6ch mode |
| 14732 | */ |
| 14733 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14734 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14735 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14736 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14737 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14738 | { } /* end */ |
| 14739 | }; |
| 14740 | |
| 14741 | /* |
| 14742 | * 8ch mode |
| 14743 | */ |
| 14744 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14745 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14746 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14747 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14748 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14749 | { } /* end */ |
| 14750 | }; |
| 14751 | |
| 14752 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14753 | { 6, alc861vd_6stack_ch6_init }, |
| 14754 | { 8, alc861vd_6stack_ch8_init }, |
| 14755 | }; |
| 14756 | |
| 14757 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14758 | { |
| 14759 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14760 | .name = "Channel Mode", |
| 14761 | .info = alc_ch_mode_info, |
| 14762 | .get = alc_ch_mode_get, |
| 14763 | .put = alc_ch_mode_put, |
| 14764 | }, |
| 14765 | { } /* end */ |
| 14766 | }; |
| 14767 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14768 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14769 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14770 | */ |
| 14771 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14772 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14773 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14774 | |
| 14775 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14776 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14777 | |
| 14778 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14779 | HDA_OUTPUT), |
| 14780 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14781 | HDA_OUTPUT), |
| 14782 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14783 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14784 | |
| 14785 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14786 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14787 | |
| 14788 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14789 | |
| 14790 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14791 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14792 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14793 | |
| 14794 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14795 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14796 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14797 | |
| 14798 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14799 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14800 | |
| 14801 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14802 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14803 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14804 | { } /* end */ |
| 14805 | }; |
| 14806 | |
| 14807 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14808 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14809 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14810 | |
| 14811 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14812 | |
| 14813 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14816 | |
| 14817 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14818 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14819 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14820 | |
| 14821 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14822 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14823 | |
| 14824 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14825 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14826 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14827 | { } /* end */ |
| 14828 | }; |
| 14829 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14830 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14831 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14832 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14833 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14834 | |
| 14835 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14836 | |
| 14837 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14838 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14839 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14840 | |
| 14841 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14842 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14843 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14844 | |
| 14845 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14846 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14847 | |
| 14848 | { } /* end */ |
| 14849 | }; |
| 14850 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14851 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14852 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14853 | */ |
| 14854 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14855 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14856 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14857 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14858 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14859 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14860 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14861 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14862 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14863 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14864 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14865 | { } /* end */ |
| 14866 | }; |
| 14867 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14868 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14869 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14870 | */ |
| 14871 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14872 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14873 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14874 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14875 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14876 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14877 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14878 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14879 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14880 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14881 | { } /* end */ |
| 14882 | }; |
| 14883 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14884 | /* |
| 14885 | * generic initialization of ADC, input mixers and output mixers |
| 14886 | */ |
| 14887 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14888 | /* |
| 14889 | * Unmute ADC0 and set the default input to mic-in |
| 14890 | */ |
| 14891 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14892 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14893 | |
| 14894 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14895 | * the analog-loopback mixer widget |
| 14896 | */ |
| 14897 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14898 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14899 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14900 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14901 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14902 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14903 | |
| 14904 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14905 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14906 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14907 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14908 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14909 | |
| 14910 | /* |
| 14911 | * Set up output mixers (0x02 - 0x05) |
| 14912 | */ |
| 14913 | /* set vol=0 to output mixers */ |
| 14914 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14915 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14916 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14917 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14918 | |
| 14919 | /* set up input amps for analog loopback */ |
| 14920 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14921 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14922 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14923 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14924 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14925 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14926 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14927 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14928 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14929 | |
| 14930 | { } |
| 14931 | }; |
| 14932 | |
| 14933 | /* |
| 14934 | * 3-stack pin configuration: |
| 14935 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14936 | */ |
| 14937 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14938 | /* |
| 14939 | * Set pin mode and muting |
| 14940 | */ |
| 14941 | /* set front pin widgets 0x14 for output */ |
| 14942 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14943 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14944 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14945 | |
| 14946 | /* Mic (rear) pin: input vref at 80% */ |
| 14947 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14948 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14949 | /* Front Mic pin: input vref at 80% */ |
| 14950 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14951 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14952 | /* Line In pin: input */ |
| 14953 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14954 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14955 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14956 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14957 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14958 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14959 | /* CD pin widget for input */ |
| 14960 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14961 | |
| 14962 | { } |
| 14963 | }; |
| 14964 | |
| 14965 | /* |
| 14966 | * 6-stack pin configuration: |
| 14967 | */ |
| 14968 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14969 | /* |
| 14970 | * Set pin mode and muting |
| 14971 | */ |
| 14972 | /* set front pin widgets 0x14 for output */ |
| 14973 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14974 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14975 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14976 | |
| 14977 | /* Rear Pin: output 1 (0x0d) */ |
| 14978 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14979 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14980 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14981 | /* CLFE Pin: output 2 (0x0e) */ |
| 14982 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14983 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14984 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14985 | /* Side Pin: output 3 (0x0f) */ |
| 14986 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14987 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14988 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14989 | |
| 14990 | /* Mic (rear) pin: input vref at 80% */ |
| 14991 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14992 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14993 | /* Front Mic pin: input vref at 80% */ |
| 14994 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14995 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14996 | /* Line In pin: input */ |
| 14997 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14998 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14999 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15000 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15001 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15002 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15003 | /* CD pin widget for input */ |
| 15004 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15005 | |
| 15006 | { } |
| 15007 | }; |
| 15008 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15009 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 15010 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15011 | { } |
| 15012 | }; |
| 15013 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15014 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 15015 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15016 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15017 | { } |
| 15018 | }; |
| 15019 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15020 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 15021 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15022 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15023 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 15024 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15025 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15026 | {} |
| 15027 | }; |
| 15028 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15029 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 15030 | { |
| 15031 | unsigned int present; |
| 15032 | unsigned char bits; |
| 15033 | |
| 15034 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15035 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15036 | bits = present ? HDA_AMP_MUTE : 0; |
| 15037 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15038 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15039 | } |
| 15040 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15041 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15042 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15043 | struct alc_spec *spec = codec->spec; |
| 15044 | |
| 15045 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15046 | spec->autocfg.speaker_pins[0] = 0x14; |
| 15047 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15048 | alc861vd_lenovo_mic_automute(codec); |
| 15049 | } |
| 15050 | |
| 15051 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15052 | unsigned int res) |
| 15053 | { |
| 15054 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15055 | case ALC880_MIC_EVENT: |
| 15056 | alc861vd_lenovo_mic_automute(codec); |
| 15057 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15058 | default: |
| 15059 | alc_automute_amp_unsol_event(codec, res); |
| 15060 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15061 | } |
| 15062 | } |
| 15063 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15064 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15065 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15066 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15067 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15068 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15069 | |
| 15070 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15071 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15072 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15073 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15074 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15075 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15076 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15077 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15078 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15079 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15080 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15081 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15082 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15083 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15084 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15085 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15086 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15087 | |
| 15088 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15089 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15090 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15091 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15092 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15093 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15094 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15095 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15096 | |
| 15097 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15098 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15099 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15101 | |
| 15102 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15103 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15104 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15105 | |
| 15106 | { } /* end */ |
| 15107 | }; |
| 15108 | |
| 15109 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15110 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15111 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15112 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15113 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15114 | spec->autocfg.hp_pins[0] = 0x15; |
| 15115 | spec->autocfg.speaker_pins[0] = 0x14; |
| 15116 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15117 | } |
| 15118 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15119 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15120 | #define alc861vd_loopbacks alc880_loopbacks |
| 15121 | #endif |
| 15122 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15123 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15124 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15125 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15126 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15127 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15128 | |
| 15129 | /* |
| 15130 | * configuration and preset |
| 15131 | */ |
| 15132 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15133 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15134 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15135 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15136 | [ALC861VD_3ST] = "3stack", |
| 15137 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15138 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15139 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15140 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15141 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15142 | [ALC861VD_AUTO] = "auto", |
| 15143 | }; |
| 15144 | |
| 15145 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15146 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15147 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15148 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15149 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15150 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15151 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15152 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15153 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15154 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15155 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15156 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15157 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15158 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15159 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15160 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15161 | {} |
| 15162 | }; |
| 15163 | |
| 15164 | static struct alc_config_preset alc861vd_presets[] = { |
| 15165 | [ALC660VD_3ST] = { |
| 15166 | .mixers = { alc861vd_3st_mixer }, |
| 15167 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15168 | alc861vd_3stack_init_verbs }, |
| 15169 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15170 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15171 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15172 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15173 | .input_mux = &alc861vd_capture_source, |
| 15174 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15175 | [ALC660VD_3ST_DIG] = { |
| 15176 | .mixers = { alc861vd_3st_mixer }, |
| 15177 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15178 | alc861vd_3stack_init_verbs }, |
| 15179 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15180 | .dac_nids = alc660vd_dac_nids, |
| 15181 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15182 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15183 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15184 | .input_mux = &alc861vd_capture_source, |
| 15185 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15186 | [ALC861VD_3ST] = { |
| 15187 | .mixers = { alc861vd_3st_mixer }, |
| 15188 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15189 | alc861vd_3stack_init_verbs }, |
| 15190 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15191 | .dac_nids = alc861vd_dac_nids, |
| 15192 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15193 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15194 | .input_mux = &alc861vd_capture_source, |
| 15195 | }, |
| 15196 | [ALC861VD_3ST_DIG] = { |
| 15197 | .mixers = { alc861vd_3st_mixer }, |
| 15198 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15199 | alc861vd_3stack_init_verbs }, |
| 15200 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15201 | .dac_nids = alc861vd_dac_nids, |
| 15202 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15203 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15204 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15205 | .input_mux = &alc861vd_capture_source, |
| 15206 | }, |
| 15207 | [ALC861VD_6ST_DIG] = { |
| 15208 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15209 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15210 | alc861vd_6stack_init_verbs }, |
| 15211 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15212 | .dac_nids = alc861vd_dac_nids, |
| 15213 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15214 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15215 | .channel_mode = alc861vd_6stack_modes, |
| 15216 | .input_mux = &alc861vd_capture_source, |
| 15217 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15218 | [ALC861VD_LENOVO] = { |
| 15219 | .mixers = { alc861vd_lenovo_mixer }, |
| 15220 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15221 | alc861vd_3stack_init_verbs, |
| 15222 | alc861vd_eapd_verbs, |
| 15223 | alc861vd_lenovo_unsol_verbs }, |
| 15224 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15225 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15226 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15227 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15228 | .input_mux = &alc861vd_capture_source, |
| 15229 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15230 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15231 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15232 | [ALC861VD_DALLAS] = { |
| 15233 | .mixers = { alc861vd_dallas_mixer }, |
| 15234 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15235 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15236 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15237 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15238 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15239 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15240 | .unsol_event = alc_automute_amp_unsol_event, |
| 15241 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15242 | }, |
| 15243 | [ALC861VD_HP] = { |
| 15244 | .mixers = { alc861vd_hp_mixer }, |
| 15245 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15246 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15247 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15248 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15249 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15250 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15251 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15252 | .unsol_event = alc_automute_amp_unsol_event, |
| 15253 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15254 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15255 | [ALC660VD_ASUS_V1S] = { |
| 15256 | .mixers = { alc861vd_lenovo_mixer }, |
| 15257 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15258 | alc861vd_3stack_init_verbs, |
| 15259 | alc861vd_eapd_verbs, |
| 15260 | alc861vd_lenovo_unsol_verbs }, |
| 15261 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15262 | .dac_nids = alc660vd_dac_nids, |
| 15263 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15264 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15265 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15266 | .input_mux = &alc861vd_capture_source, |
| 15267 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15268 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15269 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15270 | }; |
| 15271 | |
| 15272 | /* |
| 15273 | * BIOS auto configuration |
| 15274 | */ |
| 15275 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15276 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15277 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15278 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15279 | } |
| 15280 | |
| 15281 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15282 | { |
| 15283 | struct alc_spec *spec = codec->spec; |
| 15284 | int i; |
| 15285 | |
| 15286 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15287 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15288 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15289 | if (nid) |
| 15290 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15291 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15292 | } |
| 15293 | } |
| 15294 | |
| 15295 | |
| 15296 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15297 | { |
| 15298 | struct alc_spec *spec = codec->spec; |
| 15299 | hda_nid_t pin; |
| 15300 | |
| 15301 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15302 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15303 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15304 | pin = spec->autocfg.speaker_pins[0]; |
| 15305 | if (pin) |
| 15306 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15307 | } |
| 15308 | |
| 15309 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 15310 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15311 | |
| 15312 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15313 | { |
| 15314 | struct alc_spec *spec = codec->spec; |
| 15315 | int i; |
| 15316 | |
| 15317 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15318 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 15319 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15320 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15321 | if (nid != ALC861VD_PIN_CD_NID && |
| 15322 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15323 | snd_hda_codec_write(codec, nid, 0, |
| 15324 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15325 | AMP_OUT_MUTE); |
| 15326 | } |
| 15327 | } |
| 15328 | } |
| 15329 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15330 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15331 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15332 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15333 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15334 | |
| 15335 | /* add playback controls from the parsed DAC table */ |
| 15336 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15337 | * different NIDs for mute/unmute switch and volume control */ |
| 15338 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15339 | const struct auto_pin_cfg *cfg) |
| 15340 | { |
| 15341 | char name[32]; |
| 15342 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15343 | hda_nid_t nid_v, nid_s; |
| 15344 | int i, err; |
| 15345 | |
| 15346 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15347 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15348 | continue; |
| 15349 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15350 | alc880_dac_to_idx( |
| 15351 | spec->multiout.dac_nids[i])); |
| 15352 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15353 | alc880_dac_to_idx( |
| 15354 | spec->multiout.dac_nids[i])); |
| 15355 | |
| 15356 | if (i == 2) { |
| 15357 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15358 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15359 | "Center Playback Volume", |
| 15360 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15361 | HDA_OUTPUT)); |
| 15362 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15363 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15364 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15365 | "LFE Playback Volume", |
| 15366 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15367 | HDA_OUTPUT)); |
| 15368 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15369 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15370 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15371 | "Center Playback Switch", |
| 15372 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15373 | HDA_INPUT)); |
| 15374 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15375 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15376 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15377 | "LFE Playback Switch", |
| 15378 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15379 | HDA_INPUT)); |
| 15380 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15381 | return err; |
| 15382 | } else { |
| 15383 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15384 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15385 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15386 | HDA_OUTPUT)); |
| 15387 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15388 | return err; |
| 15389 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15390 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15391 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15392 | HDA_INPUT)); |
| 15393 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15394 | return err; |
| 15395 | } |
| 15396 | } |
| 15397 | return 0; |
| 15398 | } |
| 15399 | |
| 15400 | /* add playback controls for speaker and HP outputs */ |
| 15401 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15402 | * different NIDs for mute/unmute switch and volume control */ |
| 15403 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15404 | hda_nid_t pin, const char *pfx) |
| 15405 | { |
| 15406 | hda_nid_t nid_v, nid_s; |
| 15407 | int err; |
| 15408 | char name[32]; |
| 15409 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15410 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15411 | return 0; |
| 15412 | |
| 15413 | if (alc880_is_fixed_pin(pin)) { |
| 15414 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15415 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15416 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15417 | spec->multiout.hp_nid = nid_v; |
| 15418 | else |
| 15419 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15420 | /* control HP volume/switch on the output mixer amp */ |
| 15421 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15422 | alc880_fixed_pin_idx(pin)); |
| 15423 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15424 | alc880_fixed_pin_idx(pin)); |
| 15425 | |
| 15426 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15427 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15428 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15429 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15430 | return err; |
| 15431 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15432 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15433 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15434 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15435 | return err; |
| 15436 | } else if (alc880_is_multi_pin(pin)) { |
| 15437 | /* set manual connection */ |
| 15438 | /* we have only a switch on HP-out PIN */ |
| 15439 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15440 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15441 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15442 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15443 | return err; |
| 15444 | } |
| 15445 | return 0; |
| 15446 | } |
| 15447 | |
| 15448 | /* parse the BIOS configuration and set up the alc_spec |
| 15449 | * return 1 if successful, 0 if the proper config is not found, |
| 15450 | * or a negative error code |
| 15451 | * Based on ALC880 version - had to change it to override |
| 15452 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15453 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15454 | { |
| 15455 | struct alc_spec *spec = codec->spec; |
| 15456 | int err; |
| 15457 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15458 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15459 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15460 | alc861vd_ignore); |
| 15461 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15462 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15463 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15464 | return 0; /* can't find valid BIOS pin config */ |
| 15465 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15466 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15467 | if (err < 0) |
| 15468 | return err; |
| 15469 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15470 | if (err < 0) |
| 15471 | return err; |
| 15472 | err = alc861vd_auto_create_extra_out(spec, |
| 15473 | spec->autocfg.speaker_pins[0], |
| 15474 | "Speaker"); |
| 15475 | if (err < 0) |
| 15476 | return err; |
| 15477 | err = alc861vd_auto_create_extra_out(spec, |
| 15478 | spec->autocfg.hp_pins[0], |
| 15479 | "Headphone"); |
| 15480 | if (err < 0) |
| 15481 | return err; |
| 15482 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15483 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15484 | return err; |
| 15485 | |
| 15486 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15487 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15488 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15489 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15490 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15491 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15492 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15493 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15494 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15495 | |
| 15496 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15497 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15498 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15499 | err = alc_auto_add_mic_boost(codec); |
| 15500 | if (err < 0) |
| 15501 | return err; |
| 15502 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15503 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15504 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15505 | return 1; |
| 15506 | } |
| 15507 | |
| 15508 | /* additional initialization for auto-configuration model */ |
| 15509 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15510 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15511 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15512 | alc861vd_auto_init_multi_out(codec); |
| 15513 | alc861vd_auto_init_hp_out(codec); |
| 15514 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15515 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15516 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15517 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15518 | } |
| 15519 | |
| 15520 | static int patch_alc861vd(struct hda_codec *codec) |
| 15521 | { |
| 15522 | struct alc_spec *spec; |
| 15523 | int err, board_config; |
| 15524 | |
| 15525 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15526 | if (spec == NULL) |
| 15527 | return -ENOMEM; |
| 15528 | |
| 15529 | codec->spec = spec; |
| 15530 | |
| 15531 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15532 | alc861vd_models, |
| 15533 | alc861vd_cfg_tbl); |
| 15534 | |
| 15535 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 15536 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 15537 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15538 | board_config = ALC861VD_AUTO; |
| 15539 | } |
| 15540 | |
| 15541 | if (board_config == ALC861VD_AUTO) { |
| 15542 | /* automatic parse from the BIOS config */ |
| 15543 | err = alc861vd_parse_auto_config(codec); |
| 15544 | if (err < 0) { |
| 15545 | alc_free(codec); |
| 15546 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15547 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15548 | printk(KERN_INFO |
| 15549 | "hda_codec: Cannot set up configuration " |
| 15550 | "from BIOS. Using base mode...\n"); |
| 15551 | board_config = ALC861VD_3ST; |
| 15552 | } |
| 15553 | } |
| 15554 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15555 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15556 | if (err < 0) { |
| 15557 | alc_free(codec); |
| 15558 | return err; |
| 15559 | } |
| 15560 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15561 | if (board_config != ALC861VD_AUTO) |
| 15562 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15563 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15564 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15565 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15566 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15567 | } |
| 15568 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15569 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15570 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15571 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15572 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15573 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15574 | |
| 15575 | spec->adc_nids = alc861vd_adc_nids; |
| 15576 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15577 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15578 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15579 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15580 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15581 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15582 | spec->vmaster_nid = 0x02; |
| 15583 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15584 | codec->patch_ops = alc_patch_ops; |
| 15585 | |
| 15586 | if (board_config == ALC861VD_AUTO) |
| 15587 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15588 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15589 | if (!spec->loopback.amplist) |
| 15590 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15591 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15592 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15593 | |
| 15594 | return 0; |
| 15595 | } |
| 15596 | |
| 15597 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15598 | * ALC662 support |
| 15599 | * |
| 15600 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15601 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15602 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15603 | * 6-channel independent captures. |
| 15604 | * |
| 15605 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15606 | * driver yet). |
| 15607 | */ |
| 15608 | #define ALC662_DIGOUT_NID 0x06 |
| 15609 | #define ALC662_DIGIN_NID 0x0a |
| 15610 | |
| 15611 | static hda_nid_t alc662_dac_nids[4] = { |
| 15612 | /* front, rear, clfe, rear_surr */ |
| 15613 | 0x02, 0x03, 0x04 |
| 15614 | }; |
| 15615 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15616 | static hda_nid_t alc272_dac_nids[2] = { |
| 15617 | 0x02, 0x03 |
| 15618 | }; |
| 15619 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15620 | static hda_nid_t alc662_adc_nids[1] = { |
| 15621 | /* ADC1-2 */ |
| 15622 | 0x09, |
| 15623 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15624 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15625 | static hda_nid_t alc272_adc_nids[1] = { |
| 15626 | /* ADC1-2 */ |
| 15627 | 0x08, |
| 15628 | }; |
| 15629 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15630 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15631 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15632 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15633 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15634 | /* input MUX */ |
| 15635 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15636 | static struct hda_input_mux alc662_capture_source = { |
| 15637 | .num_items = 4, |
| 15638 | .items = { |
| 15639 | { "Mic", 0x0 }, |
| 15640 | { "Front Mic", 0x1 }, |
| 15641 | { "Line", 0x2 }, |
| 15642 | { "CD", 0x4 }, |
| 15643 | }, |
| 15644 | }; |
| 15645 | |
| 15646 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15647 | .num_items = 2, |
| 15648 | .items = { |
| 15649 | { "Mic", 0x1 }, |
| 15650 | { "Line", 0x2 }, |
| 15651 | }, |
| 15652 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15653 | |
| 15654 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15655 | .num_items = 2, |
| 15656 | .items = { |
| 15657 | { "i-Mic", 0x1 }, |
| 15658 | { "e-Mic", 0x0 }, |
| 15659 | }, |
| 15660 | }; |
| 15661 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15662 | static struct hda_input_mux alc663_capture_source = { |
| 15663 | .num_items = 3, |
| 15664 | .items = { |
| 15665 | { "Mic", 0x0 }, |
| 15666 | { "Front Mic", 0x1 }, |
| 15667 | { "Line", 0x2 }, |
| 15668 | }, |
| 15669 | }; |
| 15670 | |
| 15671 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15672 | .num_items = 2, |
| 15673 | .items = { |
| 15674 | { "Ext-Mic", 0x0 }, |
| 15675 | { "D-Mic", 0x9 }, |
| 15676 | }, |
| 15677 | }; |
| 15678 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15679 | #if 1 /* set to 0 for testing other input sources below */ |
| 15680 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15681 | .num_items = 2, |
| 15682 | .items = { |
| 15683 | { "Autoselect Mic", 0x0 }, |
| 15684 | { "Internal Mic", 0x1 }, |
| 15685 | }, |
| 15686 | }; |
| 15687 | #else |
| 15688 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15689 | .num_items = 16, |
| 15690 | .items = { |
| 15691 | { "Autoselect Mic", 0x0 }, |
| 15692 | { "Internal Mic", 0x1 }, |
| 15693 | { "In-0x02", 0x2 }, |
| 15694 | { "In-0x03", 0x3 }, |
| 15695 | { "In-0x04", 0x4 }, |
| 15696 | { "In-0x05", 0x5 }, |
| 15697 | { "In-0x06", 0x6 }, |
| 15698 | { "In-0x07", 0x7 }, |
| 15699 | { "In-0x08", 0x8 }, |
| 15700 | { "In-0x09", 0x9 }, |
| 15701 | { "In-0x0a", 0x0a }, |
| 15702 | { "In-0x0b", 0x0b }, |
| 15703 | { "In-0x0c", 0x0c }, |
| 15704 | { "In-0x0d", 0x0d }, |
| 15705 | { "In-0x0e", 0x0e }, |
| 15706 | { "In-0x0f", 0x0f }, |
| 15707 | }, |
| 15708 | }; |
| 15709 | #endif |
| 15710 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15711 | /* |
| 15712 | * 2ch mode |
| 15713 | */ |
| 15714 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15715 | { 2, NULL } |
| 15716 | }; |
| 15717 | |
| 15718 | /* |
| 15719 | * 2ch mode |
| 15720 | */ |
| 15721 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15722 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15723 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15724 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15725 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15726 | { } /* end */ |
| 15727 | }; |
| 15728 | |
| 15729 | /* |
| 15730 | * 6ch mode |
| 15731 | */ |
| 15732 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15733 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15734 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15735 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15736 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15737 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15738 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15739 | { } /* end */ |
| 15740 | }; |
| 15741 | |
| 15742 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15743 | { 2, alc662_3ST_ch2_init }, |
| 15744 | { 6, alc662_3ST_ch6_init }, |
| 15745 | }; |
| 15746 | |
| 15747 | /* |
| 15748 | * 2ch mode |
| 15749 | */ |
| 15750 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15751 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15752 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15753 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15754 | { } /* end */ |
| 15755 | }; |
| 15756 | |
| 15757 | /* |
| 15758 | * 6ch mode |
| 15759 | */ |
| 15760 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15761 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15762 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15763 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15764 | { } /* end */ |
| 15765 | }; |
| 15766 | |
| 15767 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15768 | { 2, alc662_sixstack_ch6_init }, |
| 15769 | { 6, alc662_sixstack_ch8_init }, |
| 15770 | }; |
| 15771 | |
| 15772 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15773 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15774 | */ |
| 15775 | |
| 15776 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15777 | /* output mixer control */ |
| 15778 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15779 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15780 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15781 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15782 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15783 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15784 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15785 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15786 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15787 | |
| 15788 | /*Input mixer control */ |
| 15789 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15790 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15791 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15792 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15793 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15794 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15795 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15796 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15797 | { } /* end */ |
| 15798 | }; |
| 15799 | |
| 15800 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15801 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15802 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15803 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15804 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15805 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15806 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15807 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15808 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15809 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15810 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15811 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15812 | { } /* end */ |
| 15813 | }; |
| 15814 | |
| 15815 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15816 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15817 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15818 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15819 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15820 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15821 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15822 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15823 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15824 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15825 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15826 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15827 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15828 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15829 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15830 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15831 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15832 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15833 | { } /* end */ |
| 15834 | }; |
| 15835 | |
| 15836 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15837 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15838 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15839 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15840 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15841 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15842 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15843 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15844 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15845 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15846 | { } /* end */ |
| 15847 | }; |
| 15848 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15849 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15850 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15851 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15852 | |
| 15853 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15854 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15855 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15856 | |
| 15857 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15858 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15859 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15860 | { } /* end */ |
| 15861 | }; |
| 15862 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15863 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15864 | ALC262_HIPPO_MASTER_SWITCH, |
| 15865 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15866 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15867 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15868 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15869 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15870 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15871 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15872 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15873 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15874 | { } /* end */ |
| 15875 | }; |
| 15876 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15877 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15878 | .ops = &snd_hda_bind_vol, |
| 15879 | .values = { |
| 15880 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15881 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15882 | 0 |
| 15883 | }, |
| 15884 | }; |
| 15885 | |
| 15886 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15887 | .ops = &snd_hda_bind_sw, |
| 15888 | .values = { |
| 15889 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15890 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15891 | 0 |
| 15892 | }, |
| 15893 | }; |
| 15894 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15895 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15896 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15897 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15899 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15900 | { } /* end */ |
| 15901 | }; |
| 15902 | |
| 15903 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15904 | .ops = &snd_hda_bind_sw, |
| 15905 | .values = { |
| 15906 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15907 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15908 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15909 | 0 |
| 15910 | }, |
| 15911 | }; |
| 15912 | |
| 15913 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15914 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15915 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15916 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15917 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15918 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15919 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15920 | |
| 15921 | { } /* end */ |
| 15922 | }; |
| 15923 | |
| 15924 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15925 | .ops = &snd_hda_bind_sw, |
| 15926 | .values = { |
| 15927 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15928 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15929 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15930 | 0 |
| 15931 | }, |
| 15932 | }; |
| 15933 | |
| 15934 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15935 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15936 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15937 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15938 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15939 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15940 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15941 | { } /* end */ |
| 15942 | }; |
| 15943 | |
| 15944 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15945 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15946 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15947 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15948 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15949 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15950 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15951 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15952 | { } /* end */ |
| 15953 | }; |
| 15954 | |
| 15955 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15956 | .ops = &snd_hda_bind_vol, |
| 15957 | .values = { |
| 15958 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15959 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15960 | 0 |
| 15961 | }, |
| 15962 | }; |
| 15963 | |
| 15964 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15965 | .ops = &snd_hda_bind_sw, |
| 15966 | .values = { |
| 15967 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15968 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15969 | 0 |
| 15970 | }, |
| 15971 | }; |
| 15972 | |
| 15973 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15974 | HDA_BIND_VOL("Master Playback Volume", |
| 15975 | &alc663_asus_two_bind_master_vol), |
| 15976 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15977 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15978 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15979 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15980 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15981 | { } /* end */ |
| 15982 | }; |
| 15983 | |
| 15984 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15985 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15986 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15987 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15988 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15989 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15990 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15991 | { } /* end */ |
| 15992 | }; |
| 15993 | |
| 15994 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15995 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15996 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15997 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15998 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15999 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16000 | |
| 16001 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16003 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16004 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16005 | { } /* end */ |
| 16006 | }; |
| 16007 | |
| 16008 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 16009 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16010 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16011 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16012 | |
| 16013 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16014 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16015 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16016 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16017 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16018 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16019 | { } /* end */ |
| 16020 | }; |
| 16021 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16022 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 16023 | { |
| 16024 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16025 | .name = "Channel Mode", |
| 16026 | .info = alc_ch_mode_info, |
| 16027 | .get = alc_ch_mode_get, |
| 16028 | .put = alc_ch_mode_put, |
| 16029 | }, |
| 16030 | { } /* end */ |
| 16031 | }; |
| 16032 | |
| 16033 | static struct hda_verb alc662_init_verbs[] = { |
| 16034 | /* ADC: mute amp left and right */ |
| 16035 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16036 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16037 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 16038 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16044 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16045 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16047 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16048 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16049 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16050 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16051 | |
| 16052 | /* Front Pin: output 0 (0x0c) */ |
| 16053 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16054 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16055 | |
| 16056 | /* Rear Pin: output 1 (0x0d) */ |
| 16057 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16058 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16059 | |
| 16060 | /* CLFE Pin: output 2 (0x0e) */ |
| 16061 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16062 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16063 | |
| 16064 | /* Mic (rear) pin: input vref at 80% */ |
| 16065 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16066 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16067 | /* Front Mic pin: input vref at 80% */ |
| 16068 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16069 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16070 | /* Line In pin: input */ |
| 16071 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16072 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16073 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16074 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16075 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16076 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16077 | /* CD pin widget for input */ |
| 16078 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16079 | |
| 16080 | /* FIXME: use matrix-type input source selection */ |
| 16081 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16082 | /* Input mixer */ |
| 16083 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16084 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16085 | |
| 16086 | /* always trun on EAPD */ |
| 16087 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16088 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16089 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16090 | { } |
| 16091 | }; |
| 16092 | |
| 16093 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 16094 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16095 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16096 | {} |
| 16097 | }; |
| 16098 | |
| 16099 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 16100 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16101 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16102 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16103 | }; |
| 16104 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16105 | /* Set Unsolicited Event*/ |
| 16106 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 16107 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16108 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16109 | {} |
| 16110 | }; |
| 16111 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16112 | /* |
| 16113 | * generic initialization of ADC, input mixers and output mixers |
| 16114 | */ |
| 16115 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 16116 | /* |
| 16117 | * Unmute ADC and set the default input to mic-in |
| 16118 | */ |
| 16119 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16120 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16121 | |
| 16122 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 16123 | * mixer widget |
| 16124 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 16125 | * panel mic (mic 2) |
| 16126 | */ |
| 16127 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16128 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16129 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16130 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16133 | |
| 16134 | /* |
| 16135 | * Set up output mixers (0x0c - 0x0f) |
| 16136 | */ |
| 16137 | /* set vol=0 to output mixers */ |
| 16138 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16139 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16140 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16141 | |
| 16142 | /* set up input amps for analog loopback */ |
| 16143 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16144 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16145 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16146 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16147 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16148 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16149 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16150 | |
| 16151 | |
| 16152 | /* FIXME: use matrix-type input source selection */ |
| 16153 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16154 | /* Input mixer */ |
| 16155 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16156 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16157 | { } |
| 16158 | }; |
| 16159 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16160 | /* additional verbs for ALC663 */ |
| 16161 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16162 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16163 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16164 | { } |
| 16165 | }; |
| 16166 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16167 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16168 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16169 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16170 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16171 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16172 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16173 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16174 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16175 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16176 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16177 | {} |
| 16178 | }; |
| 16179 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16180 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16181 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16182 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16183 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16185 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16186 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16187 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16188 | {} |
| 16189 | }; |
| 16190 | |
| 16191 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16192 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16193 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16194 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16195 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16196 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16197 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16198 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16199 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16200 | {} |
| 16201 | }; |
| 16202 | |
| 16203 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16204 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16205 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16206 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16207 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16208 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16209 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16210 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16211 | {} |
| 16212 | }; |
| 16213 | |
| 16214 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16215 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16216 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16217 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16218 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16219 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16220 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16221 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16222 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16223 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16224 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16225 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16226 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16227 | {} |
| 16228 | }; |
| 16229 | |
| 16230 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16231 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16232 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16233 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16234 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16236 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16237 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16238 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16239 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16240 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16241 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16242 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16243 | {} |
| 16244 | }; |
| 16245 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16246 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16248 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16249 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16250 | |
| 16251 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16252 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16253 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16254 | |
| 16255 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16256 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16257 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16258 | {} |
| 16259 | }; |
| 16260 | |
| 16261 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16262 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16263 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16264 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16265 | |
| 16266 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16267 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16268 | {} |
| 16269 | }; |
| 16270 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16271 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16272 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16273 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16274 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16275 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16276 | {} |
| 16277 | }; |
| 16278 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16279 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16280 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16281 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16282 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16283 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16284 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16285 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16286 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16287 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16288 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16289 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16290 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16291 | {} |
| 16292 | }; |
| 16293 | |
| 16294 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16295 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16296 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16297 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16298 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16299 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16300 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16301 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16302 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16303 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16304 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16305 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16306 | {} |
| 16307 | }; |
| 16308 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16309 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16310 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16311 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16312 | { } /* end */ |
| 16313 | }; |
| 16314 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16315 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16316 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16317 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16318 | { } /* end */ |
| 16319 | }; |
| 16320 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16321 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16322 | { |
| 16323 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16324 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16325 | |
| 16326 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16327 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16328 | bits = present ? HDA_AMP_MUTE : 0; |
| 16329 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16330 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16331 | } |
| 16332 | |
| 16333 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16334 | { |
| 16335 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16336 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16337 | |
| 16338 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16339 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16340 | bits = present ? HDA_AMP_MUTE : 0; |
| 16341 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16342 | HDA_AMP_MUTE, bits); |
| 16343 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16344 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16345 | } |
| 16346 | |
| 16347 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16348 | unsigned int res) |
| 16349 | { |
| 16350 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16351 | alc662_lenovo_101e_all_automute(codec); |
| 16352 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16353 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16354 | } |
| 16355 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16356 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 16357 | { |
| 16358 | unsigned int present; |
| 16359 | |
| 16360 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 16361 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 16362 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16363 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16364 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16365 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16366 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16367 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16368 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16369 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16370 | } |
| 16371 | |
| 16372 | /* unsolicited event for HP jack sensing */ |
| 16373 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16374 | unsigned int res) |
| 16375 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16376 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 16377 | alc662_eeepc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16378 | else |
| 16379 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16380 | } |
| 16381 | |
| 16382 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16383 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16384 | alc262_hippo1_init_hook(codec); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16385 | alc662_eeepc_mic_automute(codec); |
| 16386 | } |
| 16387 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16388 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 16389 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16390 | struct alc_spec *spec = codec->spec; |
| 16391 | |
| 16392 | spec->autocfg.hp_pins[0] = 0x14; |
| 16393 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 16394 | alc262_hippo_master_update(codec); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16395 | } |
| 16396 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16397 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16398 | { |
| 16399 | unsigned int present; |
| 16400 | unsigned char bits; |
| 16401 | |
| 16402 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16403 | AC_VERB_GET_PIN_SENSE, 0) |
| 16404 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16405 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16406 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16407 | AMP_IN_MUTE(0), bits); |
| 16408 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16409 | AMP_IN_MUTE(0), bits); |
| 16410 | } |
| 16411 | |
| 16412 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16413 | { |
| 16414 | unsigned int present; |
| 16415 | unsigned char bits; |
| 16416 | |
| 16417 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16418 | AC_VERB_GET_PIN_SENSE, 0) |
| 16419 | & AC_PINSENSE_PRESENCE; |
| 16420 | bits = present ? HDA_AMP_MUTE : 0; |
| 16421 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16422 | AMP_IN_MUTE(0), bits); |
| 16423 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16424 | AMP_IN_MUTE(0), bits); |
| 16425 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16426 | AMP_IN_MUTE(0), bits); |
| 16427 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16428 | AMP_IN_MUTE(0), bits); |
| 16429 | } |
| 16430 | |
| 16431 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16432 | { |
| 16433 | unsigned int present; |
| 16434 | unsigned char bits; |
| 16435 | |
| 16436 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16437 | AC_VERB_GET_PIN_SENSE, 0) |
| 16438 | & AC_PINSENSE_PRESENCE; |
| 16439 | bits = present ? HDA_AMP_MUTE : 0; |
| 16440 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16441 | AMP_IN_MUTE(0), bits); |
| 16442 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16443 | AMP_IN_MUTE(0), bits); |
| 16444 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16445 | AMP_IN_MUTE(0), bits); |
| 16446 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16447 | AMP_IN_MUTE(0), bits); |
| 16448 | } |
| 16449 | |
| 16450 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16451 | { |
| 16452 | unsigned int present; |
| 16453 | unsigned char bits; |
| 16454 | |
| 16455 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16456 | AC_VERB_GET_PIN_SENSE, 0) |
| 16457 | & AC_PINSENSE_PRESENCE; |
| 16458 | bits = present ? 0 : PIN_OUT; |
| 16459 | snd_hda_codec_write(codec, 0x14, 0, |
| 16460 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16461 | } |
| 16462 | |
| 16463 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16464 | { |
| 16465 | unsigned int present1, present2; |
| 16466 | |
| 16467 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16468 | AC_VERB_GET_PIN_SENSE, 0) |
| 16469 | & AC_PINSENSE_PRESENCE; |
| 16470 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16471 | AC_VERB_GET_PIN_SENSE, 0) |
| 16472 | & AC_PINSENSE_PRESENCE; |
| 16473 | |
| 16474 | if (present1 || present2) { |
| 16475 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16476 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16477 | } else { |
| 16478 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16479 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16480 | } |
| 16481 | } |
| 16482 | |
| 16483 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16484 | { |
| 16485 | unsigned int present1, present2; |
| 16486 | |
| 16487 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16488 | AC_VERB_GET_PIN_SENSE, 0) |
| 16489 | & AC_PINSENSE_PRESENCE; |
| 16490 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16491 | AC_VERB_GET_PIN_SENSE, 0) |
| 16492 | & AC_PINSENSE_PRESENCE; |
| 16493 | |
| 16494 | if (present1 || present2) { |
| 16495 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16496 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16497 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16498 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16499 | } else { |
| 16500 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16501 | AMP_IN_MUTE(0), 0); |
| 16502 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16503 | AMP_IN_MUTE(0), 0); |
| 16504 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16505 | } |
| 16506 | |
| 16507 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16508 | { |
| 16509 | unsigned int present; |
| 16510 | |
| 16511 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16512 | AC_VERB_GET_PIN_SENSE, 0) |
| 16513 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16514 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16515 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16516 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16517 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16518 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16519 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16520 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16521 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16522 | } |
| 16523 | |
| 16524 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16525 | unsigned int res) |
| 16526 | { |
| 16527 | switch (res >> 26) { |
| 16528 | case ALC880_HP_EVENT: |
| 16529 | alc663_m51va_speaker_automute(codec); |
| 16530 | break; |
| 16531 | case ALC880_MIC_EVENT: |
| 16532 | alc663_m51va_mic_automute(codec); |
| 16533 | break; |
| 16534 | } |
| 16535 | } |
| 16536 | |
| 16537 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16538 | { |
| 16539 | alc663_m51va_speaker_automute(codec); |
| 16540 | alc663_m51va_mic_automute(codec); |
| 16541 | } |
| 16542 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16543 | /* ***************** Mode1 ******************************/ |
| 16544 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16545 | unsigned int res) |
| 16546 | { |
| 16547 | switch (res >> 26) { |
| 16548 | case ALC880_HP_EVENT: |
| 16549 | alc663_m51va_speaker_automute(codec); |
| 16550 | break; |
| 16551 | case ALC880_MIC_EVENT: |
| 16552 | alc662_eeepc_mic_automute(codec); |
| 16553 | break; |
| 16554 | } |
| 16555 | } |
| 16556 | |
| 16557 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16558 | { |
| 16559 | alc663_m51va_speaker_automute(codec); |
| 16560 | alc662_eeepc_mic_automute(codec); |
| 16561 | } |
| 16562 | /* ***************** Mode2 ******************************/ |
| 16563 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16564 | unsigned int res) |
| 16565 | { |
| 16566 | switch (res >> 26) { |
| 16567 | case ALC880_HP_EVENT: |
| 16568 | alc662_f5z_speaker_automute(codec); |
| 16569 | break; |
| 16570 | case ALC880_MIC_EVENT: |
| 16571 | alc662_eeepc_mic_automute(codec); |
| 16572 | break; |
| 16573 | } |
| 16574 | } |
| 16575 | |
| 16576 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16577 | { |
| 16578 | alc662_f5z_speaker_automute(codec); |
| 16579 | alc662_eeepc_mic_automute(codec); |
| 16580 | } |
| 16581 | /* ***************** Mode3 ******************************/ |
| 16582 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16583 | unsigned int res) |
| 16584 | { |
| 16585 | switch (res >> 26) { |
| 16586 | case ALC880_HP_EVENT: |
| 16587 | alc663_two_hp_m1_speaker_automute(codec); |
| 16588 | break; |
| 16589 | case ALC880_MIC_EVENT: |
| 16590 | alc662_eeepc_mic_automute(codec); |
| 16591 | break; |
| 16592 | } |
| 16593 | } |
| 16594 | |
| 16595 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16596 | { |
| 16597 | alc663_two_hp_m1_speaker_automute(codec); |
| 16598 | alc662_eeepc_mic_automute(codec); |
| 16599 | } |
| 16600 | /* ***************** Mode4 ******************************/ |
| 16601 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16602 | unsigned int res) |
| 16603 | { |
| 16604 | switch (res >> 26) { |
| 16605 | case ALC880_HP_EVENT: |
| 16606 | alc663_21jd_two_speaker_automute(codec); |
| 16607 | break; |
| 16608 | case ALC880_MIC_EVENT: |
| 16609 | alc662_eeepc_mic_automute(codec); |
| 16610 | break; |
| 16611 | } |
| 16612 | } |
| 16613 | |
| 16614 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16615 | { |
| 16616 | alc663_21jd_two_speaker_automute(codec); |
| 16617 | alc662_eeepc_mic_automute(codec); |
| 16618 | } |
| 16619 | /* ***************** Mode5 ******************************/ |
| 16620 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16621 | unsigned int res) |
| 16622 | { |
| 16623 | switch (res >> 26) { |
| 16624 | case ALC880_HP_EVENT: |
| 16625 | alc663_15jd_two_speaker_automute(codec); |
| 16626 | break; |
| 16627 | case ALC880_MIC_EVENT: |
| 16628 | alc662_eeepc_mic_automute(codec); |
| 16629 | break; |
| 16630 | } |
| 16631 | } |
| 16632 | |
| 16633 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16634 | { |
| 16635 | alc663_15jd_two_speaker_automute(codec); |
| 16636 | alc662_eeepc_mic_automute(codec); |
| 16637 | } |
| 16638 | /* ***************** Mode6 ******************************/ |
| 16639 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16640 | unsigned int res) |
| 16641 | { |
| 16642 | switch (res >> 26) { |
| 16643 | case ALC880_HP_EVENT: |
| 16644 | alc663_two_hp_m2_speaker_automute(codec); |
| 16645 | break; |
| 16646 | case ALC880_MIC_EVENT: |
| 16647 | alc662_eeepc_mic_automute(codec); |
| 16648 | break; |
| 16649 | } |
| 16650 | } |
| 16651 | |
| 16652 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16653 | { |
| 16654 | alc663_two_hp_m2_speaker_automute(codec); |
| 16655 | alc662_eeepc_mic_automute(codec); |
| 16656 | } |
| 16657 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16658 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16659 | { |
| 16660 | unsigned int present; |
| 16661 | unsigned char bits; |
| 16662 | |
| 16663 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16664 | AC_VERB_GET_PIN_SENSE, 0) |
| 16665 | & AC_PINSENSE_PRESENCE; |
| 16666 | bits = present ? HDA_AMP_MUTE : 0; |
| 16667 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16668 | HDA_AMP_MUTE, bits); |
| 16669 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16670 | HDA_AMP_MUTE, bits); |
| 16671 | } |
| 16672 | |
| 16673 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16674 | { |
| 16675 | unsigned int present; |
| 16676 | unsigned char bits; |
| 16677 | |
| 16678 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16679 | AC_VERB_GET_PIN_SENSE, 0) |
| 16680 | & AC_PINSENSE_PRESENCE; |
| 16681 | bits = present ? HDA_AMP_MUTE : 0; |
| 16682 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16683 | HDA_AMP_MUTE, bits); |
| 16684 | } |
| 16685 | |
| 16686 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16687 | unsigned int res) |
| 16688 | { |
| 16689 | switch (res >> 26) { |
| 16690 | case ALC880_HP_EVENT: |
| 16691 | alc663_g71v_hp_automute(codec); |
| 16692 | break; |
| 16693 | case ALC880_FRONT_EVENT: |
| 16694 | alc663_g71v_front_automute(codec); |
| 16695 | break; |
| 16696 | case ALC880_MIC_EVENT: |
| 16697 | alc662_eeepc_mic_automute(codec); |
| 16698 | break; |
| 16699 | } |
| 16700 | } |
| 16701 | |
| 16702 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16703 | { |
| 16704 | alc663_g71v_front_automute(codec); |
| 16705 | alc663_g71v_hp_automute(codec); |
| 16706 | alc662_eeepc_mic_automute(codec); |
| 16707 | } |
| 16708 | |
| 16709 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16710 | unsigned int res) |
| 16711 | { |
| 16712 | switch (res >> 26) { |
| 16713 | case ALC880_HP_EVENT: |
| 16714 | alc663_m51va_speaker_automute(codec); |
| 16715 | break; |
| 16716 | case ALC880_MIC_EVENT: |
| 16717 | alc662_eeepc_mic_automute(codec); |
| 16718 | break; |
| 16719 | } |
| 16720 | } |
| 16721 | |
| 16722 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16723 | { |
| 16724 | alc663_m51va_speaker_automute(codec); |
| 16725 | alc662_eeepc_mic_automute(codec); |
| 16726 | } |
| 16727 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16728 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16729 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16730 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16731 | |
| 16732 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16733 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16734 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16735 | |
| 16736 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16737 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16738 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16739 | { } /* end */ |
| 16740 | }; |
| 16741 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16742 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16743 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16744 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16745 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16746 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16747 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16748 | |
| 16749 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16750 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16751 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16752 | |
| 16753 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16754 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16755 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16756 | { } /* end */ |
| 16757 | }; |
| 16758 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16759 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16760 | #define alc662_loopbacks alc880_loopbacks |
| 16761 | #endif |
| 16762 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16763 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16764 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16765 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16766 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16767 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16768 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16769 | |
| 16770 | /* |
| 16771 | * configuration and preset |
| 16772 | */ |
| 16773 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16774 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16775 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16776 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16777 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16778 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16779 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16780 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16781 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16782 | [ALC663_ASUS_M51VA] = "m51va", |
| 16783 | [ALC663_ASUS_G71V] = "g71v", |
| 16784 | [ALC663_ASUS_H13] = "h13", |
| 16785 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16786 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16787 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16788 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16789 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16790 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16791 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16792 | [ALC272_DELL] = "dell", |
| 16793 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16794 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16795 | [ALC662_AUTO] = "auto", |
| 16796 | }; |
| 16797 | |
| 16798 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16799 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16800 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16801 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16802 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16803 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16804 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16805 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16806 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16807 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16808 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16809 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16810 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16811 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16812 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16813 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16814 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16815 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16816 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16817 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16818 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16819 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16820 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16821 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16822 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16823 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16824 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16825 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16826 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16827 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16828 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16829 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16830 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16831 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16832 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16833 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16834 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16835 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16836 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16837 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16838 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16839 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16840 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16841 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16842 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16843 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16844 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16845 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16846 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16847 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16848 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16849 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16850 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16851 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16852 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16853 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16854 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16855 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16856 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16857 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16858 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16859 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16860 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16861 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16862 | {} |
| 16863 | }; |
| 16864 | |
| 16865 | static struct alc_config_preset alc662_presets[] = { |
| 16866 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16867 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16868 | .init_verbs = { alc662_init_verbs }, |
| 16869 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16870 | .dac_nids = alc662_dac_nids, |
| 16871 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16872 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16873 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16874 | .channel_mode = alc662_3ST_2ch_modes, |
| 16875 | .input_mux = &alc662_capture_source, |
| 16876 | }, |
| 16877 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16878 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16879 | .init_verbs = { alc662_init_verbs }, |
| 16880 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16881 | .dac_nids = alc662_dac_nids, |
| 16882 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16883 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16884 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16885 | .channel_mode = alc662_3ST_6ch_modes, |
| 16886 | .need_dac_fix = 1, |
| 16887 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16888 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16889 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16890 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16891 | .init_verbs = { alc662_init_verbs }, |
| 16892 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16893 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16894 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16895 | .channel_mode = alc662_3ST_6ch_modes, |
| 16896 | .need_dac_fix = 1, |
| 16897 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16898 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16899 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16900 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16901 | .init_verbs = { alc662_init_verbs }, |
| 16902 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16903 | .dac_nids = alc662_dac_nids, |
| 16904 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16905 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16906 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16907 | .channel_mode = alc662_5stack_modes, |
| 16908 | .input_mux = &alc662_capture_source, |
| 16909 | }, |
| 16910 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16911 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16912 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16913 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16914 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16915 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16916 | .channel_mode = alc662_3ST_2ch_modes, |
| 16917 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16918 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16919 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16920 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16921 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16922 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16923 | .init_verbs = { alc662_init_verbs, |
| 16924 | alc662_eeepc_sue_init_verbs }, |
| 16925 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16926 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16927 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16928 | .channel_mode = alc662_3ST_2ch_modes, |
| 16929 | .input_mux = &alc662_eeepc_capture_source, |
| 16930 | .unsol_event = alc662_eeepc_unsol_event, |
| 16931 | .init_hook = alc662_eeepc_inithook, |
| 16932 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16933 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16934 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16935 | alc662_chmode_mixer }, |
| 16936 | .init_verbs = { alc662_init_verbs, |
| 16937 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16938 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16939 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16940 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16941 | .channel_mode = alc662_3ST_6ch_modes, |
| 16942 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16943 | .unsol_event = alc662_eeepc_unsol_event, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16944 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16945 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16946 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16947 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16948 | .init_verbs = { alc662_init_verbs, |
| 16949 | alc662_ecs_init_verbs }, |
| 16950 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16951 | .dac_nids = alc662_dac_nids, |
| 16952 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16953 | .channel_mode = alc662_3ST_2ch_modes, |
| 16954 | .input_mux = &alc662_eeepc_capture_source, |
| 16955 | .unsol_event = alc662_eeepc_unsol_event, |
| 16956 | .init_hook = alc662_eeepc_inithook, |
| 16957 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16958 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16959 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16960 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16961 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16962 | .dac_nids = alc662_dac_nids, |
| 16963 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16964 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16965 | .channel_mode = alc662_3ST_2ch_modes, |
| 16966 | .input_mux = &alc663_m51va_capture_source, |
| 16967 | .unsol_event = alc663_m51va_unsol_event, |
| 16968 | .init_hook = alc663_m51va_inithook, |
| 16969 | }, |
| 16970 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16971 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16972 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16973 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16974 | .dac_nids = alc662_dac_nids, |
| 16975 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16976 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16977 | .channel_mode = alc662_3ST_2ch_modes, |
| 16978 | .input_mux = &alc662_eeepc_capture_source, |
| 16979 | .unsol_event = alc663_g71v_unsol_event, |
| 16980 | .init_hook = alc663_g71v_inithook, |
| 16981 | }, |
| 16982 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16983 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16984 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16985 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16986 | .dac_nids = alc662_dac_nids, |
| 16987 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16988 | .channel_mode = alc662_3ST_2ch_modes, |
| 16989 | .input_mux = &alc663_m51va_capture_source, |
| 16990 | .unsol_event = alc663_m51va_unsol_event, |
| 16991 | .init_hook = alc663_m51va_inithook, |
| 16992 | }, |
| 16993 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16994 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16995 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16996 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16997 | .dac_nids = alc662_dac_nids, |
| 16998 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16999 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17000 | .channel_mode = alc662_3ST_6ch_modes, |
| 17001 | .input_mux = &alc663_capture_source, |
| 17002 | .unsol_event = alc663_g50v_unsol_event, |
| 17003 | .init_hook = alc663_g50v_inithook, |
| 17004 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17005 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17006 | .mixers = { alc663_m51va_mixer }, |
| 17007 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17008 | .init_verbs = { alc662_init_verbs, |
| 17009 | alc663_21jd_amic_init_verbs }, |
| 17010 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17011 | .hp_nid = 0x03, |
| 17012 | .dac_nids = alc662_dac_nids, |
| 17013 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17014 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17015 | .channel_mode = alc662_3ST_2ch_modes, |
| 17016 | .input_mux = &alc662_eeepc_capture_source, |
| 17017 | .unsol_event = alc663_mode1_unsol_event, |
| 17018 | .init_hook = alc663_mode1_inithook, |
| 17019 | }, |
| 17020 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17021 | .mixers = { alc662_1bjd_mixer }, |
| 17022 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17023 | .init_verbs = { alc662_init_verbs, |
| 17024 | alc662_1bjd_amic_init_verbs }, |
| 17025 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17026 | .dac_nids = alc662_dac_nids, |
| 17027 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17028 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17029 | .channel_mode = alc662_3ST_2ch_modes, |
| 17030 | .input_mux = &alc662_eeepc_capture_source, |
| 17031 | .unsol_event = alc662_mode2_unsol_event, |
| 17032 | .init_hook = alc662_mode2_inithook, |
| 17033 | }, |
| 17034 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17035 | .mixers = { alc663_two_hp_m1_mixer }, |
| 17036 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17037 | .init_verbs = { alc662_init_verbs, |
| 17038 | alc663_two_hp_amic_m1_init_verbs }, |
| 17039 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17040 | .hp_nid = 0x03, |
| 17041 | .dac_nids = alc662_dac_nids, |
| 17042 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17043 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17044 | .channel_mode = alc662_3ST_2ch_modes, |
| 17045 | .input_mux = &alc662_eeepc_capture_source, |
| 17046 | .unsol_event = alc663_mode3_unsol_event, |
| 17047 | .init_hook = alc663_mode3_inithook, |
| 17048 | }, |
| 17049 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17050 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 17051 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17052 | .init_verbs = { alc662_init_verbs, |
| 17053 | alc663_21jd_amic_init_verbs}, |
| 17054 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17055 | .hp_nid = 0x03, |
| 17056 | .dac_nids = alc662_dac_nids, |
| 17057 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17058 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17059 | .channel_mode = alc662_3ST_2ch_modes, |
| 17060 | .input_mux = &alc662_eeepc_capture_source, |
| 17061 | .unsol_event = alc663_mode4_unsol_event, |
| 17062 | .init_hook = alc663_mode4_inithook, |
| 17063 | }, |
| 17064 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17065 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 17066 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17067 | .init_verbs = { alc662_init_verbs, |
| 17068 | alc663_15jd_amic_init_verbs }, |
| 17069 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17070 | .hp_nid = 0x03, |
| 17071 | .dac_nids = alc662_dac_nids, |
| 17072 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17073 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17074 | .channel_mode = alc662_3ST_2ch_modes, |
| 17075 | .input_mux = &alc662_eeepc_capture_source, |
| 17076 | .unsol_event = alc663_mode5_unsol_event, |
| 17077 | .init_hook = alc663_mode5_inithook, |
| 17078 | }, |
| 17079 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17080 | .mixers = { alc663_two_hp_m2_mixer }, |
| 17081 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17082 | .init_verbs = { alc662_init_verbs, |
| 17083 | alc663_two_hp_amic_m2_init_verbs }, |
| 17084 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17085 | .hp_nid = 0x03, |
| 17086 | .dac_nids = alc662_dac_nids, |
| 17087 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17088 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17089 | .channel_mode = alc662_3ST_2ch_modes, |
| 17090 | .input_mux = &alc662_eeepc_capture_source, |
| 17091 | .unsol_event = alc663_mode6_unsol_event, |
| 17092 | .init_hook = alc663_mode6_inithook, |
| 17093 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17094 | [ALC272_DELL] = { |
| 17095 | .mixers = { alc663_m51va_mixer }, |
| 17096 | .cap_mixer = alc272_auto_capture_mixer, |
| 17097 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 17098 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17099 | .dac_nids = alc662_dac_nids, |
| 17100 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17101 | .adc_nids = alc272_adc_nids, |
| 17102 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 17103 | .capsrc_nids = alc272_capsrc_nids, |
| 17104 | .channel_mode = alc662_3ST_2ch_modes, |
| 17105 | .input_mux = &alc663_m51va_capture_source, |
| 17106 | .unsol_event = alc663_m51va_unsol_event, |
| 17107 | .init_hook = alc663_m51va_inithook, |
| 17108 | }, |
| 17109 | [ALC272_DELL_ZM1] = { |
| 17110 | .mixers = { alc663_m51va_mixer }, |
| 17111 | .cap_mixer = alc662_auto_capture_mixer, |
| 17112 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 17113 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17114 | .dac_nids = alc662_dac_nids, |
| 17115 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17116 | .adc_nids = alc662_adc_nids, |
| 17117 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 17118 | .capsrc_nids = alc662_capsrc_nids, |
| 17119 | .channel_mode = alc662_3ST_2ch_modes, |
| 17120 | .input_mux = &alc663_m51va_capture_source, |
| 17121 | .unsol_event = alc663_m51va_unsol_event, |
| 17122 | .init_hook = alc663_m51va_inithook, |
| 17123 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17124 | [ALC272_SAMSUNG_NC10] = { |
| 17125 | .mixers = { alc272_nc10_mixer }, |
| 17126 | .init_verbs = { alc662_init_verbs, |
| 17127 | alc663_21jd_amic_init_verbs }, |
| 17128 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17129 | .dac_nids = alc272_dac_nids, |
| 17130 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17131 | .channel_mode = alc662_3ST_2ch_modes, |
| 17132 | .input_mux = &alc272_nc10_capture_source, |
| 17133 | .unsol_event = alc663_mode4_unsol_event, |
| 17134 | .init_hook = alc663_mode4_inithook, |
| 17135 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17136 | }; |
| 17137 | |
| 17138 | |
| 17139 | /* |
| 17140 | * BIOS auto configuration |
| 17141 | */ |
| 17142 | |
| 17143 | /* add playback controls from the parsed DAC table */ |
| 17144 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17145 | const struct auto_pin_cfg *cfg) |
| 17146 | { |
| 17147 | char name[32]; |
| 17148 | static const char *chname[4] = { |
| 17149 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17150 | }; |
| 17151 | hda_nid_t nid; |
| 17152 | int i, err; |
| 17153 | |
| 17154 | for (i = 0; i < cfg->line_outs; i++) { |
| 17155 | if (!spec->multiout.dac_nids[i]) |
| 17156 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17157 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17158 | if (i == 2) { |
| 17159 | /* Center/LFE */ |
| 17160 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17161 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17162 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 17163 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17164 | if (err < 0) |
| 17165 | return err; |
| 17166 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17167 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17168 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 17169 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17170 | if (err < 0) |
| 17171 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17172 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17173 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17174 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17175 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17176 | if (err < 0) |
| 17177 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17178 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17179 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17180 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17181 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17182 | if (err < 0) |
| 17183 | return err; |
| 17184 | } else { |
| 17185 | sprintf(name, "%s Playback Volume", chname[i]); |
| 17186 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17187 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 17188 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17189 | if (err < 0) |
| 17190 | return err; |
| 17191 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17192 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17193 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 17194 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17195 | if (err < 0) |
| 17196 | return err; |
| 17197 | } |
| 17198 | } |
| 17199 | return 0; |
| 17200 | } |
| 17201 | |
| 17202 | /* add playback controls for speaker and HP outputs */ |
| 17203 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 17204 | const char *pfx) |
| 17205 | { |
| 17206 | hda_nid_t nid; |
| 17207 | int err; |
| 17208 | char name[32]; |
| 17209 | |
| 17210 | if (!pin) |
| 17211 | return 0; |
| 17212 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17213 | if (pin == 0x17) { |
| 17214 | /* ALC663 has a mono output pin on 0x17 */ |
| 17215 | sprintf(name, "%s Playback Switch", pfx); |
| 17216 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17217 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 17218 | return err; |
| 17219 | } |
| 17220 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17221 | if (alc880_is_fixed_pin(pin)) { |
| 17222 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 17223 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17224 | /* specify the DAC as the extra output */ |
| 17225 | if (!spec->multiout.hp_nid) |
| 17226 | spec->multiout.hp_nid = nid; |
| 17227 | else |
| 17228 | spec->multiout.extra_out_nid[0] = nid; |
| 17229 | /* control HP volume/switch on the output mixer amp */ |
| 17230 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17231 | sprintf(name, "%s Playback Volume", pfx); |
| 17232 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 17233 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 17234 | if (err < 0) |
| 17235 | return err; |
| 17236 | sprintf(name, "%s Playback Switch", pfx); |
| 17237 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 17238 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 17239 | if (err < 0) |
| 17240 | return err; |
| 17241 | } else if (alc880_is_multi_pin(pin)) { |
| 17242 | /* set manual connection */ |
| 17243 | /* we have only a switch on HP-out PIN */ |
| 17244 | sprintf(name, "%s Playback Switch", pfx); |
| 17245 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17246 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17247 | if (err < 0) |
| 17248 | return err; |
| 17249 | } |
| 17250 | return 0; |
| 17251 | } |
| 17252 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17253 | /* return the index of the src widget from the connection list of the nid. |
| 17254 | * return -1 if not found |
| 17255 | */ |
| 17256 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 17257 | hda_nid_t src) |
| 17258 | { |
| 17259 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 17260 | int i, conns; |
| 17261 | |
| 17262 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 17263 | ARRAY_SIZE(conn_list)); |
| 17264 | if (conns < 0) |
| 17265 | return -1; |
| 17266 | for (i = 0; i < conns; i++) |
| 17267 | if (conn_list[i] == src) |
| 17268 | return i; |
| 17269 | return -1; |
| 17270 | } |
| 17271 | |
| 17272 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 17273 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 17274 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17275 | return (pincap & AC_PINCAP_IN) != 0; |
| 17276 | } |
| 17277 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17278 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17279 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17280 | const struct auto_pin_cfg *cfg) |
| 17281 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17282 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17283 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17284 | int i, err, idx; |
| 17285 | |
| 17286 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17287 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 17288 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 17289 | cfg->input_pins[i]); |
| 17290 | if (idx >= 0) { |
| 17291 | err = new_analog_input(spec, cfg->input_pins[i], |
| 17292 | auto_pin_cfg_labels[i], |
| 17293 | idx, 0x0b); |
| 17294 | if (err < 0) |
| 17295 | return err; |
| 17296 | } |
| 17297 | idx = alc662_input_pin_idx(codec, 0x22, |
| 17298 | cfg->input_pins[i]); |
| 17299 | if (idx >= 0) { |
| 17300 | imux->items[imux->num_items].label = |
| 17301 | auto_pin_cfg_labels[i]; |
| 17302 | imux->items[imux->num_items].index = idx; |
| 17303 | imux->num_items++; |
| 17304 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17305 | } |
| 17306 | } |
| 17307 | return 0; |
| 17308 | } |
| 17309 | |
| 17310 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17311 | hda_nid_t nid, int pin_type, |
| 17312 | int dac_idx) |
| 17313 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17314 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17315 | /* need the manual connection? */ |
| 17316 | if (alc880_is_multi_pin(nid)) { |
| 17317 | struct alc_spec *spec = codec->spec; |
| 17318 | int idx = alc880_multi_pin_idx(nid); |
| 17319 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 17320 | AC_VERB_SET_CONNECT_SEL, |
| 17321 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 17322 | } |
| 17323 | } |
| 17324 | |
| 17325 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17326 | { |
| 17327 | struct alc_spec *spec = codec->spec; |
| 17328 | int i; |
| 17329 | |
| 17330 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17331 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17332 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17333 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17334 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17335 | i); |
| 17336 | } |
| 17337 | } |
| 17338 | |
| 17339 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17340 | { |
| 17341 | struct alc_spec *spec = codec->spec; |
| 17342 | hda_nid_t pin; |
| 17343 | |
| 17344 | pin = spec->autocfg.hp_pins[0]; |
| 17345 | if (pin) /* connect to front */ |
| 17346 | /* use dac 0 */ |
| 17347 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17348 | pin = spec->autocfg.speaker_pins[0]; |
| 17349 | if (pin) |
| 17350 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17351 | } |
| 17352 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17353 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17354 | |
| 17355 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17356 | { |
| 17357 | struct alc_spec *spec = codec->spec; |
| 17358 | int i; |
| 17359 | |
| 17360 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17361 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17362 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17363 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17364 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17365 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17366 | snd_hda_codec_write(codec, nid, 0, |
| 17367 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17368 | AMP_OUT_MUTE); |
| 17369 | } |
| 17370 | } |
| 17371 | } |
| 17372 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17373 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17374 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17375 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17376 | { |
| 17377 | struct alc_spec *spec = codec->spec; |
| 17378 | int err; |
| 17379 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17380 | |
| 17381 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17382 | alc662_ignore); |
| 17383 | if (err < 0) |
| 17384 | return err; |
| 17385 | if (!spec->autocfg.line_outs) |
| 17386 | return 0; /* can't find valid BIOS pin config */ |
| 17387 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17388 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17389 | if (err < 0) |
| 17390 | return err; |
| 17391 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17392 | if (err < 0) |
| 17393 | return err; |
| 17394 | err = alc662_auto_create_extra_out(spec, |
| 17395 | spec->autocfg.speaker_pins[0], |
| 17396 | "Speaker"); |
| 17397 | if (err < 0) |
| 17398 | return err; |
| 17399 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17400 | "Headphone"); |
| 17401 | if (err < 0) |
| 17402 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17403 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17404 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17405 | return err; |
| 17406 | |
| 17407 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17408 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17409 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17410 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17411 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17412 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17413 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17414 | |
| 17415 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17416 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17417 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17418 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17419 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17420 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17421 | |
| 17422 | err = alc_auto_add_mic_boost(codec); |
| 17423 | if (err < 0) |
| 17424 | return err; |
| 17425 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17426 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17427 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17428 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17429 | } |
| 17430 | |
| 17431 | /* additional initialization for auto-configuration model */ |
| 17432 | static void alc662_auto_init(struct hda_codec *codec) |
| 17433 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17434 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17435 | alc662_auto_init_multi_out(codec); |
| 17436 | alc662_auto_init_hp_out(codec); |
| 17437 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17438 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17439 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17440 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17441 | } |
| 17442 | |
| 17443 | static int patch_alc662(struct hda_codec *codec) |
| 17444 | { |
| 17445 | struct alc_spec *spec; |
| 17446 | int err, board_config; |
| 17447 | |
| 17448 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17449 | if (!spec) |
| 17450 | return -ENOMEM; |
| 17451 | |
| 17452 | codec->spec = spec; |
| 17453 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17454 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17455 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17456 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17457 | alc662_models, |
| 17458 | alc662_cfg_tbl); |
| 17459 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 17460 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 17461 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17462 | board_config = ALC662_AUTO; |
| 17463 | } |
| 17464 | |
| 17465 | if (board_config == ALC662_AUTO) { |
| 17466 | /* automatic parse from the BIOS config */ |
| 17467 | err = alc662_parse_auto_config(codec); |
| 17468 | if (err < 0) { |
| 17469 | alc_free(codec); |
| 17470 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17471 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17472 | printk(KERN_INFO |
| 17473 | "hda_codec: Cannot set up configuration " |
| 17474 | "from BIOS. Using base mode...\n"); |
| 17475 | board_config = ALC662_3ST_2ch_DIG; |
| 17476 | } |
| 17477 | } |
| 17478 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17479 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17480 | if (err < 0) { |
| 17481 | alc_free(codec); |
| 17482 | return err; |
| 17483 | } |
| 17484 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17485 | if (board_config != ALC662_AUTO) |
| 17486 | setup_preset(spec, &alc662_presets[board_config]); |
| 17487 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17488 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17489 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17490 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17491 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17492 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17493 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17494 | spec->adc_nids = alc662_adc_nids; |
| 17495 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17496 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17497 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17498 | if (!spec->cap_mixer) |
| 17499 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17500 | if (codec->vendor_id == 0x10ec0662) |
| 17501 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17502 | else |
| 17503 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17504 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17505 | spec->vmaster_nid = 0x02; |
| 17506 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17507 | codec->patch_ops = alc_patch_ops; |
| 17508 | if (board_config == ALC662_AUTO) |
| 17509 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17510 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17511 | if (!spec->loopback.amplist) |
| 17512 | spec->loopback.amplist = alc662_loopbacks; |
| 17513 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17514 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17515 | |
| 17516 | return 0; |
| 17517 | } |
| 17518 | |
| 17519 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17520 | * patch entries |
| 17521 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17522 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17523 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17524 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17525 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17526 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17527 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17528 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17529 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17530 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17531 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17532 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17533 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17534 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 17535 | .patch = patch_alc883 }, |
| 17536 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17537 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17538 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17539 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17540 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 17541 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17542 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 17543 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17544 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 17545 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17546 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 17547 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17548 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 17549 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 17550 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17551 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17552 | {} /* terminator */ |
| 17553 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17554 | |
| 17555 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17556 | |
| 17557 | MODULE_LICENSE("GPL"); |
| 17558 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17559 | |
| 17560 | static struct hda_codec_preset_list realtek_list = { |
| 17561 | .preset = snd_hda_preset_realtek, |
| 17562 | .owner = THIS_MODULE, |
| 17563 | }; |
| 17564 | |
| 17565 | static int __init patch_realtek_init(void) |
| 17566 | { |
| 17567 | return snd_hda_add_codec_preset(&realtek_list); |
| 17568 | } |
| 17569 | |
| 17570 | static void __exit patch_realtek_exit(void) |
| 17571 | { |
| 17572 | snd_hda_delete_codec_preset(&realtek_list); |
| 17573 | } |
| 17574 | |
| 17575 | module_init(patch_realtek_init) |
| 17576 | module_exit(patch_realtek_exit) |