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; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 948 | unsigned int present; |
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 | |
| 952 | /* need to execute and sync at first */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 953 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 954 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 955 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 956 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 957 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 958 | nid = spec->autocfg.speaker_pins[i]; |
| 959 | if (!nid) |
| 960 | break; |
| 961 | snd_hda_codec_write(codec, nid, 0, |
| 962 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 963 | spec->jack_present ? 0 : PIN_OUT); |
| 964 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 965 | } |
| 966 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 967 | #if 0 /* it's broken in some cases -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 968 | static void alc_mic_automute(struct hda_codec *codec) |
| 969 | { |
| 970 | struct alc_spec *spec = codec->spec; |
| 971 | unsigned int present; |
| 972 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 973 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 974 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 975 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 976 | |
| 977 | capsrc_idx_mic = mic_nid - 0x18; |
| 978 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 979 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 980 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 981 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 982 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 983 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 984 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 985 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 986 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 987 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 988 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 989 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 990 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 991 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 992 | /* unsolicited event for HP jack sensing */ |
| 993 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 994 | { |
| 995 | if (codec->vendor_id == 0x10ec0880) |
| 996 | res >>= 28; |
| 997 | else |
| 998 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 999 | switch (res) { |
| 1000 | case ALC880_HP_EVENT: |
| 1001 | alc_automute_pin(codec); |
| 1002 | break; |
| 1003 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1004 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1005 | break; |
| 1006 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1007 | } |
| 1008 | |
| 1009 | static void alc_inithook(struct hda_codec *codec) |
| 1010 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1011 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1012 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1013 | } |
| 1014 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1015 | /* additional initialization for ALC888 variants */ |
| 1016 | static void alc888_coef_init(struct hda_codec *codec) |
| 1017 | { |
| 1018 | unsigned int tmp; |
| 1019 | |
| 1020 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1021 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1022 | 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] | 1023 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1024 | /* alc888S-VC */ |
| 1025 | snd_hda_codec_read(codec, 0x20, 0, |
| 1026 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1027 | else |
| 1028 | /* alc888-VB */ |
| 1029 | snd_hda_codec_read(codec, 0x20, 0, |
| 1030 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1031 | } |
| 1032 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1033 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1034 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1035 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1036 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1037 | switch (type) { |
| 1038 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1039 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1040 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1041 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1042 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1043 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1044 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1045 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1046 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1047 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1048 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1049 | case 0x10ec0260: |
| 1050 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1051 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1052 | snd_hda_codec_write(codec, 0x10, 0, |
| 1053 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1054 | break; |
| 1055 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1056 | case 0x10ec0267: |
| 1057 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1058 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1059 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1060 | case 0x10ec0660: |
| 1061 | case 0x10ec0662: |
| 1062 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1063 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1064 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1065 | snd_hda_codec_write(codec, 0x14, 0, |
| 1066 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1067 | snd_hda_codec_write(codec, 0x15, 0, |
| 1068 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1069 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1070 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1071 | switch (codec->vendor_id) { |
| 1072 | case 0x10ec0260: |
| 1073 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1074 | AC_VERB_SET_COEF_INDEX, 7); |
| 1075 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1076 | AC_VERB_GET_PROC_COEF, 0); |
| 1077 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1078 | AC_VERB_SET_COEF_INDEX, 7); |
| 1079 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1080 | AC_VERB_SET_PROC_COEF, |
| 1081 | tmp | 0x2010); |
| 1082 | break; |
| 1083 | case 0x10ec0262: |
| 1084 | case 0x10ec0880: |
| 1085 | case 0x10ec0882: |
| 1086 | case 0x10ec0883: |
| 1087 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1088 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1089 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1090 | snd_hda_codec_write(codec, 0x20, 0, |
| 1091 | AC_VERB_SET_COEF_INDEX, 7); |
| 1092 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1093 | AC_VERB_GET_PROC_COEF, 0); |
| 1094 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1095 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1096 | snd_hda_codec_write(codec, 0x20, 0, |
| 1097 | AC_VERB_SET_PROC_COEF, |
| 1098 | tmp | 0x2010); |
| 1099 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1100 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1101 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1102 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1103 | case 0x10ec0267: |
| 1104 | case 0x10ec0268: |
| 1105 | snd_hda_codec_write(codec, 0x20, 0, |
| 1106 | AC_VERB_SET_COEF_INDEX, 7); |
| 1107 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1108 | AC_VERB_GET_PROC_COEF, 0); |
| 1109 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1110 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1111 | snd_hda_codec_write(codec, 0x20, 0, |
| 1112 | AC_VERB_SET_PROC_COEF, |
| 1113 | tmp | 0x3000); |
| 1114 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1115 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1116 | break; |
| 1117 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1118 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1119 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1120 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1121 | { |
| 1122 | struct alc_spec *spec = codec->spec; |
| 1123 | |
| 1124 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1125 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1126 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1127 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1128 | if (spec->autocfg.line_out_pins[0] && |
| 1129 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1130 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1131 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1132 | else |
| 1133 | return; |
| 1134 | } |
| 1135 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1136 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1137 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1138 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1139 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1140 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1141 | spec->unsol_event = alc_sku_unsol_event; |
| 1142 | } |
| 1143 | |
| 1144 | /* check subsystem ID and set up device-specific initialization; |
| 1145 | * return 1 if initialized, 0 if invalid SSID |
| 1146 | */ |
| 1147 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1148 | * 31 ~ 16 : Manufacture ID |
| 1149 | * 15 ~ 8 : SKU ID |
| 1150 | * 7 ~ 0 : Assembly ID |
| 1151 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1152 | */ |
| 1153 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1154 | hda_nid_t porta, hda_nid_t porte, |
| 1155 | hda_nid_t portd) |
| 1156 | { |
| 1157 | unsigned int ass, tmp, i; |
| 1158 | unsigned nid; |
| 1159 | struct alc_spec *spec = codec->spec; |
| 1160 | |
| 1161 | ass = codec->subsystem_id & 0xffff; |
| 1162 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1163 | goto do_sku; |
| 1164 | |
| 1165 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1166 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1167 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1168 | * 29~21 : reserve |
| 1169 | * 20 : PCBEEP input |
| 1170 | * 19~16 : Check sum (15:1) |
| 1171 | * 15~1 : Custom |
| 1172 | * 0 : override |
| 1173 | */ |
| 1174 | nid = 0x1d; |
| 1175 | if (codec->vendor_id == 0x10ec0260) |
| 1176 | nid = 0x17; |
| 1177 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1178 | snd_printd("realtek: No valid SSID, " |
| 1179 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1180 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1181 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1182 | return 0; |
| 1183 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1184 | return 0; |
| 1185 | |
| 1186 | /* check sum */ |
| 1187 | tmp = 0; |
| 1188 | for (i = 1; i < 16; i++) { |
| 1189 | if ((ass >> i) & 1) |
| 1190 | tmp++; |
| 1191 | } |
| 1192 | if (((ass >> 16) & 0xf) != tmp) |
| 1193 | return 0; |
| 1194 | do_sku: |
| 1195 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1196 | ass & 0xffff, codec->vendor_id); |
| 1197 | /* |
| 1198 | * 0 : override |
| 1199 | * 1 : Swap Jack |
| 1200 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1201 | * 3~5 : External Amplifier control |
| 1202 | * 7~6 : Reserved |
| 1203 | */ |
| 1204 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1205 | switch (tmp) { |
| 1206 | case 1: |
| 1207 | spec->init_amp = ALC_INIT_GPIO1; |
| 1208 | break; |
| 1209 | case 3: |
| 1210 | spec->init_amp = ALC_INIT_GPIO2; |
| 1211 | break; |
| 1212 | case 7: |
| 1213 | spec->init_amp = ALC_INIT_GPIO3; |
| 1214 | break; |
| 1215 | case 5: |
| 1216 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1217 | break; |
| 1218 | } |
| 1219 | |
| 1220 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1221 | * when the external headphone out jack is plugged" |
| 1222 | */ |
| 1223 | if (!(ass & 0x8000)) |
| 1224 | return 1; |
| 1225 | /* |
| 1226 | * 10~8 : Jack location |
| 1227 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1228 | * 14~13: Resvered |
| 1229 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1230 | * when the external headphone out jack is plugged" |
| 1231 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1232 | if (!spec->autocfg.hp_pins[0]) { |
| 1233 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1234 | if (tmp == 0) |
| 1235 | spec->autocfg.hp_pins[0] = porta; |
| 1236 | else if (tmp == 1) |
| 1237 | spec->autocfg.hp_pins[0] = porte; |
| 1238 | else if (tmp == 2) |
| 1239 | spec->autocfg.hp_pins[0] = portd; |
| 1240 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1241 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1242 | } |
| 1243 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1244 | alc_init_auto_hp(codec); |
| 1245 | return 1; |
| 1246 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1247 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1248 | static void alc_ssid_check(struct hda_codec *codec, |
| 1249 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1250 | { |
| 1251 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1252 | struct alc_spec *spec = codec->spec; |
| 1253 | snd_printd("realtek: " |
| 1254 | "Enable default setup for auto mode as fallback\n"); |
| 1255 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1256 | alc_init_auto_hp(codec); |
| 1257 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1258 | } |
| 1259 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1260 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1261 | * Fix-up pin default configurations |
| 1262 | */ |
| 1263 | |
| 1264 | struct alc_pincfg { |
| 1265 | hda_nid_t nid; |
| 1266 | u32 val; |
| 1267 | }; |
| 1268 | |
| 1269 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1270 | const struct snd_pci_quirk *quirk, |
| 1271 | const struct alc_pincfg **pinfix) |
| 1272 | { |
| 1273 | const struct alc_pincfg *cfg; |
| 1274 | |
| 1275 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1276 | if (!quirk) |
| 1277 | return; |
| 1278 | |
| 1279 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1280 | for (; cfg->nid; cfg++) |
| 1281 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1282 | } |
| 1283 | |
| 1284 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1285 | * ALC888 |
| 1286 | */ |
| 1287 | |
| 1288 | /* |
| 1289 | * 2ch mode |
| 1290 | */ |
| 1291 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1292 | /* Mic-in jack as mic in */ |
| 1293 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1294 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1295 | /* Line-in jack as Line in */ |
| 1296 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1297 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1298 | /* Line-Out as Front */ |
| 1299 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1300 | { } /* end */ |
| 1301 | }; |
| 1302 | |
| 1303 | /* |
| 1304 | * 4ch mode |
| 1305 | */ |
| 1306 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1307 | /* Mic-in jack as mic in */ |
| 1308 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1309 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1310 | /* Line-in jack as Surround */ |
| 1311 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1312 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1313 | /* Line-Out as Front */ |
| 1314 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1315 | { } /* end */ |
| 1316 | }; |
| 1317 | |
| 1318 | /* |
| 1319 | * 6ch mode |
| 1320 | */ |
| 1321 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1322 | /* Mic-in jack as CLFE */ |
| 1323 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1324 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1325 | /* Line-in jack as Surround */ |
| 1326 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1327 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1328 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1329 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1330 | { } /* end */ |
| 1331 | }; |
| 1332 | |
| 1333 | /* |
| 1334 | * 8ch mode |
| 1335 | */ |
| 1336 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1337 | /* Mic-in jack as CLFE */ |
| 1338 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1339 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1340 | /* Line-in jack as Surround */ |
| 1341 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1342 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1343 | /* Line-Out as Side */ |
| 1344 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1345 | { } /* end */ |
| 1346 | }; |
| 1347 | |
| 1348 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1349 | { 2, alc888_4ST_ch2_intel_init }, |
| 1350 | { 4, alc888_4ST_ch4_intel_init }, |
| 1351 | { 6, alc888_4ST_ch6_intel_init }, |
| 1352 | { 8, alc888_4ST_ch8_intel_init }, |
| 1353 | }; |
| 1354 | |
| 1355 | /* |
| 1356 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1357 | */ |
| 1358 | |
| 1359 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1360 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1361 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1362 | /* Connect Internal HP to Front */ |
| 1363 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1364 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1365 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1366 | /* Connect Bass HP to Front */ |
| 1367 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1368 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1369 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1370 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1371 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1372 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1373 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1374 | /* Connect Mic jack to CLFE */ |
| 1375 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1376 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1377 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1378 | /* Connect Line-in jack to Surround */ |
| 1379 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1380 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1381 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1382 | /* Connect HP out jack to Front */ |
| 1383 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1384 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1385 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1386 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1387 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1388 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1389 | {} |
| 1390 | }; |
| 1391 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1392 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1393 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1394 | struct alc_spec *spec = codec->spec; |
| 1395 | unsigned int val, mute; |
| 1396 | hda_nid_t nid; |
| 1397 | int i; |
| 1398 | |
| 1399 | spec->jack_present = 0; |
| 1400 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1401 | nid = spec->autocfg.hp_pins[i]; |
| 1402 | if (!nid) |
| 1403 | break; |
| 1404 | val = snd_hda_codec_read(codec, nid, 0, |
| 1405 | AC_VERB_GET_PIN_SENSE, 0); |
| 1406 | if (val & AC_PINSENSE_PRESENCE) { |
| 1407 | spec->jack_present = 1; |
| 1408 | break; |
| 1409 | } |
| 1410 | } |
| 1411 | |
| 1412 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1413 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1414 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1415 | nid = spec->autocfg.speaker_pins[i]; |
| 1416 | if (!nid) |
| 1417 | break; |
| 1418 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1419 | HDA_AMP_MUTE, mute); |
| 1420 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1421 | } |
| 1422 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1423 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1424 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1425 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1426 | if (codec->vendor_id == 0x10ec0880) |
| 1427 | res >>= 28; |
| 1428 | else |
| 1429 | res >>= 26; |
| 1430 | if (res == ALC880_HP_EVENT) |
| 1431 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1432 | } |
| 1433 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1434 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) |
| 1435 | { |
| 1436 | struct alc_spec *spec = codec->spec; |
| 1437 | |
| 1438 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1439 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1440 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1441 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
| 1442 | alc_automute_amp(codec); |
| 1443 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1444 | |
| 1445 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1446 | * ALC888 Acer Aspire 4930G model |
| 1447 | */ |
| 1448 | |
| 1449 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1450 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1451 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1452 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1453 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1454 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1455 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1456 | /* Connect Internal HP to front */ |
| 1457 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1458 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1459 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1460 | /* Connect HP out to front */ |
| 1461 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1462 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1463 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1464 | { } |
| 1465 | }; |
| 1466 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1467 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1468 | * ALC888 Acer Aspire 6530G model |
| 1469 | */ |
| 1470 | |
| 1471 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1472 | /* Bias voltage on for external mic port */ |
| 1473 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 1474 | /* Enable unsolicited event for HP jack */ |
| 1475 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1476 | /* Enable speaker output */ |
| 1477 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1478 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1479 | /* Enable headphone output */ |
| 1480 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1481 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1482 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1483 | { } |
| 1484 | }; |
| 1485 | |
| 1486 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1487 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1488 | */ |
| 1489 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1490 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1491 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1492 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1493 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1494 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1495 | /* Enable unsolicited event for HP jack */ |
| 1496 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1497 | /* Connect Internal Front to Front */ |
| 1498 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1499 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1500 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1501 | /* Connect Internal Rear to Rear */ |
| 1502 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1503 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1504 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1505 | /* Connect Internal CLFE to CLFE */ |
| 1506 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1507 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1508 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1509 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1510 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1511 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1512 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1513 | /* Enable all DACs */ |
| 1514 | /* DAC DISABLE/MUTE 1? */ |
| 1515 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1516 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1517 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1518 | /* DAC DISABLE/MUTE 2? */ |
| 1519 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1520 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1521 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1522 | /* Enable amplifiers */ |
| 1523 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1524 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1525 | /* DMIC fix |
| 1526 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1527 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1528 | * makes the signal become a difference/sum signal instead of standard |
| 1529 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1530 | * codec replicate the sum signal to both channels, turning it into a |
| 1531 | * normal mono mic. |
| 1532 | */ |
| 1533 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1534 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1535 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1536 | { } |
| 1537 | }; |
| 1538 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1539 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1540 | /* Front mic only available on one ADC */ |
| 1541 | { |
| 1542 | .num_items = 4, |
| 1543 | .items = { |
| 1544 | { "Mic", 0x0 }, |
| 1545 | { "Line", 0x2 }, |
| 1546 | { "CD", 0x4 }, |
| 1547 | { "Front Mic", 0xb }, |
| 1548 | }, |
| 1549 | }, |
| 1550 | { |
| 1551 | .num_items = 3, |
| 1552 | .items = { |
| 1553 | { "Mic", 0x0 }, |
| 1554 | { "Line", 0x2 }, |
| 1555 | { "CD", 0x4 }, |
| 1556 | }, |
| 1557 | } |
| 1558 | }; |
| 1559 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1560 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1561 | /* Interal mic only available on one ADC */ |
| 1562 | { |
| 1563 | .num_items = 3, |
| 1564 | .items = { |
| 1565 | { "Ext Mic", 0x0 }, |
| 1566 | { "CD", 0x4 }, |
| 1567 | { "Int Mic", 0xb }, |
| 1568 | }, |
| 1569 | }, |
| 1570 | { |
| 1571 | .num_items = 2, |
| 1572 | .items = { |
| 1573 | { "Ext Mic", 0x0 }, |
| 1574 | { "CD", 0x4 }, |
| 1575 | }, |
| 1576 | } |
| 1577 | }; |
| 1578 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1579 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1580 | /* Digital mic only available on first "ADC" */ |
| 1581 | { |
| 1582 | .num_items = 5, |
| 1583 | .items = { |
| 1584 | { "Mic", 0x0 }, |
| 1585 | { "Line", 0x2 }, |
| 1586 | { "CD", 0x4 }, |
| 1587 | { "Front Mic", 0xb }, |
| 1588 | { "Input Mix", 0xa }, |
| 1589 | }, |
| 1590 | }, |
| 1591 | { |
| 1592 | .num_items = 4, |
| 1593 | .items = { |
| 1594 | { "Mic", 0x0 }, |
| 1595 | { "Line", 0x2 }, |
| 1596 | { "CD", 0x4 }, |
| 1597 | { "Input Mix", 0xa }, |
| 1598 | }, |
| 1599 | }, |
| 1600 | { |
| 1601 | .num_items = 4, |
| 1602 | .items = { |
| 1603 | { "Mic", 0x0 }, |
| 1604 | { "Line", 0x2 }, |
| 1605 | { "CD", 0x4 }, |
| 1606 | { "Input Mix", 0xa }, |
| 1607 | }, |
| 1608 | } |
| 1609 | }; |
| 1610 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1611 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1612 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1613 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1614 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1615 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1616 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1617 | HDA_OUTPUT), |
| 1618 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1619 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1620 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1621 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1622 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1623 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1624 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1625 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1626 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1627 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1628 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1629 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1630 | { } /* end */ |
| 1631 | }; |
| 1632 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1633 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1634 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1635 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1636 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1637 | spec->autocfg.hp_pins[0] = 0x15; |
| 1638 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1639 | alc_automute_amp(codec); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1640 | } |
| 1641 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1642 | static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1643 | { |
| 1644 | struct alc_spec *spec = codec->spec; |
| 1645 | |
| 1646 | spec->autocfg.hp_pins[0] = 0x15; |
| 1647 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1648 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1649 | spec->autocfg.speaker_pins[2] = 0x1b; |
| 1650 | alc_automute_amp(codec); |
| 1651 | } |
| 1652 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1653 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1654 | * ALC880 3-stack model |
| 1655 | * |
| 1656 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1657 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1658 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1659 | */ |
| 1660 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1661 | static hda_nid_t alc880_dac_nids[4] = { |
| 1662 | /* front, rear, clfe, rear_surr */ |
| 1663 | 0x02, 0x05, 0x04, 0x03 |
| 1664 | }; |
| 1665 | |
| 1666 | static hda_nid_t alc880_adc_nids[3] = { |
| 1667 | /* ADC0-2 */ |
| 1668 | 0x07, 0x08, 0x09, |
| 1669 | }; |
| 1670 | |
| 1671 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1672 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1673 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1674 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1675 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1676 | /* ADC1-2 */ |
| 1677 | 0x08, 0x09, |
| 1678 | }; |
| 1679 | |
| 1680 | #define ALC880_DIGOUT_NID 0x06 |
| 1681 | #define ALC880_DIGIN_NID 0x0a |
| 1682 | |
| 1683 | static struct hda_input_mux alc880_capture_source = { |
| 1684 | .num_items = 4, |
| 1685 | .items = { |
| 1686 | { "Mic", 0x0 }, |
| 1687 | { "Front Mic", 0x3 }, |
| 1688 | { "Line", 0x2 }, |
| 1689 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1690 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1691 | }; |
| 1692 | |
| 1693 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1694 | /* 2ch mode */ |
| 1695 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1696 | /* set line-in to input, mute it */ |
| 1697 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1698 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1699 | /* set mic-in to input vref 80%, mute it */ |
| 1700 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1701 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1702 | { } /* end */ |
| 1703 | }; |
| 1704 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1705 | /* 6ch mode */ |
| 1706 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1707 | /* set line-in to output, unmute it */ |
| 1708 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1709 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1710 | /* set mic-in to output, unmute it */ |
| 1711 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1712 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1713 | { } /* end */ |
| 1714 | }; |
| 1715 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1716 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1717 | { 2, alc880_threestack_ch2_init }, |
| 1718 | { 6, alc880_threestack_ch6_init }, |
| 1719 | }; |
| 1720 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1721 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1722 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1723 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1724 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1725 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1726 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1727 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1728 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1729 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1730 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1731 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1732 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1733 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1734 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1735 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1736 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1737 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1738 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1739 | { |
| 1740 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1741 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1742 | .info = alc_ch_mode_info, |
| 1743 | .get = alc_ch_mode_get, |
| 1744 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1745 | }, |
| 1746 | { } /* end */ |
| 1747 | }; |
| 1748 | |
| 1749 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1750 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1751 | struct snd_ctl_elem_info *uinfo) |
| 1752 | { |
| 1753 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1754 | struct alc_spec *spec = codec->spec; |
| 1755 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1756 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1757 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1758 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1759 | HDA_INPUT); |
| 1760 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1761 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1762 | return err; |
| 1763 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1764 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1765 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1766 | unsigned int size, unsigned int __user *tlv) |
| 1767 | { |
| 1768 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1769 | struct alc_spec *spec = codec->spec; |
| 1770 | int err; |
| 1771 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1772 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1773 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1774 | HDA_INPUT); |
| 1775 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1776 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1777 | return err; |
| 1778 | } |
| 1779 | |
| 1780 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1781 | struct snd_ctl_elem_value *ucontrol); |
| 1782 | |
| 1783 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1784 | struct snd_ctl_elem_value *ucontrol, |
| 1785 | getput_call_t func) |
| 1786 | { |
| 1787 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1788 | struct alc_spec *spec = codec->spec; |
| 1789 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1790 | int err; |
| 1791 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1792 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1793 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1794 | 3, 0, HDA_INPUT); |
| 1795 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1796 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1797 | return err; |
| 1798 | } |
| 1799 | |
| 1800 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1801 | struct snd_ctl_elem_value *ucontrol) |
| 1802 | { |
| 1803 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1804 | snd_hda_mixer_amp_volume_get); |
| 1805 | } |
| 1806 | |
| 1807 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1808 | struct snd_ctl_elem_value *ucontrol) |
| 1809 | { |
| 1810 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1811 | snd_hda_mixer_amp_volume_put); |
| 1812 | } |
| 1813 | |
| 1814 | /* capture mixer elements */ |
| 1815 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1816 | |
| 1817 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1818 | struct snd_ctl_elem_value *ucontrol) |
| 1819 | { |
| 1820 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1821 | snd_hda_mixer_amp_switch_get); |
| 1822 | } |
| 1823 | |
| 1824 | static int alc_cap_sw_put(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_switch_put); |
| 1829 | } |
| 1830 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1831 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1832 | { \ |
| 1833 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1834 | .name = "Capture Switch", \ |
| 1835 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1836 | .count = num, \ |
| 1837 | .info = alc_cap_sw_info, \ |
| 1838 | .get = alc_cap_sw_get, \ |
| 1839 | .put = alc_cap_sw_put, \ |
| 1840 | }, \ |
| 1841 | { \ |
| 1842 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1843 | .name = "Capture Volume", \ |
| 1844 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1845 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1846 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1847 | .count = num, \ |
| 1848 | .info = alc_cap_vol_info, \ |
| 1849 | .get = alc_cap_vol_get, \ |
| 1850 | .put = alc_cap_vol_put, \ |
| 1851 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1852 | } |
| 1853 | |
| 1854 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1855 | { \ |
| 1856 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1857 | /* .name = "Capture Source", */ \ |
| 1858 | .name = "Input Source", \ |
| 1859 | .count = num, \ |
| 1860 | .info = alc_mux_enum_info, \ |
| 1861 | .get = alc_mux_enum_get, \ |
| 1862 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1863 | } |
| 1864 | |
| 1865 | #define DEFINE_CAPMIX(num) \ |
| 1866 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1867 | _DEFINE_CAPMIX(num), \ |
| 1868 | _DEFINE_CAPSRC(num), \ |
| 1869 | { } /* end */ \ |
| 1870 | } |
| 1871 | |
| 1872 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 1873 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 1874 | _DEFINE_CAPMIX(num), \ |
| 1875 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1876 | } |
| 1877 | |
| 1878 | /* up to three ADCs */ |
| 1879 | DEFINE_CAPMIX(1); |
| 1880 | DEFINE_CAPMIX(2); |
| 1881 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1882 | DEFINE_CAPMIX_NOSRC(1); |
| 1883 | DEFINE_CAPMIX_NOSRC(2); |
| 1884 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1885 | |
| 1886 | /* |
| 1887 | * ALC880 5-stack model |
| 1888 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1889 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1890 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1891 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1892 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1893 | */ |
| 1894 | |
| 1895 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1896 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1897 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1898 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1899 | { } /* end */ |
| 1900 | }; |
| 1901 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1902 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1903 | /* 6ch mode */ |
| 1904 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1905 | /* set line-in to input, mute it */ |
| 1906 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1907 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1908 | { } /* end */ |
| 1909 | }; |
| 1910 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1911 | /* 8ch mode */ |
| 1912 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1913 | /* set line-in to output, unmute it */ |
| 1914 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1915 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1916 | { } /* end */ |
| 1917 | }; |
| 1918 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1919 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1920 | { 6, alc880_fivestack_ch6_init }, |
| 1921 | { 8, alc880_fivestack_ch8_init }, |
| 1922 | }; |
| 1923 | |
| 1924 | |
| 1925 | /* |
| 1926 | * ALC880 6-stack model |
| 1927 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1928 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1929 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1930 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1931 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1932 | */ |
| 1933 | |
| 1934 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1935 | /* front, rear, clfe, rear_surr */ |
| 1936 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1937 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1938 | |
| 1939 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1940 | .num_items = 4, |
| 1941 | .items = { |
| 1942 | { "Mic", 0x0 }, |
| 1943 | { "Front Mic", 0x1 }, |
| 1944 | { "Line", 0x2 }, |
| 1945 | { "CD", 0x4 }, |
| 1946 | }, |
| 1947 | }; |
| 1948 | |
| 1949 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1950 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1951 | { 8, NULL }, |
| 1952 | }; |
| 1953 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1954 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1955 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1956 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1957 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1958 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1959 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1960 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1961 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1962 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1963 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1964 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1965 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1966 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1967 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1968 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1971 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1972 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1973 | { |
| 1974 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1975 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1976 | .info = alc_ch_mode_info, |
| 1977 | .get = alc_ch_mode_get, |
| 1978 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1979 | }, |
| 1980 | { } /* end */ |
| 1981 | }; |
| 1982 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1983 | |
| 1984 | /* |
| 1985 | * ALC880 W810 model |
| 1986 | * |
| 1987 | * W810 has rear IO for: |
| 1988 | * Front (DAC 02) |
| 1989 | * Surround (DAC 03) |
| 1990 | * Center/LFE (DAC 04) |
| 1991 | * Digital out (06) |
| 1992 | * |
| 1993 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1994 | * 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] | 1995 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1996 | * There is a variable resistor to control the speaker or headphone |
| 1997 | * volume. This is a hardware-only device without a software API. |
| 1998 | * |
| 1999 | * Plugging headphones in will disable the internal speakers. This is |
| 2000 | * implemented in hardware, not via the driver using jack sense. In |
| 2001 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2002 | * disable both the speakers and headphones. |
| 2003 | * |
| 2004 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2005 | * These may not do anything useful with this driver yet, because I |
| 2006 | * haven't setup any initialization verbs for these yet... |
| 2007 | */ |
| 2008 | |
| 2009 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2010 | /* front, rear/surround, clfe */ |
| 2011 | 0x02, 0x03, 0x04 |
| 2012 | }; |
| 2013 | |
| 2014 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2015 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2016 | { 6, NULL } |
| 2017 | }; |
| 2018 | |
| 2019 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2020 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2021 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2022 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2023 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2024 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2025 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2026 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2027 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2028 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2029 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2030 | { } /* end */ |
| 2031 | }; |
| 2032 | |
| 2033 | |
| 2034 | /* |
| 2035 | * Z710V model |
| 2036 | * |
| 2037 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2038 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2039 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2040 | */ |
| 2041 | |
| 2042 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2043 | 0x02 |
| 2044 | }; |
| 2045 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2046 | |
| 2047 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2048 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2049 | { 2, NULL } |
| 2050 | }; |
| 2051 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2052 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2053 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2054 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2055 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2056 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2057 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2058 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2059 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2060 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2061 | { } /* end */ |
| 2062 | }; |
| 2063 | |
| 2064 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2065 | /* |
| 2066 | * ALC880 F1734 model |
| 2067 | * |
| 2068 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2069 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2070 | */ |
| 2071 | |
| 2072 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2073 | 0x03 |
| 2074 | }; |
| 2075 | #define ALC880_F1734_HP_DAC 0x02 |
| 2076 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2077 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2078 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2079 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2080 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2081 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2082 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2083 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2084 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2085 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2086 | { } /* end */ |
| 2087 | }; |
| 2088 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2089 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2090 | .num_items = 2, |
| 2091 | .items = { |
| 2092 | { "Mic", 0x1 }, |
| 2093 | { "CD", 0x4 }, |
| 2094 | }, |
| 2095 | }; |
| 2096 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2097 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2098 | /* |
| 2099 | * ALC880 ASUS model |
| 2100 | * |
| 2101 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2102 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2103 | * Mic = 0x18, Line = 0x1a |
| 2104 | */ |
| 2105 | |
| 2106 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2107 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2108 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2109 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2110 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2111 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2112 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2113 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2114 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2115 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2116 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2117 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2118 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2119 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2120 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2121 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2122 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2123 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2124 | { |
| 2125 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2126 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2127 | .info = alc_ch_mode_info, |
| 2128 | .get = alc_ch_mode_get, |
| 2129 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2130 | }, |
| 2131 | { } /* end */ |
| 2132 | }; |
| 2133 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2134 | /* |
| 2135 | * ALC880 ASUS W1V model |
| 2136 | * |
| 2137 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2138 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2139 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2140 | */ |
| 2141 | |
| 2142 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2143 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2144 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2145 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2146 | { } /* end */ |
| 2147 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2148 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2149 | /* TCL S700 */ |
| 2150 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2151 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2152 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2153 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2154 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2155 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2156 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2157 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2158 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2159 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2160 | { } /* end */ |
| 2161 | }; |
| 2162 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2163 | /* Uniwill */ |
| 2164 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2165 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2166 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2167 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2168 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2169 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2170 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2171 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2172 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2173 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2174 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2175 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2176 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2177 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2178 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2179 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2180 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2181 | { |
| 2182 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2183 | .name = "Channel Mode", |
| 2184 | .info = alc_ch_mode_info, |
| 2185 | .get = alc_ch_mode_get, |
| 2186 | .put = alc_ch_mode_put, |
| 2187 | }, |
| 2188 | { } /* end */ |
| 2189 | }; |
| 2190 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2191 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2192 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2193 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2194 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2195 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2196 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2197 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2198 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2199 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2200 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2201 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2202 | { } /* end */ |
| 2203 | }; |
| 2204 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2205 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2206 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2207 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2208 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2209 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2210 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2211 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2212 | { } /* end */ |
| 2213 | }; |
| 2214 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2215 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2216 | * virtual master controls |
| 2217 | */ |
| 2218 | |
| 2219 | /* |
| 2220 | * slave controls for virtual master |
| 2221 | */ |
| 2222 | static const char *alc_slave_vols[] = { |
| 2223 | "Front Playback Volume", |
| 2224 | "Surround Playback Volume", |
| 2225 | "Center Playback Volume", |
| 2226 | "LFE Playback Volume", |
| 2227 | "Side Playback Volume", |
| 2228 | "Headphone Playback Volume", |
| 2229 | "Speaker Playback Volume", |
| 2230 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2231 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2232 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2233 | NULL, |
| 2234 | }; |
| 2235 | |
| 2236 | static const char *alc_slave_sws[] = { |
| 2237 | "Front Playback Switch", |
| 2238 | "Surround Playback Switch", |
| 2239 | "Center Playback Switch", |
| 2240 | "LFE Playback Switch", |
| 2241 | "Side Playback Switch", |
| 2242 | "Headphone Playback Switch", |
| 2243 | "Speaker Playback Switch", |
| 2244 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2245 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2246 | NULL, |
| 2247 | }; |
| 2248 | |
| 2249 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2250 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2251 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2252 | |
| 2253 | static void alc_free_kctls(struct hda_codec *codec); |
| 2254 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2255 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2256 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2257 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2258 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2259 | { } /* end */ |
| 2260 | }; |
| 2261 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2262 | static int alc_build_controls(struct hda_codec *codec) |
| 2263 | { |
| 2264 | struct alc_spec *spec = codec->spec; |
| 2265 | int err; |
| 2266 | int i; |
| 2267 | |
| 2268 | for (i = 0; i < spec->num_mixers; i++) { |
| 2269 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2270 | if (err < 0) |
| 2271 | return err; |
| 2272 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2273 | if (spec->cap_mixer) { |
| 2274 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2275 | if (err < 0) |
| 2276 | return err; |
| 2277 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2278 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2279 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2280 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2281 | if (err < 0) |
| 2282 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2283 | if (!spec->no_analog) { |
| 2284 | err = snd_hda_create_spdif_share_sw(codec, |
| 2285 | &spec->multiout); |
| 2286 | if (err < 0) |
| 2287 | return err; |
| 2288 | spec->multiout.share_spdif = 1; |
| 2289 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2290 | } |
| 2291 | if (spec->dig_in_nid) { |
| 2292 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2293 | if (err < 0) |
| 2294 | return err; |
| 2295 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2296 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2297 | /* create beep controls if needed */ |
| 2298 | if (spec->beep_amp) { |
| 2299 | struct snd_kcontrol_new *knew; |
| 2300 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2301 | struct snd_kcontrol *kctl; |
| 2302 | kctl = snd_ctl_new1(knew, codec); |
| 2303 | if (!kctl) |
| 2304 | return -ENOMEM; |
| 2305 | kctl->private_value = spec->beep_amp; |
| 2306 | err = snd_hda_ctl_add(codec, kctl); |
| 2307 | if (err < 0) |
| 2308 | return err; |
| 2309 | } |
| 2310 | } |
| 2311 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2312 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2313 | if (!spec->no_analog && |
| 2314 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2315 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2316 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2317 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2318 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2319 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2320 | if (err < 0) |
| 2321 | return err; |
| 2322 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2323 | if (!spec->no_analog && |
| 2324 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2325 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2326 | NULL, alc_slave_sws); |
| 2327 | if (err < 0) |
| 2328 | return err; |
| 2329 | } |
| 2330 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2331 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2332 | return 0; |
| 2333 | } |
| 2334 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2335 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2336 | /* |
| 2337 | * initialize the codec volumes, etc |
| 2338 | */ |
| 2339 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2340 | /* |
| 2341 | * generic initialization of ADC, input mixers and output mixers |
| 2342 | */ |
| 2343 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2344 | /* |
| 2345 | * Unmute ADC0-2 and set the default input to mic-in |
| 2346 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2347 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2348 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2349 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2350 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2351 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2352 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2353 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2354 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2355 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2356 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2357 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2358 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2359 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2360 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2361 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2362 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2363 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2364 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2365 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2366 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2367 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2368 | /* |
| 2369 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2370 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2371 | /* set vol=0 to output mixers */ |
| 2372 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2373 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2374 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2375 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2376 | /* set up input amps for analog loopback */ |
| 2377 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2378 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2379 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2380 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2381 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2382 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2383 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2384 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2385 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2386 | |
| 2387 | { } |
| 2388 | }; |
| 2389 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2390 | /* |
| 2391 | * 3-stack pin configuration: |
| 2392 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2393 | */ |
| 2394 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2395 | /* |
| 2396 | * preset connection lists of input pins |
| 2397 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2398 | */ |
| 2399 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2400 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2401 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2402 | |
| 2403 | /* |
| 2404 | * Set pin mode and muting |
| 2405 | */ |
| 2406 | /* set front pin widgets 0x14 for output */ |
| 2407 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2408 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2409 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2410 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2411 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2412 | /* Mic2 (as headphone out) for HP output */ |
| 2413 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2414 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2415 | /* Line In pin widget for input */ |
| 2416 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2417 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2418 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2419 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2420 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2421 | /* CD pin widget for input */ |
| 2422 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2423 | |
| 2424 | { } |
| 2425 | }; |
| 2426 | |
| 2427 | /* |
| 2428 | * 5-stack pin configuration: |
| 2429 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2430 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2431 | */ |
| 2432 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2433 | /* |
| 2434 | * preset connection lists of input pins |
| 2435 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2436 | */ |
| 2437 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2438 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2439 | |
| 2440 | /* |
| 2441 | * Set pin mode and muting |
| 2442 | */ |
| 2443 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2444 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2445 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2446 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2447 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2448 | /* unmute pins for output (no gain on this amp) */ |
| 2449 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2450 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2451 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2452 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2453 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2454 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2455 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2456 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2457 | /* Mic2 (as headphone out) for HP output */ |
| 2458 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2459 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2460 | /* Line In pin widget for input */ |
| 2461 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2462 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2463 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2464 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2465 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2466 | /* CD pin widget for input */ |
| 2467 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2468 | |
| 2469 | { } |
| 2470 | }; |
| 2471 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2472 | /* |
| 2473 | * W810 pin configuration: |
| 2474 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2475 | */ |
| 2476 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2477 | /* hphone/speaker input selector: front DAC */ |
| 2478 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2479 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2480 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2481 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2482 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2483 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2484 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2485 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2486 | |
| 2487 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2488 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2489 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2490 | { } |
| 2491 | }; |
| 2492 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2493 | /* |
| 2494 | * Z71V pin configuration: |
| 2495 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2496 | */ |
| 2497 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2498 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2499 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2500 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2501 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2502 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2503 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2504 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2505 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2506 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2507 | |
| 2508 | { } |
| 2509 | }; |
| 2510 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2511 | /* |
| 2512 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2513 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2514 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2515 | */ |
| 2516 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2517 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2518 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2519 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2520 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2521 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2522 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2523 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2524 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2525 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2526 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2527 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2528 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2529 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2530 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2531 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2532 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2533 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2534 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2535 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2536 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2537 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2538 | { } |
| 2539 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2540 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2541 | /* |
| 2542 | * Uniwill pin configuration: |
| 2543 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2544 | * line = 0x1a |
| 2545 | */ |
| 2546 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2547 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2548 | |
| 2549 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2550 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2551 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2552 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2553 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2554 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2555 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2556 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2557 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2558 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2559 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2560 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2561 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2562 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2563 | |
| 2564 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2565 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2566 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2567 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2568 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2569 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2570 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2571 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2572 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2573 | |
| 2574 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2575 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2576 | |
| 2577 | { } |
| 2578 | }; |
| 2579 | |
| 2580 | /* |
| 2581 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2582 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2583 | */ |
| 2584 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2585 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2586 | |
| 2587 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2588 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2589 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2590 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2591 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2592 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2593 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2594 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2595 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2596 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2597 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2598 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2599 | |
| 2600 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2601 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2602 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2603 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2604 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2605 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2606 | |
| 2607 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2608 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2609 | |
| 2610 | { } |
| 2611 | }; |
| 2612 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2613 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2614 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2615 | { } |
| 2616 | }; |
| 2617 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2618 | /* auto-toggle front mic */ |
| 2619 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2620 | { |
| 2621 | unsigned int present; |
| 2622 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2623 | |
| 2624 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2625 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2626 | bits = present ? HDA_AMP_MUTE : 0; |
| 2627 | 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] | 2628 | } |
| 2629 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2630 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2631 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2632 | struct alc_spec *spec = codec->spec; |
| 2633 | |
| 2634 | spec->autocfg.hp_pins[0] = 0x14; |
| 2635 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2636 | spec->autocfg.speaker_pins[0] = 0x16; |
| 2637 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2638 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2639 | } |
| 2640 | |
| 2641 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2642 | unsigned int res) |
| 2643 | { |
| 2644 | /* Looks like the unsol event is incompatible with the standard |
| 2645 | * definition. 4bit tag is placed at 28 bit! |
| 2646 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2647 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2648 | case ALC880_MIC_EVENT: |
| 2649 | alc880_uniwill_mic_automute(codec); |
| 2650 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2651 | default: |
| 2652 | alc_automute_amp_unsol_event(codec, res); |
| 2653 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2654 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2655 | } |
| 2656 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2657 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2658 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2659 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2660 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2661 | spec->autocfg.hp_pins[0] = 0x14; |
| 2662 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2663 | alc_automute_amp(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2664 | } |
| 2665 | |
| 2666 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2667 | { |
| 2668 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2669 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2670 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2671 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2672 | present &= HDA_AMP_VOLMASK; |
| 2673 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2674 | HDA_AMP_VOLMASK, present); |
| 2675 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2676 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2677 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2678 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2679 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2680 | unsigned int res) |
| 2681 | { |
| 2682 | /* Looks like the unsol event is incompatible with the standard |
| 2683 | * definition. 4bit tag is placed at 28 bit! |
| 2684 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2685 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2686 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2687 | else |
| 2688 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2689 | } |
| 2690 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2691 | /* |
| 2692 | * F1734 pin configuration: |
| 2693 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2694 | */ |
| 2695 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2696 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2697 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2698 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2699 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2700 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2701 | |
| 2702 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2703 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2704 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2705 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2706 | |
| 2707 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2708 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2709 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2710 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2711 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2712 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2713 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2714 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2715 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2716 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2717 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2718 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2719 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2720 | { } |
| 2721 | }; |
| 2722 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2723 | /* |
| 2724 | * ASUS pin configuration: |
| 2725 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2726 | */ |
| 2727 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2728 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2729 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2730 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2731 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2732 | |
| 2733 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2734 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2735 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2736 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2737 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2738 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2739 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2740 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2741 | |
| 2742 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2743 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2744 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2745 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2746 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2747 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2748 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2749 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2750 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2751 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2752 | { } |
| 2753 | }; |
| 2754 | |
| 2755 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2756 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2757 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2758 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2759 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2760 | /* Clevo m520g init */ |
| 2761 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2762 | /* headphone output */ |
| 2763 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2764 | /* line-out */ |
| 2765 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2766 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2767 | /* Line-in */ |
| 2768 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2769 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2770 | /* CD */ |
| 2771 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2772 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2773 | /* Mic1 (rear panel) */ |
| 2774 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2775 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2776 | /* Mic2 (front panel) */ |
| 2777 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2778 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2779 | /* headphone */ |
| 2780 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2781 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2782 | /* change to EAPD mode */ |
| 2783 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2784 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2785 | |
| 2786 | { } |
| 2787 | }; |
| 2788 | |
| 2789 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2790 | /* change to EAPD mode */ |
| 2791 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2792 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2793 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2794 | /* Headphone output */ |
| 2795 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2796 | /* Front output*/ |
| 2797 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2798 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2799 | |
| 2800 | /* Line In pin widget for input */ |
| 2801 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2802 | /* CD pin widget for input */ |
| 2803 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2804 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2805 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2806 | |
| 2807 | /* change to EAPD mode */ |
| 2808 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2809 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2810 | |
| 2811 | { } |
| 2812 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2813 | |
| 2814 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2815 | * LG m1 express dual |
| 2816 | * |
| 2817 | * Pin assignment: |
| 2818 | * Rear Line-In/Out (blue): 0x14 |
| 2819 | * Build-in Mic-In: 0x15 |
| 2820 | * Speaker-out: 0x17 |
| 2821 | * HP-Out (green): 0x1b |
| 2822 | * Mic-In/Out (red): 0x19 |
| 2823 | * SPDIF-Out: 0x1e |
| 2824 | */ |
| 2825 | |
| 2826 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2827 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2828 | 0x05, 0x02, 0x03 |
| 2829 | }; |
| 2830 | |
| 2831 | /* seems analog CD is not working */ |
| 2832 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2833 | .num_items = 3, |
| 2834 | .items = { |
| 2835 | { "Mic", 0x1 }, |
| 2836 | { "Line", 0x5 }, |
| 2837 | { "Internal Mic", 0x6 }, |
| 2838 | }, |
| 2839 | }; |
| 2840 | |
| 2841 | /* 2,4,6 channel modes */ |
| 2842 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2843 | /* set line-in and mic-in to input */ |
| 2844 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2845 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2846 | { } |
| 2847 | }; |
| 2848 | |
| 2849 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2850 | /* set line-in to out and mic-in to input */ |
| 2851 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2852 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2853 | { } |
| 2854 | }; |
| 2855 | |
| 2856 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2857 | /* set line-in and mic-in to output */ |
| 2858 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2859 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2860 | { } |
| 2861 | }; |
| 2862 | |
| 2863 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2864 | { 2, alc880_lg_ch2_init }, |
| 2865 | { 4, alc880_lg_ch4_init }, |
| 2866 | { 6, alc880_lg_ch6_init }, |
| 2867 | }; |
| 2868 | |
| 2869 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2870 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2871 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2872 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2873 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2874 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2875 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2876 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2877 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2880 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2881 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2882 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2883 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2884 | { |
| 2885 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2886 | .name = "Channel Mode", |
| 2887 | .info = alc_ch_mode_info, |
| 2888 | .get = alc_ch_mode_get, |
| 2889 | .put = alc_ch_mode_put, |
| 2890 | }, |
| 2891 | { } /* end */ |
| 2892 | }; |
| 2893 | |
| 2894 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2895 | /* set capture source to mic-in */ |
| 2896 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2897 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2898 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2899 | /* mute all amp mixer inputs */ |
| 2900 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2901 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2902 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2903 | /* line-in to input */ |
| 2904 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2905 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2906 | /* built-in mic */ |
| 2907 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2908 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2909 | /* speaker-out */ |
| 2910 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2911 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2912 | /* mic-in to input */ |
| 2913 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2914 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2915 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2916 | /* HP-out */ |
| 2917 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2918 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2919 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2920 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2921 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2922 | { } |
| 2923 | }; |
| 2924 | |
| 2925 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2926 | static void alc880_lg_init_hook(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2927 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2928 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2929 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2930 | spec->autocfg.hp_pins[0] = 0x1b; |
| 2931 | spec->autocfg.speaker_pins[0] = 0x17; |
| 2932 | alc_automute_amp(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2933 | } |
| 2934 | |
| 2935 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2936 | * LG LW20 |
| 2937 | * |
| 2938 | * Pin assignment: |
| 2939 | * Speaker-out: 0x14 |
| 2940 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2941 | * Built-in Mic-In: 0x19 |
| 2942 | * Line-In: 0x1b |
| 2943 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2944 | * SPDIF-Out: 0x1e |
| 2945 | */ |
| 2946 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2947 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2948 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2949 | .items = { |
| 2950 | { "Mic", 0x0 }, |
| 2951 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2952 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2953 | }, |
| 2954 | }; |
| 2955 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2956 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2957 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2958 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2959 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2960 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2961 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2962 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2963 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2964 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2965 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2966 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2967 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2968 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2971 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2972 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2973 | { |
| 2974 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2975 | .name = "Channel Mode", |
| 2976 | .info = alc_ch_mode_info, |
| 2977 | .get = alc_ch_mode_get, |
| 2978 | .put = alc_ch_mode_put, |
| 2979 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2980 | { } /* end */ |
| 2981 | }; |
| 2982 | |
| 2983 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2984 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2985 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2986 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2987 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2988 | /* set capture source to mic-in */ |
| 2989 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2990 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2991 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2992 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2993 | /* speaker-out */ |
| 2994 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2995 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2996 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2997 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2998 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2999 | /* mic-in to input */ |
| 3000 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3001 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3002 | /* built-in mic */ |
| 3003 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3004 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3005 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3006 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3007 | { } |
| 3008 | }; |
| 3009 | |
| 3010 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3011 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3012 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3013 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3014 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3015 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3016 | spec->autocfg.speaker_pins[0] = 0x14; |
| 3017 | alc_automute_amp(codec); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3018 | } |
| 3019 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3020 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3021 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3022 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3023 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3024 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3025 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3026 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3027 | { } /* end */ |
| 3028 | }; |
| 3029 | |
| 3030 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3031 | .num_items = 2, |
| 3032 | .items = { |
| 3033 | { "Mic", 0x0 }, |
| 3034 | { "Internal Mic", 0x1 }, |
| 3035 | }, |
| 3036 | }; |
| 3037 | |
| 3038 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3039 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3040 | |
| 3041 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3042 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3043 | |
| 3044 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3045 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3046 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3047 | /* Mic2 (as headphone out) for HP output */ |
| 3048 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3049 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3050 | /* Internal Speaker */ |
| 3051 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3052 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3053 | |
| 3054 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3055 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3056 | |
| 3057 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3058 | { } |
| 3059 | }; |
| 3060 | |
| 3061 | /* toggle speaker-output according to the hp-jack state */ |
| 3062 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3063 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3064 | struct alc_spec *spec = codec->spec; |
| 3065 | alc_automute_amp(codec); |
| 3066 | /* toggle EAPD */ |
| 3067 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3068 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3069 | else |
| 3070 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3071 | } |
| 3072 | |
| 3073 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3074 | unsigned int res) |
| 3075 | { |
| 3076 | /* Looks like the unsol event is incompatible with the standard |
| 3077 | * definition. 4bit tag is placed at 28 bit! |
| 3078 | */ |
| 3079 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3080 | alc880_medion_rim_automute(codec); |
| 3081 | } |
| 3082 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3083 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) |
| 3084 | { |
| 3085 | struct alc_spec *spec = codec->spec; |
| 3086 | |
| 3087 | spec->autocfg.hp_pins[0] = 0x14; |
| 3088 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 3089 | alc880_medion_rim_automute(codec); |
| 3090 | } |
| 3091 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3092 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3093 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3094 | { 0x0b, HDA_INPUT, 0 }, |
| 3095 | { 0x0b, HDA_INPUT, 1 }, |
| 3096 | { 0x0b, HDA_INPUT, 2 }, |
| 3097 | { 0x0b, HDA_INPUT, 3 }, |
| 3098 | { 0x0b, HDA_INPUT, 4 }, |
| 3099 | { } /* end */ |
| 3100 | }; |
| 3101 | |
| 3102 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3103 | { 0x0b, HDA_INPUT, 1 }, |
| 3104 | { 0x0b, HDA_INPUT, 6 }, |
| 3105 | { 0x0b, HDA_INPUT, 7 }, |
| 3106 | { } /* end */ |
| 3107 | }; |
| 3108 | #endif |
| 3109 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3110 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3111 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3112 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3113 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3114 | static int alc_init(struct hda_codec *codec) |
| 3115 | { |
| 3116 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3117 | unsigned int i; |
| 3118 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3119 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3120 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3121 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3122 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3123 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3124 | |
| 3125 | if (spec->init_hook) |
| 3126 | spec->init_hook(codec); |
| 3127 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3128 | return 0; |
| 3129 | } |
| 3130 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3131 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3132 | { |
| 3133 | struct alc_spec *spec = codec->spec; |
| 3134 | |
| 3135 | if (spec->unsol_event) |
| 3136 | spec->unsol_event(codec, res); |
| 3137 | } |
| 3138 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3139 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3140 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3141 | { |
| 3142 | struct alc_spec *spec = codec->spec; |
| 3143 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3144 | } |
| 3145 | #endif |
| 3146 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3147 | /* |
| 3148 | * Analog playback callbacks |
| 3149 | */ |
| 3150 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3151 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3152 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3153 | { |
| 3154 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3155 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3156 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3157 | } |
| 3158 | |
| 3159 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3160 | struct hda_codec *codec, |
| 3161 | unsigned int stream_tag, |
| 3162 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3163 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3164 | { |
| 3165 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3166 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3167 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3168 | } |
| 3169 | |
| 3170 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3171 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3172 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3173 | { |
| 3174 | struct alc_spec *spec = codec->spec; |
| 3175 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3176 | } |
| 3177 | |
| 3178 | /* |
| 3179 | * Digital out |
| 3180 | */ |
| 3181 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3182 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3183 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3184 | { |
| 3185 | struct alc_spec *spec = codec->spec; |
| 3186 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3187 | } |
| 3188 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3189 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3190 | struct hda_codec *codec, |
| 3191 | unsigned int stream_tag, |
| 3192 | unsigned int format, |
| 3193 | struct snd_pcm_substream *substream) |
| 3194 | { |
| 3195 | struct alc_spec *spec = codec->spec; |
| 3196 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3197 | stream_tag, format, substream); |
| 3198 | } |
| 3199 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3200 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3201 | struct hda_codec *codec, |
| 3202 | struct snd_pcm_substream *substream) |
| 3203 | { |
| 3204 | struct alc_spec *spec = codec->spec; |
| 3205 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3206 | } |
| 3207 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3208 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3209 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3210 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3211 | { |
| 3212 | struct alc_spec *spec = codec->spec; |
| 3213 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3214 | } |
| 3215 | |
| 3216 | /* |
| 3217 | * Analog capture |
| 3218 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3219 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3220 | struct hda_codec *codec, |
| 3221 | unsigned int stream_tag, |
| 3222 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3223 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3224 | { |
| 3225 | struct alc_spec *spec = codec->spec; |
| 3226 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3227 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3228 | stream_tag, 0, format); |
| 3229 | return 0; |
| 3230 | } |
| 3231 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3232 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3238 | snd_hda_codec_cleanup_stream(codec, |
| 3239 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3240 | return 0; |
| 3241 | } |
| 3242 | |
| 3243 | |
| 3244 | /* |
| 3245 | */ |
| 3246 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3247 | .substreams = 1, |
| 3248 | .channels_min = 2, |
| 3249 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3250 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3251 | .ops = { |
| 3252 | .open = alc880_playback_pcm_open, |
| 3253 | .prepare = alc880_playback_pcm_prepare, |
| 3254 | .cleanup = alc880_playback_pcm_cleanup |
| 3255 | }, |
| 3256 | }; |
| 3257 | |
| 3258 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3259 | .substreams = 1, |
| 3260 | .channels_min = 2, |
| 3261 | .channels_max = 2, |
| 3262 | /* NID is set in alc_build_pcms */ |
| 3263 | }; |
| 3264 | |
| 3265 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3266 | .substreams = 1, |
| 3267 | .channels_min = 2, |
| 3268 | .channels_max = 2, |
| 3269 | /* NID is set in alc_build_pcms */ |
| 3270 | }; |
| 3271 | |
| 3272 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3273 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3274 | .channels_min = 2, |
| 3275 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3276 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3277 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3278 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3279 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3280 | }, |
| 3281 | }; |
| 3282 | |
| 3283 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3284 | .substreams = 1, |
| 3285 | .channels_min = 2, |
| 3286 | .channels_max = 2, |
| 3287 | /* NID is set in alc_build_pcms */ |
| 3288 | .ops = { |
| 3289 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3290 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3291 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3292 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3293 | }, |
| 3294 | }; |
| 3295 | |
| 3296 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3297 | .substreams = 1, |
| 3298 | .channels_min = 2, |
| 3299 | .channels_max = 2, |
| 3300 | /* NID is set in alc_build_pcms */ |
| 3301 | }; |
| 3302 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3303 | /* 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] | 3304 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3305 | .substreams = 0, |
| 3306 | .channels_min = 0, |
| 3307 | .channels_max = 0, |
| 3308 | }; |
| 3309 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3310 | static int alc_build_pcms(struct hda_codec *codec) |
| 3311 | { |
| 3312 | struct alc_spec *spec = codec->spec; |
| 3313 | struct hda_pcm *info = spec->pcm_rec; |
| 3314 | int i; |
| 3315 | |
| 3316 | codec->num_pcms = 1; |
| 3317 | codec->pcm_info = info; |
| 3318 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3319 | if (spec->no_analog) |
| 3320 | goto skip_analog; |
| 3321 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3322 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3323 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3324 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3325 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3326 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3327 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3328 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3329 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3330 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3331 | } |
| 3332 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3333 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3334 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3335 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3336 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3337 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3338 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3339 | if (spec->channel_mode) { |
| 3340 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3341 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3342 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3343 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3344 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3345 | } |
| 3346 | } |
| 3347 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3348 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3349 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3350 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3351 | snprintf(spec->stream_name_digital, |
| 3352 | sizeof(spec->stream_name_digital), |
| 3353 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3354 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3355 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3356 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3357 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3358 | if (spec->dig_out_type) |
| 3359 | info->pcm_type = spec->dig_out_type; |
| 3360 | else |
| 3361 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3362 | if (spec->multiout.dig_out_nid && |
| 3363 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3364 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3365 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3366 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3367 | if (spec->dig_in_nid && |
| 3368 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3369 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3370 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3371 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3372 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3373 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3374 | } |
| 3375 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3376 | if (spec->no_analog) |
| 3377 | return 0; |
| 3378 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3379 | /* If the use of more than one ADC is requested for the current |
| 3380 | * model, configure a second analog capture-only PCM. |
| 3381 | */ |
| 3382 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3383 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3384 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3385 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3386 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3387 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3388 | if (spec->alt_dac_nid) { |
| 3389 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3390 | *spec->stream_analog_alt_playback; |
| 3391 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3392 | spec->alt_dac_nid; |
| 3393 | } else { |
| 3394 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3395 | alc_pcm_null_stream; |
| 3396 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3397 | } |
| 3398 | if (spec->num_adc_nids > 1) { |
| 3399 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3400 | *spec->stream_analog_alt_capture; |
| 3401 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3402 | spec->adc_nids[1]; |
| 3403 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3404 | spec->num_adc_nids - 1; |
| 3405 | } else { |
| 3406 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3407 | alc_pcm_null_stream; |
| 3408 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3409 | } |
| 3410 | } |
| 3411 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3412 | return 0; |
| 3413 | } |
| 3414 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3415 | static void alc_free_kctls(struct hda_codec *codec) |
| 3416 | { |
| 3417 | struct alc_spec *spec = codec->spec; |
| 3418 | |
| 3419 | if (spec->kctls.list) { |
| 3420 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3421 | int i; |
| 3422 | for (i = 0; i < spec->kctls.used; i++) |
| 3423 | kfree(kctl[i].name); |
| 3424 | } |
| 3425 | snd_array_free(&spec->kctls); |
| 3426 | } |
| 3427 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3428 | static void alc_free(struct hda_codec *codec) |
| 3429 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3430 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3431 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3432 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3433 | return; |
| 3434 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3435 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3436 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3437 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3438 | } |
| 3439 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3440 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3441 | static int alc_resume(struct hda_codec *codec) |
| 3442 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3443 | codec->patch_ops.init(codec); |
| 3444 | snd_hda_codec_resume_amp(codec); |
| 3445 | snd_hda_codec_resume_cache(codec); |
| 3446 | return 0; |
| 3447 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3448 | #endif |
| 3449 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3450 | /* |
| 3451 | */ |
| 3452 | static struct hda_codec_ops alc_patch_ops = { |
| 3453 | .build_controls = alc_build_controls, |
| 3454 | .build_pcms = alc_build_pcms, |
| 3455 | .init = alc_init, |
| 3456 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3457 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3458 | #ifdef SND_HDA_NEEDS_RESUME |
| 3459 | .resume = alc_resume, |
| 3460 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3461 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3462 | .check_power_status = alc_check_power_status, |
| 3463 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3464 | }; |
| 3465 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3466 | |
| 3467 | /* |
| 3468 | * Test configuration for debugging |
| 3469 | * |
| 3470 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3471 | * enum controls. |
| 3472 | */ |
| 3473 | #ifdef CONFIG_SND_DEBUG |
| 3474 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3475 | 0x02, 0x03, 0x04, 0x05 |
| 3476 | }; |
| 3477 | |
| 3478 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3479 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3480 | .items = { |
| 3481 | { "In-1", 0x0 }, |
| 3482 | { "In-2", 0x1 }, |
| 3483 | { "In-3", 0x2 }, |
| 3484 | { "In-4", 0x3 }, |
| 3485 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3486 | { "Front", 0x5 }, |
| 3487 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3488 | }, |
| 3489 | }; |
| 3490 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3491 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3492 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3493 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3494 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3495 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3496 | }; |
| 3497 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3498 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3499 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3500 | { |
| 3501 | static char *texts[] = { |
| 3502 | "N/A", "Line Out", "HP Out", |
| 3503 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3504 | }; |
| 3505 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3506 | uinfo->count = 1; |
| 3507 | uinfo->value.enumerated.items = 8; |
| 3508 | if (uinfo->value.enumerated.item >= 8) |
| 3509 | uinfo->value.enumerated.item = 7; |
| 3510 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3511 | return 0; |
| 3512 | } |
| 3513 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3514 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3515 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3516 | { |
| 3517 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3518 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3519 | unsigned int pin_ctl, item = 0; |
| 3520 | |
| 3521 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3522 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3523 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3524 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3525 | item = 2; |
| 3526 | else |
| 3527 | item = 1; |
| 3528 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3529 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3530 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3531 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3532 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3533 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3534 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3535 | } |
| 3536 | } |
| 3537 | ucontrol->value.enumerated.item[0] = item; |
| 3538 | return 0; |
| 3539 | } |
| 3540 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3541 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3542 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3543 | { |
| 3544 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3545 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3546 | static unsigned int ctls[] = { |
| 3547 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3548 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3549 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3550 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3551 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3552 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3553 | }; |
| 3554 | unsigned int old_ctl, new_ctl; |
| 3555 | |
| 3556 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3557 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3558 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3559 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3560 | int val; |
| 3561 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3562 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3563 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3564 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3565 | HDA_AMP_MUTE : 0; |
| 3566 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3567 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3568 | return 1; |
| 3569 | } |
| 3570 | return 0; |
| 3571 | } |
| 3572 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3573 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3574 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3575 | { |
| 3576 | static char *texts[] = { |
| 3577 | "Front", "Surround", "CLFE", "Side" |
| 3578 | }; |
| 3579 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3580 | uinfo->count = 1; |
| 3581 | uinfo->value.enumerated.items = 4; |
| 3582 | if (uinfo->value.enumerated.item >= 4) |
| 3583 | uinfo->value.enumerated.item = 3; |
| 3584 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3585 | return 0; |
| 3586 | } |
| 3587 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3588 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3589 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3590 | { |
| 3591 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3592 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3593 | unsigned int sel; |
| 3594 | |
| 3595 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3596 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3597 | return 0; |
| 3598 | } |
| 3599 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3600 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3601 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3602 | { |
| 3603 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3604 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3605 | unsigned int sel; |
| 3606 | |
| 3607 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3608 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3609 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3610 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3611 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3612 | return 1; |
| 3613 | } |
| 3614 | return 0; |
| 3615 | } |
| 3616 | |
| 3617 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3618 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3619 | .name = xname, \ |
| 3620 | .info = alc_test_pin_ctl_info, \ |
| 3621 | .get = alc_test_pin_ctl_get, \ |
| 3622 | .put = alc_test_pin_ctl_put, \ |
| 3623 | .private_value = nid \ |
| 3624 | } |
| 3625 | |
| 3626 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3627 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3628 | .name = xname, \ |
| 3629 | .info = alc_test_pin_src_info, \ |
| 3630 | .get = alc_test_pin_src_get, \ |
| 3631 | .put = alc_test_pin_src_put, \ |
| 3632 | .private_value = nid \ |
| 3633 | } |
| 3634 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3635 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3636 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3637 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3638 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3639 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3640 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3641 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3642 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3643 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3644 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3645 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3646 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3647 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3648 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3649 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3650 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3651 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3652 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3653 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3654 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3655 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3656 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3657 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3658 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3659 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3660 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3661 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3662 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3663 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3664 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3665 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3666 | { |
| 3667 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3668 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3669 | .info = alc_ch_mode_info, |
| 3670 | .get = alc_ch_mode_get, |
| 3671 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3672 | }, |
| 3673 | { } /* end */ |
| 3674 | }; |
| 3675 | |
| 3676 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3677 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3678 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3679 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3680 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3681 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3682 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3683 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3684 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3685 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3686 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3687 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3688 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3689 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3690 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3691 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3692 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3693 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3694 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3695 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3696 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3697 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3698 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3699 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3700 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3701 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3702 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3703 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3704 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3705 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3706 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3707 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3708 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3709 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3710 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3711 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3712 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3713 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3714 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3715 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3716 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3717 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3718 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3719 | /* Analog input/passthru */ |
| 3720 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3721 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3722 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3723 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3724 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3725 | { } |
| 3726 | }; |
| 3727 | #endif |
| 3728 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3729 | /* |
| 3730 | */ |
| 3731 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3732 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3733 | [ALC880_3ST] = "3stack", |
| 3734 | [ALC880_TCL_S700] = "tcl", |
| 3735 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3736 | [ALC880_CLEVO] = "clevo", |
| 3737 | [ALC880_5ST] = "5stack", |
| 3738 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3739 | [ALC880_W810] = "w810", |
| 3740 | [ALC880_Z71V] = "z71v", |
| 3741 | [ALC880_6ST] = "6stack", |
| 3742 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3743 | [ALC880_ASUS] = "asus", |
| 3744 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3745 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3746 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3747 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3748 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3749 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3750 | [ALC880_F1734] = "F1734", |
| 3751 | [ALC880_LG] = "lg", |
| 3752 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3753 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3754 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3755 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3756 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3757 | [ALC880_AUTO] = "auto", |
| 3758 | }; |
| 3759 | |
| 3760 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3761 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3762 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3763 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3764 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3765 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3766 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3767 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3768 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3769 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3770 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3771 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3772 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3773 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3774 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3775 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3776 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3777 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3778 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3779 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3780 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3781 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3782 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3783 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3784 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3785 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3786 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3787 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3788 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3789 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3790 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3791 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3792 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3793 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3794 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3795 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3796 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3797 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3798 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3799 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3800 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3801 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3802 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3803 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3804 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3805 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3806 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3807 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3808 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3809 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3810 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3811 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3812 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3813 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3814 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3815 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3816 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3817 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3818 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3819 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3820 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3821 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3822 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3823 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3824 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3825 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3826 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3827 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3828 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3829 | /* default Intel */ |
| 3830 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3831 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3832 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3833 | {} |
| 3834 | }; |
| 3835 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3836 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3837 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3838 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3839 | static struct alc_config_preset alc880_presets[] = { |
| 3840 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3841 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3842 | .init_verbs = { alc880_volume_init_verbs, |
| 3843 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3844 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3845 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3846 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3847 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3848 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3849 | .input_mux = &alc880_capture_source, |
| 3850 | }, |
| 3851 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3852 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3853 | .init_verbs = { alc880_volume_init_verbs, |
| 3854 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3855 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3856 | .dac_nids = alc880_dac_nids, |
| 3857 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3858 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3859 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3860 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3861 | .input_mux = &alc880_capture_source, |
| 3862 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3863 | [ALC880_TCL_S700] = { |
| 3864 | .mixers = { alc880_tcl_s700_mixer }, |
| 3865 | .init_verbs = { alc880_volume_init_verbs, |
| 3866 | alc880_pin_tcl_S700_init_verbs, |
| 3867 | alc880_gpio2_init_verbs }, |
| 3868 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3869 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3870 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3871 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3872 | .hp_nid = 0x03, |
| 3873 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3874 | .channel_mode = alc880_2_jack_modes, |
| 3875 | .input_mux = &alc880_capture_source, |
| 3876 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3877 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3878 | .mixers = { alc880_three_stack_mixer, |
| 3879 | alc880_five_stack_mixer}, |
| 3880 | .init_verbs = { alc880_volume_init_verbs, |
| 3881 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3882 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3883 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3884 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3885 | .channel_mode = alc880_fivestack_modes, |
| 3886 | .input_mux = &alc880_capture_source, |
| 3887 | }, |
| 3888 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3889 | .mixers = { alc880_three_stack_mixer, |
| 3890 | alc880_five_stack_mixer }, |
| 3891 | .init_verbs = { alc880_volume_init_verbs, |
| 3892 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3893 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3894 | .dac_nids = alc880_dac_nids, |
| 3895 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3896 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3897 | .channel_mode = alc880_fivestack_modes, |
| 3898 | .input_mux = &alc880_capture_source, |
| 3899 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3900 | [ALC880_6ST] = { |
| 3901 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3902 | .init_verbs = { alc880_volume_init_verbs, |
| 3903 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3904 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3905 | .dac_nids = alc880_6st_dac_nids, |
| 3906 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3907 | .channel_mode = alc880_sixstack_modes, |
| 3908 | .input_mux = &alc880_6stack_capture_source, |
| 3909 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3910 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3911 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3912 | .init_verbs = { alc880_volume_init_verbs, |
| 3913 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3914 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3915 | .dac_nids = alc880_6st_dac_nids, |
| 3916 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3917 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3918 | .channel_mode = alc880_sixstack_modes, |
| 3919 | .input_mux = &alc880_6stack_capture_source, |
| 3920 | }, |
| 3921 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3922 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3923 | .init_verbs = { alc880_volume_init_verbs, |
| 3924 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3925 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3926 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3927 | .dac_nids = alc880_w810_dac_nids, |
| 3928 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3929 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3930 | .channel_mode = alc880_w810_modes, |
| 3931 | .input_mux = &alc880_capture_source, |
| 3932 | }, |
| 3933 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3934 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3935 | .init_verbs = { alc880_volume_init_verbs, |
| 3936 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3937 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3938 | .dac_nids = alc880_z71v_dac_nids, |
| 3939 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3940 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3941 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3942 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3943 | .input_mux = &alc880_capture_source, |
| 3944 | }, |
| 3945 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3946 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3947 | .init_verbs = { alc880_volume_init_verbs, |
| 3948 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3949 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3950 | .dac_nids = alc880_f1734_dac_nids, |
| 3951 | .hp_nid = 0x02, |
| 3952 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3953 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3954 | .input_mux = &alc880_f1734_capture_source, |
| 3955 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3956 | .init_hook = alc880_uniwill_p53_init_hook, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3957 | }, |
| 3958 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3959 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3960 | .init_verbs = { alc880_volume_init_verbs, |
| 3961 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3962 | alc880_gpio1_init_verbs }, |
| 3963 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3964 | .dac_nids = alc880_asus_dac_nids, |
| 3965 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3966 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3967 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3968 | .input_mux = &alc880_capture_source, |
| 3969 | }, |
| 3970 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3971 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3972 | .init_verbs = { alc880_volume_init_verbs, |
| 3973 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3974 | alc880_gpio1_init_verbs }, |
| 3975 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3976 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3977 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3978 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3979 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3980 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3981 | .input_mux = &alc880_capture_source, |
| 3982 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3983 | [ALC880_ASUS_DIG2] = { |
| 3984 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3985 | .init_verbs = { alc880_volume_init_verbs, |
| 3986 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3987 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3988 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3989 | .dac_nids = alc880_asus_dac_nids, |
| 3990 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3991 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3992 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3993 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3994 | .input_mux = &alc880_capture_source, |
| 3995 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3996 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3997 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3998 | .init_verbs = { alc880_volume_init_verbs, |
| 3999 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4000 | alc880_gpio1_init_verbs }, |
| 4001 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4002 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4003 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4004 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4005 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4006 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4007 | .input_mux = &alc880_capture_source, |
| 4008 | }, |
| 4009 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4010 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4011 | .init_verbs = { alc880_volume_init_verbs, |
| 4012 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4013 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4014 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4015 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4016 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4017 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4018 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4019 | .input_mux = &alc880_capture_source, |
| 4020 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4021 | [ALC880_UNIWILL] = { |
| 4022 | .mixers = { alc880_uniwill_mixer }, |
| 4023 | .init_verbs = { alc880_volume_init_verbs, |
| 4024 | alc880_uniwill_init_verbs }, |
| 4025 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4026 | .dac_nids = alc880_asus_dac_nids, |
| 4027 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4028 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4029 | .channel_mode = alc880_threestack_modes, |
| 4030 | .need_dac_fix = 1, |
| 4031 | .input_mux = &alc880_capture_source, |
| 4032 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4033 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4034 | }, |
| 4035 | [ALC880_UNIWILL_P53] = { |
| 4036 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4037 | .init_verbs = { alc880_volume_init_verbs, |
| 4038 | alc880_uniwill_p53_init_verbs }, |
| 4039 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4040 | .dac_nids = alc880_asus_dac_nids, |
| 4041 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4042 | .channel_mode = alc880_threestack_modes, |
| 4043 | .input_mux = &alc880_capture_source, |
| 4044 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4045 | .init_hook = alc880_uniwill_p53_init_hook, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4046 | }, |
| 4047 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4048 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4049 | .init_verbs = { alc880_volume_init_verbs, |
| 4050 | alc880_uniwill_p53_init_verbs, |
| 4051 | alc880_beep_init_verbs }, |
| 4052 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4053 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4054 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4055 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4056 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4057 | .input_mux = &alc880_capture_source, |
| 4058 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4059 | .init_hook = alc880_uniwill_p53_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4060 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4061 | [ALC880_CLEVO] = { |
| 4062 | .mixers = { alc880_three_stack_mixer }, |
| 4063 | .init_verbs = { alc880_volume_init_verbs, |
| 4064 | alc880_pin_clevo_init_verbs }, |
| 4065 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4066 | .dac_nids = alc880_dac_nids, |
| 4067 | .hp_nid = 0x03, |
| 4068 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4069 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4070 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4071 | .input_mux = &alc880_capture_source, |
| 4072 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4073 | [ALC880_LG] = { |
| 4074 | .mixers = { alc880_lg_mixer }, |
| 4075 | .init_verbs = { alc880_volume_init_verbs, |
| 4076 | alc880_lg_init_verbs }, |
| 4077 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4078 | .dac_nids = alc880_lg_dac_nids, |
| 4079 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4080 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4081 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4082 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4083 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4084 | .unsol_event = alc_automute_amp_unsol_event, |
| 4085 | .init_hook = alc880_lg_init_hook, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4086 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4087 | .loopbacks = alc880_lg_loopbacks, |
| 4088 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4089 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4090 | [ALC880_LG_LW] = { |
| 4091 | .mixers = { alc880_lg_lw_mixer }, |
| 4092 | .init_verbs = { alc880_volume_init_verbs, |
| 4093 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4094 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4095 | .dac_nids = alc880_dac_nids, |
| 4096 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4097 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4098 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4099 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4100 | .unsol_event = alc_automute_amp_unsol_event, |
| 4101 | .init_hook = alc880_lg_lw_init_hook, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4102 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4103 | [ALC880_MEDION_RIM] = { |
| 4104 | .mixers = { alc880_medion_rim_mixer }, |
| 4105 | .init_verbs = { alc880_volume_init_verbs, |
| 4106 | alc880_medion_rim_init_verbs, |
| 4107 | alc_gpio2_init_verbs }, |
| 4108 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4109 | .dac_nids = alc880_dac_nids, |
| 4110 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4111 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4112 | .channel_mode = alc880_2_jack_modes, |
| 4113 | .input_mux = &alc880_medion_rim_capture_source, |
| 4114 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4115 | .init_hook = alc880_medion_rim_init_hook, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4116 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4117 | #ifdef CONFIG_SND_DEBUG |
| 4118 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4119 | .mixers = { alc880_test_mixer }, |
| 4120 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4121 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4122 | .dac_nids = alc880_test_dac_nids, |
| 4123 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4124 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4125 | .channel_mode = alc880_test_modes, |
| 4126 | .input_mux = &alc880_test_capture_source, |
| 4127 | }, |
| 4128 | #endif |
| 4129 | }; |
| 4130 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4131 | /* |
| 4132 | * Automatic parse of I/O pins from the BIOS configuration |
| 4133 | */ |
| 4134 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4135 | enum { |
| 4136 | ALC_CTL_WIDGET_VOL, |
| 4137 | ALC_CTL_WIDGET_MUTE, |
| 4138 | ALC_CTL_BIND_MUTE, |
| 4139 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4140 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4141 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4142 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4143 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4144 | }; |
| 4145 | |
| 4146 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4147 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4148 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4149 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4150 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4151 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4152 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4153 | knew = snd_array_new(&spec->kctls); |
| 4154 | if (!knew) |
| 4155 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4156 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4157 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4158 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4159 | return -ENOMEM; |
| 4160 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4161 | return 0; |
| 4162 | } |
| 4163 | |
| 4164 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4165 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4166 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4167 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4168 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4169 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4170 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4171 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4172 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4173 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4174 | #define ALC880_PIN_CD_NID 0x1c |
| 4175 | |
| 4176 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4177 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4178 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4179 | { |
| 4180 | hda_nid_t nid; |
| 4181 | int assigned[4]; |
| 4182 | int i, j; |
| 4183 | |
| 4184 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4185 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4186 | |
| 4187 | /* check the pins hardwired to audio widget */ |
| 4188 | for (i = 0; i < cfg->line_outs; i++) { |
| 4189 | nid = cfg->line_out_pins[i]; |
| 4190 | if (alc880_is_fixed_pin(nid)) { |
| 4191 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4192 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4193 | assigned[idx] = 1; |
| 4194 | } |
| 4195 | } |
| 4196 | /* left pins can be connect to any audio widget */ |
| 4197 | for (i = 0; i < cfg->line_outs; i++) { |
| 4198 | nid = cfg->line_out_pins[i]; |
| 4199 | if (alc880_is_fixed_pin(nid)) |
| 4200 | continue; |
| 4201 | /* search for an empty channel */ |
| 4202 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4203 | if (!assigned[j]) { |
| 4204 | spec->multiout.dac_nids[i] = |
| 4205 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4206 | assigned[j] = 1; |
| 4207 | break; |
| 4208 | } |
| 4209 | } |
| 4210 | } |
| 4211 | spec->multiout.num_dacs = cfg->line_outs; |
| 4212 | return 0; |
| 4213 | } |
| 4214 | |
| 4215 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4216 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4217 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4218 | { |
| 4219 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4220 | static const char *chname[4] = { |
| 4221 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4222 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4223 | hda_nid_t nid; |
| 4224 | int i, err; |
| 4225 | |
| 4226 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4227 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4228 | continue; |
| 4229 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4230 | if (i == 2) { |
| 4231 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4232 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4233 | "Center Playback Volume", |
| 4234 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4235 | HDA_OUTPUT)); |
| 4236 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4237 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4238 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4239 | "LFE Playback Volume", |
| 4240 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4241 | HDA_OUTPUT)); |
| 4242 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4243 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4244 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4245 | "Center Playback Switch", |
| 4246 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4247 | HDA_INPUT)); |
| 4248 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4249 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4250 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4251 | "LFE Playback Switch", |
| 4252 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4253 | HDA_INPUT)); |
| 4254 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4255 | return err; |
| 4256 | } else { |
| 4257 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4258 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4259 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4260 | HDA_OUTPUT)); |
| 4261 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4262 | return err; |
| 4263 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4264 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4265 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4266 | HDA_INPUT)); |
| 4267 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4268 | return err; |
| 4269 | } |
| 4270 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4271 | return 0; |
| 4272 | } |
| 4273 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4274 | /* add playback controls for speaker and HP outputs */ |
| 4275 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4276 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4277 | { |
| 4278 | hda_nid_t nid; |
| 4279 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4280 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4281 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4282 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4283 | return 0; |
| 4284 | |
| 4285 | if (alc880_is_fixed_pin(pin)) { |
| 4286 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4287 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4288 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4289 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4290 | else |
| 4291 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4292 | /* control HP volume/switch on the output mixer amp */ |
| 4293 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4294 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4295 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4296 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4297 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4298 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4299 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4300 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4301 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4302 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4303 | return err; |
| 4304 | } else if (alc880_is_multi_pin(pin)) { |
| 4305 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4306 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4307 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4308 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4309 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4310 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4311 | return err; |
| 4312 | } |
| 4313 | return 0; |
| 4314 | } |
| 4315 | |
| 4316 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4317 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4318 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4319 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4320 | { |
| 4321 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4322 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4323 | |
| 4324 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4325 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4326 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4327 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4328 | return err; |
| 4329 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4330 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4331 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4332 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4333 | return err; |
| 4334 | return 0; |
| 4335 | } |
| 4336 | |
| 4337 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4338 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4339 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4340 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4341 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4342 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4343 | |
| 4344 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4345 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4346 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4347 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4348 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4349 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4350 | if (err < 0) |
| 4351 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4352 | imux->items[imux->num_items].label = |
| 4353 | auto_pin_cfg_labels[i]; |
| 4354 | imux->items[imux->num_items].index = |
| 4355 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4356 | imux->num_items++; |
| 4357 | } |
| 4358 | } |
| 4359 | return 0; |
| 4360 | } |
| 4361 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4362 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4363 | unsigned int pin_type) |
| 4364 | { |
| 4365 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4366 | pin_type); |
| 4367 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4368 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4369 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4370 | } |
| 4371 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4372 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4373 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4374 | int dac_idx) |
| 4375 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4376 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4377 | /* need the manual connection? */ |
| 4378 | if (alc880_is_multi_pin(nid)) { |
| 4379 | struct alc_spec *spec = codec->spec; |
| 4380 | int idx = alc880_multi_pin_idx(nid); |
| 4381 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4382 | AC_VERB_SET_CONNECT_SEL, |
| 4383 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4384 | } |
| 4385 | } |
| 4386 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4387 | static int get_pin_type(int line_out_type) |
| 4388 | { |
| 4389 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4390 | return PIN_HP; |
| 4391 | else |
| 4392 | return PIN_OUT; |
| 4393 | } |
| 4394 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4395 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4396 | { |
| 4397 | struct alc_spec *spec = codec->spec; |
| 4398 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4399 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4400 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4401 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4402 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4403 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4404 | } |
| 4405 | } |
| 4406 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4407 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4408 | { |
| 4409 | struct alc_spec *spec = codec->spec; |
| 4410 | hda_nid_t pin; |
| 4411 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4412 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4413 | if (pin) /* connect to front */ |
| 4414 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4415 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4416 | if (pin) /* connect to front */ |
| 4417 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4418 | } |
| 4419 | |
| 4420 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4421 | { |
| 4422 | struct alc_spec *spec = codec->spec; |
| 4423 | int i; |
| 4424 | |
| 4425 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4426 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4427 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4428 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4429 | if (nid != ALC880_PIN_CD_NID && |
| 4430 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4431 | snd_hda_codec_write(codec, nid, 0, |
| 4432 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4433 | AMP_OUT_MUTE); |
| 4434 | } |
| 4435 | } |
| 4436 | } |
| 4437 | |
| 4438 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4439 | /* return 1 if successful, 0 if the proper config is not found, |
| 4440 | * or a negative error code |
| 4441 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4442 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4443 | { |
| 4444 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4445 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4446 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4447 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4448 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4449 | alc880_ignore); |
| 4450 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4451 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4452 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4453 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4454 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4455 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4456 | if (err < 0) |
| 4457 | return err; |
| 4458 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4459 | if (err < 0) |
| 4460 | return err; |
| 4461 | err = alc880_auto_create_extra_out(spec, |
| 4462 | spec->autocfg.speaker_pins[0], |
| 4463 | "Speaker"); |
| 4464 | if (err < 0) |
| 4465 | return err; |
| 4466 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4467 | "Headphone"); |
| 4468 | if (err < 0) |
| 4469 | return err; |
| 4470 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4471 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4472 | return err; |
| 4473 | |
| 4474 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4475 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4476 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4477 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4478 | hda_nid_t dig_nid; |
| 4479 | err = snd_hda_get_connections(codec, |
| 4480 | spec->autocfg.dig_out_pins[i], |
| 4481 | &dig_nid, 1); |
| 4482 | if (err < 0) |
| 4483 | continue; |
| 4484 | if (!i) |
| 4485 | spec->multiout.dig_out_nid = dig_nid; |
| 4486 | else { |
| 4487 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4488 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4489 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4490 | break; |
| 4491 | } |
| 4492 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4493 | if (spec->autocfg.dig_in_pin) |
| 4494 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4495 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4496 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4497 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4498 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4499 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4500 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4501 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4502 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4503 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4504 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4505 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4506 | return 1; |
| 4507 | } |
| 4508 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4509 | /* additional initialization for auto-configuration model */ |
| 4510 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4511 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4512 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4513 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4514 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4515 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4516 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4517 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4518 | } |
| 4519 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4520 | static void set_capture_mixer(struct alc_spec *spec) |
| 4521 | { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4522 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4523 | { alc_capture_mixer_nosrc1, |
| 4524 | alc_capture_mixer_nosrc2, |
| 4525 | alc_capture_mixer_nosrc3 }, |
| 4526 | { alc_capture_mixer1, |
| 4527 | alc_capture_mixer2, |
| 4528 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4529 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4530 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4531 | int mux; |
| 4532 | if (spec->input_mux && spec->input_mux->num_items > 1) |
| 4533 | mux = 1; |
| 4534 | else |
| 4535 | mux = 0; |
| 4536 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4537 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4538 | } |
| 4539 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4540 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4541 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4542 | |
| 4543 | /* |
| 4544 | * OK, here we have finally the patch for ALC880 |
| 4545 | */ |
| 4546 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4547 | static int patch_alc880(struct hda_codec *codec) |
| 4548 | { |
| 4549 | struct alc_spec *spec; |
| 4550 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4551 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4552 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4553 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4554 | if (spec == NULL) |
| 4555 | return -ENOMEM; |
| 4556 | |
| 4557 | codec->spec = spec; |
| 4558 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4559 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4560 | alc880_models, |
| 4561 | alc880_cfg_tbl); |
| 4562 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 4563 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 4564 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4565 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4566 | } |
| 4567 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4568 | if (board_config == ALC880_AUTO) { |
| 4569 | /* automatic parse from the BIOS config */ |
| 4570 | err = alc880_parse_auto_config(codec); |
| 4571 | if (err < 0) { |
| 4572 | alc_free(codec); |
| 4573 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4574 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4575 | printk(KERN_INFO |
| 4576 | "hda_codec: Cannot set up configuration " |
| 4577 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4578 | board_config = ALC880_3ST; |
| 4579 | } |
| 4580 | } |
| 4581 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4582 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4583 | if (err < 0) { |
| 4584 | alc_free(codec); |
| 4585 | return err; |
| 4586 | } |
| 4587 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4588 | if (board_config != ALC880_AUTO) |
| 4589 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4590 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4591 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4592 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4593 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4594 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4595 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4596 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4597 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4598 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4599 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4600 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4601 | /* get type */ |
| 4602 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4603 | if (wcap != AC_WID_AUD_IN) { |
| 4604 | spec->adc_nids = alc880_adc_nids_alt; |
| 4605 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4606 | } else { |
| 4607 | spec->adc_nids = alc880_adc_nids; |
| 4608 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4609 | } |
| 4610 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4611 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4612 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4613 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4614 | spec->vmaster_nid = 0x0c; |
| 4615 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4616 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4617 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4618 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4619 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4620 | if (!spec->loopback.amplist) |
| 4621 | spec->loopback.amplist = alc880_loopbacks; |
| 4622 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4623 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4624 | |
| 4625 | return 0; |
| 4626 | } |
| 4627 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4628 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4629 | /* |
| 4630 | * ALC260 support |
| 4631 | */ |
| 4632 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4633 | static hda_nid_t alc260_dac_nids[1] = { |
| 4634 | /* front */ |
| 4635 | 0x02, |
| 4636 | }; |
| 4637 | |
| 4638 | static hda_nid_t alc260_adc_nids[1] = { |
| 4639 | /* ADC0 */ |
| 4640 | 0x04, |
| 4641 | }; |
| 4642 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4643 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4644 | /* ADC1 */ |
| 4645 | 0x05, |
| 4646 | }; |
| 4647 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4648 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4649 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4650 | */ |
| 4651 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4652 | /* ADC0, ADC1 */ |
| 4653 | 0x04, 0x05 |
| 4654 | }; |
| 4655 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4656 | #define ALC260_DIGOUT_NID 0x03 |
| 4657 | #define ALC260_DIGIN_NID 0x06 |
| 4658 | |
| 4659 | static struct hda_input_mux alc260_capture_source = { |
| 4660 | .num_items = 4, |
| 4661 | .items = { |
| 4662 | { "Mic", 0x0 }, |
| 4663 | { "Front Mic", 0x1 }, |
| 4664 | { "Line", 0x2 }, |
| 4665 | { "CD", 0x4 }, |
| 4666 | }, |
| 4667 | }; |
| 4668 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4669 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4670 | * headphone jack and the internal CD lines since these are the only pins at |
| 4671 | * which audio can appear. For flexibility, also allow the option of |
| 4672 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4673 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4674 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4675 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4676 | { |
| 4677 | .num_items = 3, |
| 4678 | .items = { |
| 4679 | { "Mic/Line", 0x0 }, |
| 4680 | { "CD", 0x4 }, |
| 4681 | { "Headphone", 0x2 }, |
| 4682 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4683 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4684 | { |
| 4685 | .num_items = 4, |
| 4686 | .items = { |
| 4687 | { "Mic/Line", 0x0 }, |
| 4688 | { "CD", 0x4 }, |
| 4689 | { "Headphone", 0x2 }, |
| 4690 | { "Mixer", 0x5 }, |
| 4691 | }, |
| 4692 | }, |
| 4693 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4694 | }; |
| 4695 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4696 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4697 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4698 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4699 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4700 | { |
| 4701 | .num_items = 4, |
| 4702 | .items = { |
| 4703 | { "Mic", 0x0 }, |
| 4704 | { "Line", 0x2 }, |
| 4705 | { "CD", 0x4 }, |
| 4706 | { "Headphone", 0x5 }, |
| 4707 | }, |
| 4708 | }, |
| 4709 | { |
| 4710 | .num_items = 5, |
| 4711 | .items = { |
| 4712 | { "Mic", 0x0 }, |
| 4713 | { "Line", 0x2 }, |
| 4714 | { "CD", 0x4 }, |
| 4715 | { "Headphone", 0x6 }, |
| 4716 | { "Mixer", 0x5 }, |
| 4717 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4718 | }, |
| 4719 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4720 | |
| 4721 | /* Maxdata Favorit 100XS */ |
| 4722 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4723 | { |
| 4724 | .num_items = 2, |
| 4725 | .items = { |
| 4726 | { "Line/Mic", 0x0 }, |
| 4727 | { "CD", 0x4 }, |
| 4728 | }, |
| 4729 | }, |
| 4730 | { |
| 4731 | .num_items = 3, |
| 4732 | .items = { |
| 4733 | { "Line/Mic", 0x0 }, |
| 4734 | { "CD", 0x4 }, |
| 4735 | { "Mixer", 0x5 }, |
| 4736 | }, |
| 4737 | }, |
| 4738 | }; |
| 4739 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4740 | /* |
| 4741 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4742 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4743 | * element which allows changing the channel mode, so the verb list is |
| 4744 | * never used. |
| 4745 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4746 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4747 | { 2, NULL }, |
| 4748 | }; |
| 4749 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4750 | |
| 4751 | /* Mixer combinations |
| 4752 | * |
| 4753 | * basic: base_output + input + pc_beep + capture |
| 4754 | * HP: base_output + input + capture_alt |
| 4755 | * HP_3013: hp_3013 + input + capture |
| 4756 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4757 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4758 | */ |
| 4759 | |
| 4760 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4761 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4762 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4763 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4764 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4765 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4766 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4767 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4768 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4769 | |
| 4770 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4771 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4772 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4773 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4774 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4775 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4776 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4777 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4778 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4779 | { } /* end */ |
| 4780 | }; |
| 4781 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4782 | /* update HP, line and mono out pins according to the master switch */ |
| 4783 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4784 | hda_nid_t hp, hda_nid_t line, |
| 4785 | hda_nid_t mono) |
| 4786 | { |
| 4787 | struct alc_spec *spec = codec->spec; |
| 4788 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4789 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4790 | 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] | 4791 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4792 | 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] | 4793 | val); |
| 4794 | /* mono (speaker) depending on the HP jack sense */ |
| 4795 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4796 | 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] | 4797 | val); |
| 4798 | } |
| 4799 | |
| 4800 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4801 | struct snd_ctl_elem_value *ucontrol) |
| 4802 | { |
| 4803 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4804 | struct alc_spec *spec = codec->spec; |
| 4805 | *ucontrol->value.integer.value = spec->master_sw; |
| 4806 | return 0; |
| 4807 | } |
| 4808 | |
| 4809 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4810 | struct snd_ctl_elem_value *ucontrol) |
| 4811 | { |
| 4812 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4813 | struct alc_spec *spec = codec->spec; |
| 4814 | int val = !!*ucontrol->value.integer.value; |
| 4815 | hda_nid_t hp, line, mono; |
| 4816 | |
| 4817 | if (val == spec->master_sw) |
| 4818 | return 0; |
| 4819 | spec->master_sw = val; |
| 4820 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4821 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4822 | mono = kcontrol->private_value & 0xff; |
| 4823 | alc260_hp_master_update(codec, hp, line, mono); |
| 4824 | return 1; |
| 4825 | } |
| 4826 | |
| 4827 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4828 | { |
| 4829 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4830 | .name = "Master Playback Switch", |
| 4831 | .info = snd_ctl_boolean_mono_info, |
| 4832 | .get = alc260_hp_master_sw_get, |
| 4833 | .put = alc260_hp_master_sw_put, |
| 4834 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4835 | }, |
| 4836 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4837 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4838 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4839 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4840 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4841 | HDA_OUTPUT), |
| 4842 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4843 | { } /* end */ |
| 4844 | }; |
| 4845 | |
| 4846 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4847 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4848 | {}, |
| 4849 | }; |
| 4850 | |
| 4851 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4852 | { |
| 4853 | struct alc_spec *spec = codec->spec; |
| 4854 | unsigned int present; |
| 4855 | |
| 4856 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4857 | AC_VERB_GET_PIN_SENSE, 0); |
| 4858 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4859 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4860 | } |
| 4861 | |
| 4862 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4863 | { |
| 4864 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4865 | alc260_hp_automute(codec); |
| 4866 | } |
| 4867 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4868 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4869 | { |
| 4870 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4871 | .name = "Master Playback Switch", |
| 4872 | .info = snd_ctl_boolean_mono_info, |
| 4873 | .get = alc260_hp_master_sw_get, |
| 4874 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4875 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4876 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4877 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4878 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4879 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4880 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4881 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4882 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4883 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4884 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4885 | { } /* end */ |
| 4886 | }; |
| 4887 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4888 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4889 | .ops = &snd_hda_bind_vol, |
| 4890 | .values = { |
| 4891 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4892 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4893 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4894 | 0 |
| 4895 | }, |
| 4896 | }; |
| 4897 | |
| 4898 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4899 | .ops = &snd_hda_bind_sw, |
| 4900 | .values = { |
| 4901 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4902 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4903 | 0 |
| 4904 | }, |
| 4905 | }; |
| 4906 | |
| 4907 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4908 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4909 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4910 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4911 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4912 | { } /* end */ |
| 4913 | }; |
| 4914 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4915 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4916 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4917 | {}, |
| 4918 | }; |
| 4919 | |
| 4920 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4921 | { |
| 4922 | struct alc_spec *spec = codec->spec; |
| 4923 | unsigned int present; |
| 4924 | |
| 4925 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4926 | AC_VERB_GET_PIN_SENSE, 0); |
| 4927 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4928 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4929 | } |
| 4930 | |
| 4931 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4932 | unsigned int res) |
| 4933 | { |
| 4934 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4935 | alc260_hp_3013_automute(codec); |
| 4936 | } |
| 4937 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4938 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4939 | { |
| 4940 | unsigned int present, bits; |
| 4941 | |
| 4942 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4943 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4944 | |
| 4945 | bits = present ? 0 : PIN_OUT; |
| 4946 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4947 | bits); |
| 4948 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4949 | bits); |
| 4950 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4951 | bits); |
| 4952 | } |
| 4953 | |
| 4954 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4955 | unsigned int res) |
| 4956 | { |
| 4957 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4958 | alc260_hp_3012_automute(codec); |
| 4959 | } |
| 4960 | |
| 4961 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4962 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4963 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4964 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4965 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4966 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4967 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4968 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4969 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4970 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4971 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4972 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4973 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4974 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4975 | { } /* end */ |
| 4976 | }; |
| 4977 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4978 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4979 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4980 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4981 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4982 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4983 | * revisions available in early 2006. Therefore for now allow the |
| 4984 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4985 | * that the lack of mic bias for this NID is intentional we could change the |
| 4986 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4987 | * |
| 4988 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4989 | * don't appear to make the mic bias available from the "line" jack, even |
| 4990 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4991 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4992 | * and the output jack. If this turns out to be the case for all such |
| 4993 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4994 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4995 | * |
| 4996 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4997 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4998 | * controls for such models. On models without a "mono speaker" the control |
| 4999 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5000 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5001 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5002 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5003 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5004 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5005 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5006 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5007 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5008 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5009 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5010 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5011 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5012 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5013 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5014 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5015 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5016 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5017 | { } /* end */ |
| 5018 | }; |
| 5019 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5020 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5021 | */ |
| 5022 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5023 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5024 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5025 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5026 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5027 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5028 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5029 | { } /* end */ |
| 5030 | }; |
| 5031 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5032 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5033 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5034 | */ |
| 5035 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5036 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5037 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5038 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5039 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5040 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5041 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5042 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5043 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5044 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5045 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5046 | { } /* end */ |
| 5047 | }; |
| 5048 | |
| 5049 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5050 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5051 | */ |
| 5052 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5053 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5054 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5055 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5056 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5057 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5058 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5059 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5060 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5061 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5062 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5063 | { } /* end */ |
| 5064 | }; |
| 5065 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5066 | /* |
| 5067 | * initialization verbs |
| 5068 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5069 | static struct hda_verb alc260_init_verbs[] = { |
| 5070 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5071 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5072 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5073 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5074 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5075 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5076 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5077 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5078 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5079 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5080 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5081 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5082 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5083 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5084 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5085 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5086 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5087 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5088 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5089 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5090 | /* set connection select to line in (default select for this ADC) */ |
| 5091 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5092 | /* mute capture amp left and right */ |
| 5093 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5094 | /* set connection select to line in (default select for this ADC) */ |
| 5095 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5096 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5097 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5098 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5099 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5100 | /* set vol=0 HP mixer amp left and right */ |
| 5101 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5102 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5103 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5104 | /* set vol=0 Mono mixer amp left and right */ |
| 5105 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5106 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5107 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5108 | /* unmute LINE-2 out pin */ |
| 5109 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5110 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5111 | * Line In 2 = 0x03 |
| 5112 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5113 | /* mute analog inputs */ |
| 5114 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5115 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5116 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5117 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5118 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5119 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5120 | /* mute Front out path */ |
| 5121 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5122 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5123 | /* mute Headphone out path */ |
| 5124 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5125 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5126 | /* mute Mono out path */ |
| 5127 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5128 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5129 | { } |
| 5130 | }; |
| 5131 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5132 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5133 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5134 | /* Headphone and output */ |
| 5135 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5136 | /* mono output */ |
| 5137 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5138 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5139 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5140 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5141 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5142 | /* Line In pin widget for input */ |
| 5143 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5144 | /* Line-2 pin widget for output */ |
| 5145 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5146 | /* CD pin widget for input */ |
| 5147 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5148 | /* unmute amp left and right */ |
| 5149 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5150 | /* set connection select to line in (default select for this ADC) */ |
| 5151 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5152 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5153 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5154 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5155 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5156 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5157 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5158 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5159 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5160 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5161 | * Line In 2 = 0x03 |
| 5162 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5163 | /* mute analog inputs */ |
| 5164 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5165 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5166 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5167 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5168 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5169 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5170 | /* Unmute Front out path */ |
| 5171 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5172 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5173 | /* Unmute Headphone out path */ |
| 5174 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5175 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5176 | /* Unmute Mono out path */ |
| 5177 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5178 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5179 | { } |
| 5180 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5181 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5182 | |
| 5183 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5184 | /* Line out and output */ |
| 5185 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5186 | /* mono output */ |
| 5187 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5188 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5189 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5190 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5191 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5192 | /* Line In pin widget for input */ |
| 5193 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5194 | /* Headphone pin widget for output */ |
| 5195 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5196 | /* CD pin widget for input */ |
| 5197 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5198 | /* unmute amp left and right */ |
| 5199 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5200 | /* set connection select to line in (default select for this ADC) */ |
| 5201 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5202 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5203 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5204 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5205 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5206 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5207 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5208 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5209 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5210 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5211 | * Line In 2 = 0x03 |
| 5212 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5213 | /* mute analog inputs */ |
| 5214 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5215 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5216 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5217 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5218 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5219 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5220 | /* Unmute Front out path */ |
| 5221 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5222 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5223 | /* Unmute Headphone out path */ |
| 5224 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5225 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5226 | /* Unmute Mono out path */ |
| 5227 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5228 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5229 | { } |
| 5230 | }; |
| 5231 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5232 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5233 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5234 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5235 | */ |
| 5236 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5237 | /* Disable all GPIOs */ |
| 5238 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5239 | /* Internal speaker is connected to headphone pin */ |
| 5240 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5241 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5242 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5243 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5244 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5245 | /* Ensure all other unused pins are disabled and muted. */ |
| 5246 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5247 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5248 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5249 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5250 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5251 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5252 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5253 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5254 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5255 | /* Disable digital (SPDIF) pins */ |
| 5256 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5257 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5258 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5259 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5260 | * when acting as an output. |
| 5261 | */ |
| 5262 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5263 | |
| 5264 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5265 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5266 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5267 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5268 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5269 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5270 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5271 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5272 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5273 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5274 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5275 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5276 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5277 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5278 | * If the pin mode is changed by the user the pin mode control will |
| 5279 | * take care of enabling the pin's input/output buffers as needed. |
| 5280 | * Therefore there's no need to enable the input buffer at this |
| 5281 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5282 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5283 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5284 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5285 | * mixer ctrl) |
| 5286 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5287 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5288 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5289 | /* Mute capture amp left and right */ |
| 5290 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5291 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5292 | * in (on mic1 pin) |
| 5293 | */ |
| 5294 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5295 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5296 | /* Do the same for the second ADC: mute capture input amp and |
| 5297 | * set ADC connection to line in (on mic1 pin) |
| 5298 | */ |
| 5299 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5300 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5301 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5302 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5303 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5304 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5305 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5306 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5307 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5308 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5309 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5310 | {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] | 5311 | |
| 5312 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5313 | }; |
| 5314 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5315 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5316 | * similar laptops (adapted from Fujitsu init verbs). |
| 5317 | */ |
| 5318 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5319 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5320 | * the headphone jack. Turn this on and rely on the standard mute |
| 5321 | * methods whenever the user wants to turn these outputs off. |
| 5322 | */ |
| 5323 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5324 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5325 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5326 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5327 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5328 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5329 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5330 | /* Line In jack is connected to Line1 pin */ |
| 5331 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5332 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5333 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5334 | /* Ensure all other unused pins are disabled and muted. */ |
| 5335 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5336 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5337 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5338 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5339 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5340 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5341 | /* Disable digital (SPDIF) pins */ |
| 5342 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5343 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5344 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5345 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5346 | * bus when acting as outputs. |
| 5347 | */ |
| 5348 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5349 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5350 | |
| 5351 | /* Start with output sum widgets muted and their output gains at min */ |
| 5352 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5353 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5354 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5355 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5356 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5357 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5358 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5359 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5360 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5361 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5362 | /* Unmute Line-out pin widget amp left and right |
| 5363 | * (no equiv mixer ctrl) |
| 5364 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5365 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5366 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5367 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5368 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5369 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5370 | * will take care of enabling the pin's input/output buffers as needed. |
| 5371 | * Therefore there's no need to enable the input buffer at this |
| 5372 | * stage. |
| 5373 | */ |
| 5374 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5375 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5376 | |
| 5377 | /* Mute capture amp left and right */ |
| 5378 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5379 | /* Set ADC connection select to match default mixer setting - mic |
| 5380 | * (on mic1 pin) |
| 5381 | */ |
| 5382 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5383 | |
| 5384 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5385 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5386 | */ |
| 5387 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5388 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5389 | |
| 5390 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5391 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5392 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5393 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5394 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5395 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5396 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5397 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5398 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5399 | |
| 5400 | { } |
| 5401 | }; |
| 5402 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5403 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5404 | * (adapted from Acer init verbs). |
| 5405 | */ |
| 5406 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5407 | /* GPIO 0 enables the output jack. |
| 5408 | * Turn this on and rely on the standard mute |
| 5409 | * methods whenever the user wants to turn these outputs off. |
| 5410 | */ |
| 5411 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5412 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5413 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5414 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5415 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5416 | /* Ensure all other unused pins are disabled and muted. */ |
| 5417 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5418 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5419 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5420 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5421 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5422 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5423 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5424 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5425 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5426 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5427 | /* Disable digital (SPDIF) pins */ |
| 5428 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5429 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5430 | |
| 5431 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5432 | * bus when acting as outputs. |
| 5433 | */ |
| 5434 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5435 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5436 | |
| 5437 | /* Start with output sum widgets muted and their output gains at min */ |
| 5438 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5439 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5440 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5441 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5442 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5443 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5444 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5445 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5446 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5447 | |
| 5448 | /* Unmute Line-out pin widget amp left and right |
| 5449 | * (no equiv mixer ctrl) |
| 5450 | */ |
| 5451 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5452 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5453 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5454 | * will take care of enabling the pin's input/output buffers as needed. |
| 5455 | * Therefore there's no need to enable the input buffer at this |
| 5456 | * stage. |
| 5457 | */ |
| 5458 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5459 | |
| 5460 | /* Mute capture amp left and right */ |
| 5461 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5462 | /* Set ADC connection select to match default mixer setting - mic |
| 5463 | * (on mic1 pin) |
| 5464 | */ |
| 5465 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5466 | |
| 5467 | /* Do similar with the second ADC: mute capture input amp and |
| 5468 | * set ADC connection to mic to match ALSA's default state. |
| 5469 | */ |
| 5470 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5471 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5472 | |
| 5473 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5474 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5475 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5476 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5477 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5478 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5479 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5480 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5481 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5482 | |
| 5483 | { } |
| 5484 | }; |
| 5485 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5486 | static struct hda_verb alc260_will_verbs[] = { |
| 5487 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5488 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5489 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5490 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5491 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5492 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5493 | {} |
| 5494 | }; |
| 5495 | |
| 5496 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5497 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5498 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5499 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5500 | |
| 5501 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5502 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5503 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5504 | |
| 5505 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5506 | {} |
| 5507 | }; |
| 5508 | |
| 5509 | /* toggle speaker-output according to the hp-jack state */ |
| 5510 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5511 | { |
| 5512 | unsigned int present; |
| 5513 | |
| 5514 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5515 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5516 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5517 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5518 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5519 | AC_VERB_SET_GPIO_DATA, 1); |
| 5520 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5521 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5522 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5523 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5524 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5525 | AC_VERB_SET_GPIO_DATA, 0); |
| 5526 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5527 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5528 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5529 | } |
| 5530 | } |
| 5531 | |
| 5532 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5533 | unsigned int res) |
| 5534 | { |
| 5535 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5536 | alc260_replacer_672v_automute(codec); |
| 5537 | } |
| 5538 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5539 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5540 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5541 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5542 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5543 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5544 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5545 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5546 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5547 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5548 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5549 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5550 | {} |
| 5551 | }; |
| 5552 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5553 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5554 | * configuration. |
| 5555 | */ |
| 5556 | #ifdef CONFIG_SND_DEBUG |
| 5557 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5558 | 0x02, |
| 5559 | }; |
| 5560 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5561 | 0x04, 0x05, |
| 5562 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5563 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5564 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5565 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5566 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5567 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5568 | { |
| 5569 | .num_items = 7, |
| 5570 | .items = { |
| 5571 | { "MIC1 pin", 0x0 }, |
| 5572 | { "MIC2 pin", 0x1 }, |
| 5573 | { "LINE1 pin", 0x2 }, |
| 5574 | { "LINE2 pin", 0x3 }, |
| 5575 | { "CD pin", 0x4 }, |
| 5576 | { "LINE-OUT pin", 0x5 }, |
| 5577 | { "HP-OUT pin", 0x6 }, |
| 5578 | }, |
| 5579 | }, |
| 5580 | { |
| 5581 | .num_items = 8, |
| 5582 | .items = { |
| 5583 | { "MIC1 pin", 0x0 }, |
| 5584 | { "MIC2 pin", 0x1 }, |
| 5585 | { "LINE1 pin", 0x2 }, |
| 5586 | { "LINE2 pin", 0x3 }, |
| 5587 | { "CD pin", 0x4 }, |
| 5588 | { "Mixer", 0x5 }, |
| 5589 | { "LINE-OUT pin", 0x6 }, |
| 5590 | { "HP-OUT pin", 0x7 }, |
| 5591 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5592 | }, |
| 5593 | }; |
| 5594 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5595 | /* Output driver widgets */ |
| 5596 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5597 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5598 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5599 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5600 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5601 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5602 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5603 | /* Modes for retasking pin widgets |
| 5604 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5605 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5606 | * mention this restriction. At this stage it's not clear whether |
| 5607 | * this behaviour is intentional or is a hardware bug in chip |
| 5608 | * revisions available at least up until early 2006. Therefore for |
| 5609 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5610 | * choices, but if it turns out that the lack of mic bias for these |
| 5611 | * NIDs is intentional we could change their modes from |
| 5612 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5613 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5614 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5615 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5616 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5617 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5618 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5619 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5620 | |
| 5621 | /* Loopback mixer controls */ |
| 5622 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5623 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5624 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5625 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5626 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5627 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5628 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5629 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5630 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5631 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5632 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5633 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5634 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5635 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5636 | |
| 5637 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5638 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5639 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5640 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5641 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5642 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5643 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5644 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5645 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5646 | */ |
| 5647 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5648 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5649 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5650 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5651 | * this output to turn on an external amplifier. |
| 5652 | */ |
| 5653 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5654 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5655 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5656 | { } /* end */ |
| 5657 | }; |
| 5658 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5659 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5660 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5661 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5662 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5663 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5664 | /* Enable retasking pins as output, initially without power amp */ |
| 5665 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5666 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5667 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5668 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5669 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5670 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5671 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5672 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5673 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5674 | * payload also sets the generation to 0, output to be in "consumer" |
| 5675 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5676 | * control. |
| 5677 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5678 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5679 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5680 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5681 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5682 | * OUT1 sum bus when acting as an output. |
| 5683 | */ |
| 5684 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5685 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5686 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5687 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5688 | |
| 5689 | /* Start with output sum widgets muted and their output gains at min */ |
| 5690 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5691 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5692 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5693 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5694 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5695 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5696 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5697 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5698 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5699 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5700 | /* Unmute retasking pin widget output buffers since the default |
| 5701 | * state appears to be output. As the pin mode is changed by the |
| 5702 | * user the pin mode control will take care of enabling the pin's |
| 5703 | * input/output buffers as needed. |
| 5704 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5705 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5706 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5707 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5708 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5709 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5710 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5711 | /* Also unmute the mono-out pin widget */ |
| 5712 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5713 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5714 | /* Mute capture amp left and right */ |
| 5715 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5716 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5717 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5718 | */ |
| 5719 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5720 | |
| 5721 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5722 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5723 | */ |
| 5724 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5725 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5726 | |
| 5727 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5728 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5729 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5730 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5731 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5732 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5733 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5734 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5735 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5736 | |
| 5737 | { } |
| 5738 | }; |
| 5739 | #endif |
| 5740 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5741 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5742 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5743 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5744 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5745 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5746 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5747 | /* |
| 5748 | * for BIOS auto-configuration |
| 5749 | */ |
| 5750 | |
| 5751 | 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] | 5752 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5753 | { |
| 5754 | hda_nid_t nid_vol; |
| 5755 | unsigned long vol_val, sw_val; |
| 5756 | char name[32]; |
| 5757 | int err; |
| 5758 | |
| 5759 | if (nid >= 0x0f && nid < 0x11) { |
| 5760 | nid_vol = nid - 0x7; |
| 5761 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5762 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5763 | } else if (nid == 0x11) { |
| 5764 | nid_vol = nid - 0x7; |
| 5765 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5766 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5767 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5768 | nid_vol = 0x08; |
| 5769 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5770 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5771 | } else |
| 5772 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5773 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5774 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5775 | /* first control for the volume widget */ |
| 5776 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5777 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5778 | if (err < 0) |
| 5779 | return err; |
| 5780 | *vol_bits |= (1 << nid_vol); |
| 5781 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5782 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5783 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5784 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5785 | return err; |
| 5786 | return 1; |
| 5787 | } |
| 5788 | |
| 5789 | /* add playback controls from the parsed DAC table */ |
| 5790 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5791 | const struct auto_pin_cfg *cfg) |
| 5792 | { |
| 5793 | hda_nid_t nid; |
| 5794 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5795 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5796 | |
| 5797 | spec->multiout.num_dacs = 1; |
| 5798 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5799 | spec->multiout.dac_nids[0] = 0x02; |
| 5800 | |
| 5801 | nid = cfg->line_out_pins[0]; |
| 5802 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5803 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5804 | if (err < 0) |
| 5805 | return err; |
| 5806 | } |
| 5807 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5808 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5809 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5810 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5811 | if (err < 0) |
| 5812 | return err; |
| 5813 | } |
| 5814 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5815 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5816 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5817 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5818 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5819 | if (err < 0) |
| 5820 | return err; |
| 5821 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5822 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5823 | } |
| 5824 | |
| 5825 | /* create playback/capture controls for input pins */ |
| 5826 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5827 | const struct auto_pin_cfg *cfg) |
| 5828 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5829 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5830 | int i, err, idx; |
| 5831 | |
| 5832 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5833 | if (cfg->input_pins[i] >= 0x12) { |
| 5834 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5835 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5836 | auto_pin_cfg_labels[i], idx, |
| 5837 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5838 | if (err < 0) |
| 5839 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5840 | imux->items[imux->num_items].label = |
| 5841 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5842 | imux->items[imux->num_items].index = idx; |
| 5843 | imux->num_items++; |
| 5844 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5845 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5846 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5847 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5848 | auto_pin_cfg_labels[i], idx, |
| 5849 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5850 | if (err < 0) |
| 5851 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5852 | imux->items[imux->num_items].label = |
| 5853 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5854 | imux->items[imux->num_items].index = idx; |
| 5855 | imux->num_items++; |
| 5856 | } |
| 5857 | } |
| 5858 | return 0; |
| 5859 | } |
| 5860 | |
| 5861 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5862 | hda_nid_t nid, int pin_type, |
| 5863 | int sel_idx) |
| 5864 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5865 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5866 | /* need the manual connection? */ |
| 5867 | if (nid >= 0x12) { |
| 5868 | int idx = nid - 0x12; |
| 5869 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5870 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5871 | } |
| 5872 | } |
| 5873 | |
| 5874 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5875 | { |
| 5876 | struct alc_spec *spec = codec->spec; |
| 5877 | hda_nid_t nid; |
| 5878 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5879 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5880 | if (nid) { |
| 5881 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5882 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5883 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5884 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5885 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5886 | if (nid) |
| 5887 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5888 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5889 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5890 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5891 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5892 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5893 | |
| 5894 | #define ALC260_PIN_CD_NID 0x16 |
| 5895 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5896 | { |
| 5897 | struct alc_spec *spec = codec->spec; |
| 5898 | int i; |
| 5899 | |
| 5900 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5901 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5902 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5903 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5904 | if (nid != ALC260_PIN_CD_NID && |
| 5905 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5906 | snd_hda_codec_write(codec, nid, 0, |
| 5907 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5908 | AMP_OUT_MUTE); |
| 5909 | } |
| 5910 | } |
| 5911 | } |
| 5912 | |
| 5913 | /* |
| 5914 | * generic initialization of ADC, input mixers and output mixers |
| 5915 | */ |
| 5916 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5917 | /* |
| 5918 | * Unmute ADC0-1 and set the default input to mic-in |
| 5919 | */ |
| 5920 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5921 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5922 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5923 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5924 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5925 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5926 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5927 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5928 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5929 | */ |
| 5930 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5931 | /* mute analog inputs */ |
| 5932 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5933 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5934 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5935 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5936 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5937 | |
| 5938 | /* |
| 5939 | * Set up output mixers (0x08 - 0x0a) |
| 5940 | */ |
| 5941 | /* set vol=0 to output mixers */ |
| 5942 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5943 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5944 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5945 | /* set up input amps for analog loopback */ |
| 5946 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5947 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5948 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5949 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5950 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5951 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5952 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5953 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5954 | { } |
| 5955 | }; |
| 5956 | |
| 5957 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5958 | { |
| 5959 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5960 | int err; |
| 5961 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5962 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5963 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5964 | alc260_ignore); |
| 5965 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5966 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5967 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5968 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5969 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5970 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5971 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5972 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5973 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5974 | return err; |
| 5975 | |
| 5976 | spec->multiout.max_channels = 2; |
| 5977 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 5978 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5979 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5980 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5981 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5982 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5983 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5984 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5985 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5986 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5987 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5988 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 5989 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5990 | return 1; |
| 5991 | } |
| 5992 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5993 | /* additional initialization for auto-configuration model */ |
| 5994 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5995 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5996 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5997 | alc260_auto_init_multi_out(codec); |
| 5998 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5999 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6000 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6001 | } |
| 6002 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6003 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6004 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6005 | { 0x07, HDA_INPUT, 0 }, |
| 6006 | { 0x07, HDA_INPUT, 1 }, |
| 6007 | { 0x07, HDA_INPUT, 2 }, |
| 6008 | { 0x07, HDA_INPUT, 3 }, |
| 6009 | { 0x07, HDA_INPUT, 4 }, |
| 6010 | { } /* end */ |
| 6011 | }; |
| 6012 | #endif |
| 6013 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6014 | /* |
| 6015 | * ALC260 configurations |
| 6016 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6017 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6018 | [ALC260_BASIC] = "basic", |
| 6019 | [ALC260_HP] = "hp", |
| 6020 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6021 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6022 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6023 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6024 | [ALC260_WILL] = "will", |
| 6025 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6026 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6027 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6028 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6029 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6030 | [ALC260_AUTO] = "auto", |
| 6031 | }; |
| 6032 | |
| 6033 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6034 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6035 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6036 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6037 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 6038 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6039 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6040 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6041 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6042 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6043 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6044 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6045 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6046 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6047 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6048 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6049 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6050 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6051 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6052 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6053 | {} |
| 6054 | }; |
| 6055 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6056 | static struct alc_config_preset alc260_presets[] = { |
| 6057 | [ALC260_BASIC] = { |
| 6058 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6059 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6060 | .init_verbs = { alc260_init_verbs }, |
| 6061 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6062 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6063 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6064 | .adc_nids = alc260_adc_nids, |
| 6065 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6066 | .channel_mode = alc260_modes, |
| 6067 | .input_mux = &alc260_capture_source, |
| 6068 | }, |
| 6069 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6070 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6071 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6072 | .init_verbs = { alc260_init_verbs, |
| 6073 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6074 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6075 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6076 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6077 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6078 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6079 | .channel_mode = alc260_modes, |
| 6080 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6081 | .unsol_event = alc260_hp_unsol_event, |
| 6082 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6083 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6084 | [ALC260_HP_DC7600] = { |
| 6085 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6086 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6087 | .init_verbs = { alc260_init_verbs, |
| 6088 | alc260_hp_dc7600_verbs }, |
| 6089 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6090 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6091 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6092 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6093 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6094 | .channel_mode = alc260_modes, |
| 6095 | .input_mux = &alc260_capture_source, |
| 6096 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6097 | .init_hook = alc260_hp_3012_automute, |
| 6098 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6099 | [ALC260_HP_3013] = { |
| 6100 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6101 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6102 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6103 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6104 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6105 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6106 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6107 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6108 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6109 | .channel_mode = alc260_modes, |
| 6110 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6111 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6112 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6113 | }, |
| 6114 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6115 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6116 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6117 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6118 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6119 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6120 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6121 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6122 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6123 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6124 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6125 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6126 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6127 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6128 | .init_verbs = { alc260_acer_init_verbs }, |
| 6129 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6130 | .dac_nids = alc260_dac_nids, |
| 6131 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6132 | .adc_nids = alc260_dual_adc_nids, |
| 6133 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6134 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6135 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6136 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6137 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6138 | [ALC260_FAVORIT100] = { |
| 6139 | .mixers = { alc260_favorit100_mixer }, |
| 6140 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6141 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6142 | .dac_nids = alc260_dac_nids, |
| 6143 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6144 | .adc_nids = alc260_dual_adc_nids, |
| 6145 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6146 | .channel_mode = alc260_modes, |
| 6147 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6148 | .input_mux = alc260_favorit100_capture_sources, |
| 6149 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6150 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6151 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6152 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6153 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6154 | .dac_nids = alc260_dac_nids, |
| 6155 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6156 | .adc_nids = alc260_adc_nids, |
| 6157 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6158 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6159 | .channel_mode = alc260_modes, |
| 6160 | .input_mux = &alc260_capture_source, |
| 6161 | }, |
| 6162 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6163 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6164 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6165 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6166 | .dac_nids = alc260_dac_nids, |
| 6167 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6168 | .adc_nids = alc260_adc_nids, |
| 6169 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6170 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6171 | .channel_mode = alc260_modes, |
| 6172 | .input_mux = &alc260_capture_source, |
| 6173 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6174 | .init_hook = alc260_replacer_672v_automute, |
| 6175 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6176 | #ifdef CONFIG_SND_DEBUG |
| 6177 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6178 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6179 | .init_verbs = { alc260_test_init_verbs }, |
| 6180 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6181 | .dac_nids = alc260_test_dac_nids, |
| 6182 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6183 | .adc_nids = alc260_test_adc_nids, |
| 6184 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6185 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6186 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6187 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6188 | }, |
| 6189 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6190 | }; |
| 6191 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6192 | static int patch_alc260(struct hda_codec *codec) |
| 6193 | { |
| 6194 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6195 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6196 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6197 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6198 | if (spec == NULL) |
| 6199 | return -ENOMEM; |
| 6200 | |
| 6201 | codec->spec = spec; |
| 6202 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6203 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6204 | alc260_models, |
| 6205 | alc260_cfg_tbl); |
| 6206 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6207 | snd_printd(KERN_INFO "hda_codec: Unknown model for %s, " |
| 6208 | "trying auto-probe from BIOS...\n", |
| 6209 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6210 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6211 | } |
| 6212 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6213 | if (board_config == ALC260_AUTO) { |
| 6214 | /* automatic parse from the BIOS config */ |
| 6215 | err = alc260_parse_auto_config(codec); |
| 6216 | if (err < 0) { |
| 6217 | alc_free(codec); |
| 6218 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6219 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6220 | printk(KERN_INFO |
| 6221 | "hda_codec: Cannot set up configuration " |
| 6222 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6223 | board_config = ALC260_BASIC; |
| 6224 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6225 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6226 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6227 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6228 | if (err < 0) { |
| 6229 | alc_free(codec); |
| 6230 | return err; |
| 6231 | } |
| 6232 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6233 | if (board_config != ALC260_AUTO) |
| 6234 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6235 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6236 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6237 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6238 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6239 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6240 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6241 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6242 | if (!spec->adc_nids && spec->input_mux) { |
| 6243 | /* check whether NID 0x04 is valid */ |
| 6244 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 6245 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 6246 | /* get type */ |
| 6247 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6248 | spec->adc_nids = alc260_adc_nids_alt; |
| 6249 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6250 | } else { |
| 6251 | spec->adc_nids = alc260_adc_nids; |
| 6252 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6253 | } |
| 6254 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6255 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6256 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6257 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6258 | spec->vmaster_nid = 0x08; |
| 6259 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6260 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6261 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6262 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6263 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6264 | if (!spec->loopback.amplist) |
| 6265 | spec->loopback.amplist = alc260_loopbacks; |
| 6266 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6267 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6268 | |
| 6269 | return 0; |
| 6270 | } |
| 6271 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6272 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6273 | /* |
| 6274 | * ALC882 support |
| 6275 | * |
| 6276 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6277 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6278 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6279 | * 6-channel independent captures. |
| 6280 | * |
| 6281 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6282 | * driver yet). |
| 6283 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6284 | #define ALC882_DIGOUT_NID 0x06 |
| 6285 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6286 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6287 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6288 | { 8, NULL } |
| 6289 | }; |
| 6290 | |
| 6291 | static hda_nid_t alc882_dac_nids[4] = { |
| 6292 | /* front, rear, clfe, rear_surr */ |
| 6293 | 0x02, 0x03, 0x04, 0x05 |
| 6294 | }; |
| 6295 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6296 | /* identical with ALC880 */ |
| 6297 | #define alc882_adc_nids alc880_adc_nids |
| 6298 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6299 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6300 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6301 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 6302 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6303 | /* input MUX */ |
| 6304 | /* FIXME: should be a matrix-type input source selection */ |
| 6305 | |
| 6306 | static struct hda_input_mux alc882_capture_source = { |
| 6307 | .num_items = 4, |
| 6308 | .items = { |
| 6309 | { "Mic", 0x0 }, |
| 6310 | { "Front Mic", 0x1 }, |
| 6311 | { "Line", 0x2 }, |
| 6312 | { "CD", 0x4 }, |
| 6313 | }, |
| 6314 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6315 | |
| 6316 | static struct hda_input_mux mb5_capture_source = { |
| 6317 | .num_items = 3, |
| 6318 | .items = { |
| 6319 | { "Mic", 0x1 }, |
| 6320 | { "Line", 0x2 }, |
| 6321 | { "CD", 0x4 }, |
| 6322 | }, |
| 6323 | }; |
| 6324 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6325 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6326 | * 2ch mode |
| 6327 | */ |
| 6328 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6329 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6330 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6331 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6332 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6333 | { } /* end */ |
| 6334 | }; |
| 6335 | |
| 6336 | /* |
| 6337 | * 6ch mode |
| 6338 | */ |
| 6339 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6340 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6341 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6342 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6343 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6344 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6345 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6346 | { } /* end */ |
| 6347 | }; |
| 6348 | |
| 6349 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 6350 | { 2, alc882_3ST_ch2_init }, |
| 6351 | { 6, alc882_3ST_ch6_init }, |
| 6352 | }; |
| 6353 | |
| 6354 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6355 | * 6ch mode |
| 6356 | */ |
| 6357 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6358 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6359 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6360 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6361 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6362 | { } /* end */ |
| 6363 | }; |
| 6364 | |
| 6365 | /* |
| 6366 | * 8ch mode |
| 6367 | */ |
| 6368 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6369 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6370 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6371 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6372 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6373 | { } /* end */ |
| 6374 | }; |
| 6375 | |
| 6376 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6377 | { 6, alc882_sixstack_ch6_init }, |
| 6378 | { 8, alc882_sixstack_ch8_init }, |
| 6379 | }; |
| 6380 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6381 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6382 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6383 | */ |
| 6384 | |
| 6385 | /* |
| 6386 | * 2ch mode |
| 6387 | */ |
| 6388 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6389 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6390 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6391 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6392 | { } /* end */ |
| 6393 | }; |
| 6394 | |
| 6395 | /* |
| 6396 | * 6ch mode |
| 6397 | */ |
| 6398 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6399 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6400 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6401 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6402 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6403 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6404 | { } /* end */ |
| 6405 | }; |
| 6406 | |
| 6407 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6408 | { 2, alc885_mbp_ch2_init }, |
| 6409 | { 6, alc885_mbp_ch6_init }, |
| 6410 | }; |
| 6411 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6412 | /* |
| 6413 | * 2ch |
| 6414 | * Speakers/Woofer/HP = Front |
| 6415 | * LineIn = Input |
| 6416 | */ |
| 6417 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6418 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6419 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6420 | { } /* end */ |
| 6421 | }; |
| 6422 | |
| 6423 | /* |
| 6424 | * 6ch mode |
| 6425 | * Speakers/HP = Front |
| 6426 | * Woofer = LFE |
| 6427 | * LineIn = Surround |
| 6428 | */ |
| 6429 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6430 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6431 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6432 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6433 | { } /* end */ |
| 6434 | }; |
| 6435 | |
| 6436 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6437 | { 2, alc885_mb5_ch2_init }, |
| 6438 | { 6, alc885_mb5_ch6_init }, |
| 6439 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6440 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6441 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6442 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6443 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6444 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6445 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6446 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6447 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6448 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6449 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6450 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6451 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6452 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6453 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6454 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6455 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6456 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6457 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6458 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6459 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6460 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6461 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6462 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6463 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6464 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6465 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6466 | { } /* end */ |
| 6467 | }; |
| 6468 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6469 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6470 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6471 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6472 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6473 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6474 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6475 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6476 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6477 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6478 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6479 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6480 | { } /* end */ |
| 6481 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6482 | |
| 6483 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6484 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6485 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6486 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6487 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 6488 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 6489 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 6490 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 6491 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6492 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6493 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6494 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6495 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6496 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 6497 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 6498 | { } /* end */ |
| 6499 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6500 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6501 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6502 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6503 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6504 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6505 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6506 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6507 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6508 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6509 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6510 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6511 | { } /* end */ |
| 6512 | }; |
| 6513 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6514 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6515 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6516 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6517 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6518 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6519 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6520 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6521 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6522 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6523 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6524 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6525 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6526 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6527 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6528 | { } /* end */ |
| 6529 | }; |
| 6530 | |
| 6531 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6532 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6533 | */ |
| 6534 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6535 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6536 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6537 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6538 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6539 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6540 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6541 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6542 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6543 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6544 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6545 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6546 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6547 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6548 | { } /* end */ |
| 6549 | }; |
| 6550 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6551 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6552 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6553 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6554 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6555 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6556 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6557 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6558 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6559 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6560 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6561 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6562 | { } /* end */ |
| 6563 | }; |
| 6564 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6565 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6566 | { |
| 6567 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6568 | .name = "Channel Mode", |
| 6569 | .info = alc_ch_mode_info, |
| 6570 | .get = alc_ch_mode_get, |
| 6571 | .put = alc_ch_mode_put, |
| 6572 | }, |
| 6573 | { } /* end */ |
| 6574 | }; |
| 6575 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6576 | static struct hda_verb alc882_init_verbs[] = { |
| 6577 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6578 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6579 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6580 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6581 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6582 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6583 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6584 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6585 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6586 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6587 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6588 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6589 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6590 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6591 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6592 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6593 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6594 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6595 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6596 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6597 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6598 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6599 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6600 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6601 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6602 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6603 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6604 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6605 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6606 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6607 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6608 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6609 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6610 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6611 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6612 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6613 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6614 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6615 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6616 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6617 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6618 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6619 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6620 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6621 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6622 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6623 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6624 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6625 | |
| 6626 | /* FIXME: use matrix-type input source selection */ |
| 6627 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6628 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6629 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6630 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6631 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6632 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6633 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6634 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6635 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6636 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6637 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6638 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6639 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6640 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6641 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6642 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6643 | /* ADC1: mute amp left and right */ |
| 6644 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6645 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6646 | /* ADC2: mute amp left and right */ |
| 6647 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6648 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6649 | /* ADC3: mute amp left and right */ |
| 6650 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6651 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6652 | |
| 6653 | { } |
| 6654 | }; |
| 6655 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6656 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6657 | /* change to EAPD mode */ |
| 6658 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6659 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6660 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6661 | }; |
| 6662 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6663 | /* Mac Pro test */ |
| 6664 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6665 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6666 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6667 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6668 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6669 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6670 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6671 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6672 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6673 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6674 | { } /* end */ |
| 6675 | }; |
| 6676 | |
| 6677 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6678 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6679 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6680 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6681 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6682 | /* Front Pin: output 0 (0x0c) */ |
| 6683 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6684 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6685 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6686 | /* Front Mic pin: input vref at 80% */ |
| 6687 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6688 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6689 | /* Speaker: output */ |
| 6690 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6691 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6692 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6693 | /* Headphone output (output 0 - 0x0c) */ |
| 6694 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6695 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6696 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6697 | |
| 6698 | /* FIXME: use matrix-type input source selection */ |
| 6699 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6700 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6701 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6702 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6703 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6704 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6705 | /* Input mixer2 */ |
| 6706 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6707 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6708 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6709 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6710 | /* Input mixer3 */ |
| 6711 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6712 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6713 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6714 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6715 | /* ADC1: mute amp left and right */ |
| 6716 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6717 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6718 | /* ADC2: mute amp left and right */ |
| 6719 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6720 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6721 | /* ADC3: mute amp left and right */ |
| 6722 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6723 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6724 | |
| 6725 | { } |
| 6726 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6727 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6728 | /* Macbook 5,1 */ |
| 6729 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6730 | /* DACs */ |
| 6731 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6732 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6733 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6734 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6735 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6736 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6737 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6738 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6739 | /* Surround mixer */ |
| 6740 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6741 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6742 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6743 | /* LFE mixer */ |
| 6744 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6745 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6746 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6747 | /* HP mixer */ |
| 6748 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6749 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6750 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6751 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6752 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 6753 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6754 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6755 | /* LFE Pin (0x0e) */ |
| 6756 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 6757 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6758 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6759 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6760 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6761 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6762 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6763 | /* Front Mic pin: input vref at 80% */ |
| 6764 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6765 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6766 | /* Line In pin */ |
| 6767 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6768 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6769 | |
| 6770 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6771 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6772 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6773 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6774 | { } |
| 6775 | }; |
| 6776 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6777 | /* Macbook Pro rev3 */ |
| 6778 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6779 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6780 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6781 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6782 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6783 | /* Rear mixer */ |
| 6784 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6785 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6786 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6787 | /* Front Pin: output 0 (0x0c) */ |
| 6788 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6789 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6790 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6791 | /* HP Pin: output 0 (0x0d) */ |
| 6792 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6793 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6794 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6795 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6796 | /* Mic (rear) pin: input vref at 80% */ |
| 6797 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6798 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6799 | /* Front Mic pin: input vref at 80% */ |
| 6800 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6801 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6802 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6803 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6804 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6805 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6806 | |
| 6807 | /* FIXME: use matrix-type input source selection */ |
| 6808 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6809 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6810 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6811 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6812 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6813 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6814 | /* Input mixer2 */ |
| 6815 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6816 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6817 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6818 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6819 | /* Input mixer3 */ |
| 6820 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6821 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6822 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6823 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6824 | /* ADC1: mute amp left and right */ |
| 6825 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6826 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6827 | /* ADC2: mute amp left and right */ |
| 6828 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6829 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6830 | /* ADC3: mute amp left and right */ |
| 6831 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6832 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6833 | |
| 6834 | { } |
| 6835 | }; |
| 6836 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6837 | /* iMac 24 mixer. */ |
| 6838 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6839 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6840 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6841 | { } /* end */ |
| 6842 | }; |
| 6843 | |
| 6844 | /* iMac 24 init verbs. */ |
| 6845 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6846 | /* Internal speakers: output 0 (0x0c) */ |
| 6847 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6848 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6849 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6850 | /* Internal speakers: output 0 (0x0c) */ |
| 6851 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6852 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6853 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6854 | /* Headphone: output 0 (0x0c) */ |
| 6855 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6856 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6857 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6858 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6859 | /* Front Mic: input vref at 80% */ |
| 6860 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6861 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6862 | { } |
| 6863 | }; |
| 6864 | |
| 6865 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6866 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6867 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6868 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6869 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6870 | spec->autocfg.hp_pins[0] = 0x14; |
| 6871 | spec->autocfg.speaker_pins[0] = 0x18; |
| 6872 | spec->autocfg.speaker_pins[1] = 0x1a; |
| 6873 | alc_automute_amp(codec); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6874 | } |
| 6875 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6876 | static void alc885_mbp3_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6877 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6878 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6879 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6880 | spec->autocfg.hp_pins[0] = 0x15; |
| 6881 | spec->autocfg.speaker_pins[0] = 0x14; |
| 6882 | alc_automute_amp(codec); |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6883 | } |
| 6884 | |
| 6885 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6886 | static struct hda_verb alc882_targa_verbs[] = { |
| 6887 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6888 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6889 | |
| 6890 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6891 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6892 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6893 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6894 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6895 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6896 | |
| 6897 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6898 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6899 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6900 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6901 | { } /* end */ |
| 6902 | }; |
| 6903 | |
| 6904 | /* toggle speaker-output according to the hp-jack state */ |
| 6905 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6906 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6907 | struct alc_spec *spec = codec->spec; |
| 6908 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6909 | 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] | 6910 | spec->jack_present ? 1 : 3); |
| 6911 | } |
| 6912 | |
| 6913 | static void alc882_targa_init_hook(struct hda_codec *codec) |
| 6914 | { |
| 6915 | struct alc_spec *spec = codec->spec; |
| 6916 | |
| 6917 | spec->autocfg.hp_pins[0] = 0x14; |
| 6918 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 6919 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6920 | } |
| 6921 | |
| 6922 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6923 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6924 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6925 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6926 | } |
| 6927 | |
| 6928 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6929 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6930 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6931 | |
| 6932 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6933 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6934 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6935 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6936 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6937 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6938 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6939 | |
| 6940 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6941 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6942 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6943 | { } /* end */ |
| 6944 | }; |
| 6945 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6946 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6947 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6948 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6949 | |
| 6950 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6951 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6952 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6953 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6954 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6955 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6956 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6957 | |
| 6958 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6959 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6960 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6961 | { } /* end */ |
| 6962 | }; |
| 6963 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6964 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6965 | { |
| 6966 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6967 | |
| 6968 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6969 | AC_VERB_GET_GPIO_DATA, 0); |
| 6970 | |
| 6971 | if (!muted) |
| 6972 | gpiostate |= (1 << pin); |
| 6973 | else |
| 6974 | gpiostate &= ~(1 << pin); |
| 6975 | |
| 6976 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6977 | AC_VERB_GET_GPIO_MASK, 0); |
| 6978 | gpiomask |= (1 << pin); |
| 6979 | |
| 6980 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6981 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6982 | gpiodir |= (1 << pin); |
| 6983 | |
| 6984 | |
| 6985 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6986 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6987 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6988 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6989 | |
| 6990 | msleep(1); |
| 6991 | |
| 6992 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6993 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6994 | } |
| 6995 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6996 | /* set up GPIO at initialization */ |
| 6997 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6998 | { |
| 6999 | alc882_gpio_mute(codec, 0, 0); |
| 7000 | alc882_gpio_mute(codec, 1, 0); |
| 7001 | } |
| 7002 | |
| 7003 | /* set up GPIO and update auto-muting at initialization */ |
| 7004 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7005 | { |
| 7006 | alc885_macpro_init_hook(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7007 | alc885_imac24_automute_init_hook(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7008 | } |
| 7009 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7010 | /* |
| 7011 | * generic initialization of ADC, input mixers and output mixers |
| 7012 | */ |
| 7013 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 7014 | /* |
| 7015 | * Unmute ADC0-2 and set the default input to mic-in |
| 7016 | */ |
| 7017 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7018 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7019 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7020 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7021 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7022 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7023 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7024 | /* 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] | 7025 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7026 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7027 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7028 | */ |
| 7029 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7030 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7031 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7032 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7033 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7034 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7035 | |
| 7036 | /* |
| 7037 | * Set up output mixers (0x0c - 0x0f) |
| 7038 | */ |
| 7039 | /* set vol=0 to output mixers */ |
| 7040 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7041 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7042 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7043 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7044 | /* set up input amps for analog loopback */ |
| 7045 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7047 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7048 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7049 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7050 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7051 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7052 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7053 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7054 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7055 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7056 | |
| 7057 | /* FIXME: use matrix-type input source selection */ |
| 7058 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7059 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7061 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7062 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7063 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7064 | /* Input mixer2 */ |
| 7065 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7066 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7067 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7068 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7069 | /* Input mixer3 */ |
| 7070 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7071 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7072 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7073 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7074 | |
| 7075 | { } |
| 7076 | }; |
| 7077 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7078 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7079 | #define alc882_loopbacks alc880_loopbacks |
| 7080 | #endif |
| 7081 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7082 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7083 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 7084 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 7085 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 7086 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 7087 | |
| 7088 | /* |
| 7089 | * configuration and preset |
| 7090 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7091 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 7092 | [ALC882_3ST_DIG] = "3stack-dig", |
| 7093 | [ALC882_6ST_DIG] = "6stack-dig", |
| 7094 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7095 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 7096 | [ALC882_TARGA] = "targa", |
| 7097 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 7098 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7099 | [ALC885_MACPRO] = "macpro", |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7100 | [ALC885_MB5] = "mb5", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7101 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7102 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7103 | [ALC882_AUTO] = "auto", |
| 7104 | }; |
| 7105 | |
| 7106 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 7107 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7108 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 7109 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7110 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7111 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 7112 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 7113 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7114 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 7115 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7116 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 7117 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 7118 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7119 | {} |
| 7120 | }; |
| 7121 | |
| 7122 | static struct alc_config_preset alc882_presets[] = { |
| 7123 | [ALC882_3ST_DIG] = { |
| 7124 | .mixers = { alc882_base_mixer }, |
| 7125 | .init_verbs = { alc882_init_verbs }, |
| 7126 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7127 | .dac_nids = alc882_dac_nids, |
| 7128 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7129 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7130 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 7131 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7132 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7133 | .input_mux = &alc882_capture_source, |
| 7134 | }, |
| 7135 | [ALC882_6ST_DIG] = { |
| 7136 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 7137 | .init_verbs = { alc882_init_verbs }, |
| 7138 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7139 | .dac_nids = alc882_dac_nids, |
| 7140 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7141 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7142 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 7143 | .channel_mode = alc882_sixstack_modes, |
| 7144 | .input_mux = &alc882_capture_source, |
| 7145 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7146 | [ALC882_ARIMA] = { |
| 7147 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 7148 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 7149 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7150 | .dac_nids = alc882_dac_nids, |
| 7151 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 7152 | .channel_mode = alc882_sixstack_modes, |
| 7153 | .input_mux = &alc882_capture_source, |
| 7154 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7155 | [ALC882_W2JC] = { |
| 7156 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 7157 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 7158 | alc880_gpio1_init_verbs }, |
| 7159 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7160 | .dac_nids = alc882_dac_nids, |
| 7161 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 7162 | .channel_mode = alc880_threestack_modes, |
| 7163 | .need_dac_fix = 1, |
| 7164 | .input_mux = &alc882_capture_source, |
| 7165 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7166 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7167 | [ALC885_MBP3] = { |
| 7168 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 7169 | .init_verbs = { alc885_mbp3_init_verbs, |
| 7170 | alc880_gpio1_init_verbs }, |
| 7171 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7172 | .dac_nids = alc882_dac_nids, |
| 7173 | .channel_mode = alc885_mbp_6ch_modes, |
| 7174 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 7175 | .input_mux = &alc882_capture_source, |
| 7176 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7177 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7178 | .unsol_event = alc_automute_amp_unsol_event, |
| 7179 | .init_hook = alc885_mbp3_init_hook, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7180 | }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7181 | [ALC885_MB5] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7182 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7183 | .init_verbs = { alc885_mb5_init_verbs, |
| 7184 | alc880_gpio1_init_verbs }, |
| 7185 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7186 | .dac_nids = alc882_dac_nids, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7187 | .channel_mode = alc885_mb5_6ch_modes, |
| 7188 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7189 | .input_mux = &mb5_capture_source, |
| 7190 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7191 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7192 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7193 | [ALC885_MACPRO] = { |
| 7194 | .mixers = { alc882_macpro_mixer }, |
| 7195 | .init_verbs = { alc882_macpro_init_verbs }, |
| 7196 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7197 | .dac_nids = alc882_dac_nids, |
| 7198 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7199 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7200 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 7201 | .channel_mode = alc882_ch_modes, |
| 7202 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7203 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7204 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7205 | [ALC885_IMAC24] = { |
| 7206 | .mixers = { alc885_imac24_mixer }, |
| 7207 | .init_verbs = { alc885_imac24_init_verbs }, |
| 7208 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7209 | .dac_nids = alc882_dac_nids, |
| 7210 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7211 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7212 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 7213 | .channel_mode = alc882_ch_modes, |
| 7214 | .input_mux = &alc882_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7215 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7216 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7217 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7218 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7219 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7220 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 7221 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7222 | .dac_nids = alc882_dac_nids, |
| 7223 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7224 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 7225 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7226 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7227 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 7228 | .channel_mode = alc882_3ST_6ch_modes, |
| 7229 | .need_dac_fix = 1, |
| 7230 | .input_mux = &alc882_capture_source, |
| 7231 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7232 | .init_hook = alc882_targa_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7233 | }, |
| 7234 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7235 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7236 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 7237 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7238 | .dac_nids = alc882_dac_nids, |
| 7239 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7240 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 7241 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7242 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7243 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 7244 | .channel_mode = alc882_3ST_6ch_modes, |
| 7245 | .need_dac_fix = 1, |
| 7246 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7247 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7248 | [ALC882_ASUS_A7M] = { |
| 7249 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 7250 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 7251 | alc880_gpio1_init_verbs, |
| 7252 | alc882_asus_a7m_verbs }, |
| 7253 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7254 | .dac_nids = alc882_dac_nids, |
| 7255 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7256 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 7257 | .channel_mode = alc880_threestack_modes, |
| 7258 | .need_dac_fix = 1, |
| 7259 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7260 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7261 | }; |
| 7262 | |
| 7263 | |
| 7264 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7265 | * Pin config fixes |
| 7266 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7267 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7268 | PINFIX_ABIT_AW9D_MAX |
| 7269 | }; |
| 7270 | |
| 7271 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 7272 | { 0x15, 0x01080104 }, /* side */ |
| 7273 | { 0x16, 0x01011012 }, /* rear */ |
| 7274 | { 0x17, 0x01016011 }, /* clfe */ |
| 7275 | { } |
| 7276 | }; |
| 7277 | |
| 7278 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 7279 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 7280 | }; |
| 7281 | |
| 7282 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 7283 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 7284 | {} |
| 7285 | }; |
| 7286 | |
| 7287 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7288 | * BIOS auto configuration |
| 7289 | */ |
| 7290 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7291 | hda_nid_t nid, int pin_type, |
| 7292 | int dac_idx) |
| 7293 | { |
| 7294 | /* set as output */ |
| 7295 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7296 | int idx; |
| 7297 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7298 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7299 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7300 | idx = 4; |
| 7301 | else |
| 7302 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7303 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7304 | |
| 7305 | } |
| 7306 | |
| 7307 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 7308 | { |
| 7309 | struct alc_spec *spec = codec->spec; |
| 7310 | int i; |
| 7311 | |
| 7312 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7313 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7314 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7315 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7316 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7317 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7318 | } |
| 7319 | } |
| 7320 | |
| 7321 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 7322 | { |
| 7323 | struct alc_spec *spec = codec->spec; |
| 7324 | hda_nid_t pin; |
| 7325 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7326 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7327 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7328 | /* use dac 0 */ |
| 7329 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7330 | pin = spec->autocfg.speaker_pins[0]; |
| 7331 | if (pin) |
| 7332 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7333 | } |
| 7334 | |
| 7335 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7336 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 7337 | |
| 7338 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 7339 | { |
| 7340 | struct alc_spec *spec = codec->spec; |
| 7341 | int i; |
| 7342 | |
| 7343 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7344 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7345 | if (!nid) |
| 7346 | continue; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 7347 | alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7348 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 7349 | snd_hda_codec_write(codec, nid, 0, |
| 7350 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7351 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7352 | } |
| 7353 | } |
| 7354 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7355 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 7356 | { |
| 7357 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7358 | int c; |
| 7359 | |
| 7360 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 7361 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 7362 | hda_nid_t nid = spec->capsrc_nids[c]; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7363 | unsigned int mux_idx; |
| 7364 | const struct hda_input_mux *imux; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7365 | int conns, mute, idx, item; |
| 7366 | |
| 7367 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 7368 | ARRAY_SIZE(conn_list)); |
| 7369 | if (conns < 0) |
| 7370 | continue; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7371 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 7372 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7373 | for (idx = 0; idx < conns; idx++) { |
| 7374 | /* if the current connection is the selected one, |
| 7375 | * unmute it as default - otherwise mute it |
| 7376 | */ |
| 7377 | mute = AMP_IN_MUTE(idx); |
| 7378 | for (item = 0; item < imux->num_items; item++) { |
| 7379 | if (imux->items[item].index == idx) { |
| 7380 | if (spec->cur_mux[c] == item) |
| 7381 | mute = AMP_IN_UNMUTE(idx); |
| 7382 | break; |
| 7383 | } |
| 7384 | } |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7385 | /* check if we have a selector or mixer |
| 7386 | * we could check for the widget type instead, but |
| 7387 | * just check for Amp-In presence (in case of mixer |
| 7388 | * without amp-in there is something wrong, this |
| 7389 | * function shouldn't be used or capsrc nid is wrong) |
| 7390 | */ |
| 7391 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
| 7392 | snd_hda_codec_write(codec, nid, 0, |
| 7393 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7394 | mute); |
| 7395 | else if (mute != AMP_IN_MUTE(idx)) |
| 7396 | snd_hda_codec_write(codec, nid, 0, |
| 7397 | AC_VERB_SET_CONNECT_SEL, |
| 7398 | idx); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7399 | } |
| 7400 | } |
| 7401 | } |
| 7402 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7403 | /* add mic boosts if needed */ |
| 7404 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 7405 | { |
| 7406 | struct alc_spec *spec = codec->spec; |
| 7407 | int err; |
| 7408 | hda_nid_t nid; |
| 7409 | |
| 7410 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7411 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7412 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7413 | "Mic Boost", |
| 7414 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7415 | if (err < 0) |
| 7416 | return err; |
| 7417 | } |
| 7418 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7419 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7420 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7421 | "Front Mic Boost", |
| 7422 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7423 | if (err < 0) |
| 7424 | return err; |
| 7425 | } |
| 7426 | return 0; |
| 7427 | } |
| 7428 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7429 | /* almost identical with ALC880 parser... */ |
| 7430 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 7431 | { |
| 7432 | struct alc_spec *spec = codec->spec; |
| 7433 | int err = alc880_parse_auto_config(codec); |
| 7434 | |
| 7435 | if (err < 0) |
| 7436 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7437 | else if (!err) |
| 7438 | return 0; /* no config found */ |
| 7439 | |
| 7440 | err = alc_auto_add_mic_boost(codec); |
| 7441 | if (err < 0) |
| 7442 | return err; |
| 7443 | |
| 7444 | /* hack - override the init verbs */ |
| 7445 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7446 | |
| 7447 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7448 | } |
| 7449 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7450 | /* additional initialization for auto-configuration model */ |
| 7451 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7452 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7453 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7454 | alc882_auto_init_multi_out(codec); |
| 7455 | alc882_auto_init_hp_out(codec); |
| 7456 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7457 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7458 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7459 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7460 | } |
| 7461 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7462 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7463 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7464 | static int patch_alc882(struct hda_codec *codec) |
| 7465 | { |
| 7466 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7467 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7468 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7469 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7470 | if (spec == NULL) |
| 7471 | return -ENOMEM; |
| 7472 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7473 | codec->spec = spec; |
| 7474 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7475 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7476 | alc882_models, |
| 7477 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7478 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7479 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7480 | /* Pick up systems that don't supply PCI SSID */ |
| 7481 | switch (codec->subsystem_id) { |
| 7482 | case 0x106b0c00: /* Mac Pro */ |
| 7483 | board_config = ALC885_MACPRO; |
| 7484 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7485 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7486 | case 0x106b2800: /* AppleTV */ |
Mark Eggleston | 3077e44 | 2009-01-31 17:57:54 +0100 | [diff] [blame] | 7487 | case 0x106b3e00: /* iMac 24 Aluminium */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7488 | board_config = ALC885_IMAC24; |
| 7489 | break; |
Luke Yelavich | 2d46638 | 2009-02-23 13:00:33 +1100 | [diff] [blame] | 7490 | case 0x106b00a0: /* MacBookPro3,1 - Another revision */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7491 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7492 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7493 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7494 | /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */ |
Luke Yelavich | 2a88464 | 2009-01-28 15:58:38 +1100 | [diff] [blame] | 7495 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7496 | board_config = ALC885_MBP3; |
| 7497 | break; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7498 | case 0x106b3f00: /* Macbook 5,1 */ |
Takashi Iwai | 7442f9d | 2009-05-14 18:20:33 +0200 | [diff] [blame] | 7499 | case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense |
| 7500 | * seems not working, so apparently |
| 7501 | * no perfect solution yet |
| 7502 | */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7503 | board_config = ALC885_MB5; |
| 7504 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7505 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7506 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7507 | if (codec->revision_id == 0x100101 || |
| 7508 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7509 | alc_free(codec); |
| 7510 | return patch_alc883(codec); |
| 7511 | } |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7512 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 7513 | "trying auto-probe from BIOS...\n", |
| 7514 | codec->chip_name); |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7515 | board_config = ALC882_AUTO; |
| 7516 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7517 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7518 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7519 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7520 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7521 | if (board_config == ALC882_AUTO) { |
| 7522 | /* automatic parse from the BIOS config */ |
| 7523 | err = alc882_parse_auto_config(codec); |
| 7524 | if (err < 0) { |
| 7525 | alc_free(codec); |
| 7526 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7527 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7528 | printk(KERN_INFO |
| 7529 | "hda_codec: Cannot set up configuration " |
| 7530 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7531 | board_config = ALC882_3ST_DIG; |
| 7532 | } |
| 7533 | } |
| 7534 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7535 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7536 | if (err < 0) { |
| 7537 | alc_free(codec); |
| 7538 | return err; |
| 7539 | } |
| 7540 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7541 | if (board_config != ALC882_AUTO) |
| 7542 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7543 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7544 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7545 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7546 | /* FIXME: setup DAC5 */ |
| 7547 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7548 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7549 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7550 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7551 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7552 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7553 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7554 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7555 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7556 | /* get type */ |
| 7557 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7558 | if (wcap != AC_WID_AUD_IN) { |
| 7559 | spec->adc_nids = alc882_adc_nids_alt; |
| 7560 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7561 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7562 | } else { |
| 7563 | spec->adc_nids = alc882_adc_nids; |
| 7564 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7565 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7566 | } |
| 7567 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7568 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7569 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7570 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7571 | spec->vmaster_nid = 0x0c; |
| 7572 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7573 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7574 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7575 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7576 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7577 | if (!spec->loopback.amplist) |
| 7578 | spec->loopback.amplist = alc882_loopbacks; |
| 7579 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7580 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7581 | |
| 7582 | return 0; |
| 7583 | } |
| 7584 | |
| 7585 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7586 | * ALC883 support |
| 7587 | * |
| 7588 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7589 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7590 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7591 | * 6-channel independent captures. |
| 7592 | * |
| 7593 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7594 | * driver yet). |
| 7595 | */ |
| 7596 | #define ALC883_DIGOUT_NID 0x06 |
| 7597 | #define ALC883_DIGIN_NID 0x0a |
| 7598 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7599 | #define ALC1200_DIGOUT_NID 0x10 |
| 7600 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7601 | static hda_nid_t alc883_dac_nids[4] = { |
| 7602 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7603 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7604 | }; |
| 7605 | |
| 7606 | static hda_nid_t alc883_adc_nids[2] = { |
| 7607 | /* ADC1-2 */ |
| 7608 | 0x08, 0x09, |
| 7609 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7610 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7611 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7612 | /* ADC1 */ |
| 7613 | 0x08, |
| 7614 | }; |
| 7615 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7616 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7617 | /* ADC2-1 */ |
| 7618 | 0x09, 0x08 |
| 7619 | }; |
| 7620 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7621 | #define alc889_adc_nids alc880_adc_nids |
| 7622 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7623 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7624 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7625 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7626 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7627 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7628 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7629 | /* input MUX */ |
| 7630 | /* FIXME: should be a matrix-type input source selection */ |
| 7631 | |
| 7632 | static struct hda_input_mux alc883_capture_source = { |
| 7633 | .num_items = 4, |
| 7634 | .items = { |
| 7635 | { "Mic", 0x0 }, |
| 7636 | { "Front Mic", 0x1 }, |
| 7637 | { "Line", 0x2 }, |
| 7638 | { "CD", 0x4 }, |
| 7639 | }, |
| 7640 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7641 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7642 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7643 | .num_items = 4, |
| 7644 | .items = { |
| 7645 | { "Mic", 0x1 }, |
| 7646 | { "Front Mic", 0x0 }, |
| 7647 | { "Line", 0x2 }, |
| 7648 | { "CD", 0x4 }, |
| 7649 | }, |
| 7650 | }; |
| 7651 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7652 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7653 | .num_items = 2, |
| 7654 | .items = { |
| 7655 | { "Mic", 0x1 }, |
| 7656 | { "Line", 0x2 }, |
| 7657 | }, |
| 7658 | }; |
| 7659 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7660 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7661 | .num_items = 4, |
| 7662 | .items = { |
| 7663 | { "Mic", 0x0 }, |
| 7664 | { "iMic", 0x1 }, |
| 7665 | { "Line", 0x2 }, |
| 7666 | { "CD", 0x4 }, |
| 7667 | }, |
| 7668 | }; |
| 7669 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7670 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7671 | .num_items = 2, |
| 7672 | .items = { |
| 7673 | { "Mic", 0x0 }, |
| 7674 | { "Int Mic", 0x1 }, |
| 7675 | }, |
| 7676 | }; |
| 7677 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7678 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7679 | .num_items = 3, |
| 7680 | .items = { |
| 7681 | { "Mic", 0x0 }, |
| 7682 | { "Front Mic", 0x1 }, |
| 7683 | { "Line", 0x4 }, |
| 7684 | }, |
| 7685 | }; |
| 7686 | |
| 7687 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7688 | .num_items = 2, |
| 7689 | .items = { |
| 7690 | { "Mic", 0x0 }, |
| 7691 | { "Line", 0x2 }, |
| 7692 | }, |
| 7693 | }; |
| 7694 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7695 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7696 | .num_items = 2, |
| 7697 | .items = { |
| 7698 | { "Mic", 0x0 }, |
| 7699 | /* Front Mic (0x01) unused */ |
| 7700 | { "Line", 0x2 }, |
| 7701 | /* Line 2 (0x03) unused */ |
| 7702 | /* CD (0x04) unsused? */ |
| 7703 | }, |
| 7704 | }; |
| 7705 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7706 | /* |
| 7707 | * 2ch mode |
| 7708 | */ |
| 7709 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7710 | { 2, NULL } |
| 7711 | }; |
| 7712 | |
| 7713 | /* |
| 7714 | * 2ch mode |
| 7715 | */ |
| 7716 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7717 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7718 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7719 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7720 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7721 | { } /* end */ |
| 7722 | }; |
| 7723 | |
| 7724 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7725 | * 4ch mode |
| 7726 | */ |
| 7727 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7728 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7729 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7730 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7731 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7732 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7733 | { } /* end */ |
| 7734 | }; |
| 7735 | |
| 7736 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7737 | * 6ch mode |
| 7738 | */ |
| 7739 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7740 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7741 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7742 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7743 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7744 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7745 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7746 | { } /* end */ |
| 7747 | }; |
| 7748 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7749 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7750 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7751 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7752 | { 6, alc883_3ST_ch6_init }, |
| 7753 | }; |
| 7754 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 7755 | |
| 7756 | /* |
| 7757 | * 2ch mode |
| 7758 | */ |
| 7759 | static struct hda_verb alc883_4ST_ch2_init[] = { |
Takashi Iwai | f03ecf5 | 2009-06-08 16:38:17 +0200 | [diff] [blame] | 7760 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 7761 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7762 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7763 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7764 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7765 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7766 | { } /* end */ |
| 7767 | }; |
| 7768 | |
| 7769 | /* |
| 7770 | * 4ch mode |
| 7771 | */ |
| 7772 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7773 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7774 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7775 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7776 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7777 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7778 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7779 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7780 | { } /* end */ |
| 7781 | }; |
| 7782 | |
| 7783 | /* |
| 7784 | * 6ch mode |
| 7785 | */ |
| 7786 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7787 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7788 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7789 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7790 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7791 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7792 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7793 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7794 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7795 | { } /* end */ |
| 7796 | }; |
| 7797 | |
| 7798 | /* |
| 7799 | * 8ch mode |
| 7800 | */ |
| 7801 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7802 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7803 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7804 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7805 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7806 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7807 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7808 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7809 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7810 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7811 | { } /* end */ |
| 7812 | }; |
| 7813 | |
| 7814 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7815 | { 2, alc883_4ST_ch2_init }, |
| 7816 | { 4, alc883_4ST_ch4_init }, |
| 7817 | { 6, alc883_4ST_ch6_init }, |
| 7818 | { 8, alc883_4ST_ch8_init }, |
| 7819 | }; |
| 7820 | |
| 7821 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7822 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7823 | * 2ch mode |
| 7824 | */ |
| 7825 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7826 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7827 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7828 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7829 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7830 | { } /* end */ |
| 7831 | }; |
| 7832 | |
| 7833 | /* |
| 7834 | * 4ch mode |
| 7835 | */ |
| 7836 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7837 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7838 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7839 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7840 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7841 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7842 | { } /* end */ |
| 7843 | }; |
| 7844 | |
| 7845 | /* |
| 7846 | * 6ch mode |
| 7847 | */ |
| 7848 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7849 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7850 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7851 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7852 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7853 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7854 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7855 | { } /* end */ |
| 7856 | }; |
| 7857 | |
| 7858 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7859 | { 2, alc883_3ST_ch2_intel_init }, |
| 7860 | { 4, alc883_3ST_ch4_intel_init }, |
| 7861 | { 6, alc883_3ST_ch6_intel_init }, |
| 7862 | }; |
| 7863 | |
| 7864 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7865 | * 6ch mode |
| 7866 | */ |
| 7867 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7868 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7869 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7870 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7871 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7872 | { } /* end */ |
| 7873 | }; |
| 7874 | |
| 7875 | /* |
| 7876 | * 8ch mode |
| 7877 | */ |
| 7878 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7879 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7880 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7881 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7882 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7883 | { } /* end */ |
| 7884 | }; |
| 7885 | |
| 7886 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7887 | { 6, alc883_sixstack_ch6_init }, |
| 7888 | { 8, alc883_sixstack_ch8_init }, |
| 7889 | }; |
| 7890 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7891 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7892 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7893 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7894 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7895 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7896 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7897 | { } /* end */ |
| 7898 | }; |
| 7899 | |
| 7900 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7901 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7902 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7903 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7904 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7905 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7906 | { } /* end */ |
| 7907 | }; |
| 7908 | |
| 7909 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7910 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7911 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7912 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7913 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7914 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7915 | { } /* end */ |
| 7916 | }; |
| 7917 | |
| 7918 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7919 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7920 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7921 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7922 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7923 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7924 | { } /* end */ |
| 7925 | }; |
| 7926 | |
| 7927 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7928 | { 2, alc889A_mb31_ch2_init }, |
| 7929 | { 4, alc889A_mb31_ch4_init }, |
| 7930 | { 5, alc889A_mb31_ch5_init }, |
| 7931 | { 6, alc889A_mb31_ch6_init }, |
| 7932 | }; |
| 7933 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7934 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7935 | /* eanable EAPD on medion laptop */ |
| 7936 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7937 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7938 | { } |
| 7939 | }; |
| 7940 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7941 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7942 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7943 | */ |
| 7944 | |
| 7945 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7946 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7947 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7948 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7949 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7950 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7951 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7952 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7953 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7954 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7955 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7956 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7957 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7958 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7959 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7960 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7961 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7962 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7963 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7964 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7965 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7966 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7967 | { } /* end */ |
| 7968 | }; |
| 7969 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7970 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7971 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7972 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7973 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7974 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7975 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7976 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7977 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7978 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7979 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7980 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7981 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7982 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7983 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7984 | { } /* end */ |
| 7985 | }; |
| 7986 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7987 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7988 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7989 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7990 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7991 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7992 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7993 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7995 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7996 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7997 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7998 | { } /* end */ |
| 7999 | }; |
| 8000 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8001 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8002 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8003 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8004 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8005 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8006 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8007 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8008 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8009 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8010 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8011 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8012 | { } /* end */ |
| 8013 | }; |
| 8014 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8015 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8016 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8017 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8018 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8019 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8020 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8021 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8022 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8023 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8024 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8025 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8026 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8027 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8028 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8029 | { } /* end */ |
| 8030 | }; |
| 8031 | |
| 8032 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8033 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8034 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8035 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8036 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8037 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8038 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8039 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8040 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8041 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8042 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8043 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8044 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8045 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8046 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8047 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8048 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8049 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8050 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8051 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8052 | { } /* end */ |
| 8053 | }; |
| 8054 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8055 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8056 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8057 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8058 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8059 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8060 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8061 | 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", 0x15, 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, 0x1, HDA_INPUT), |
| 8071 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8072 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8073 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8074 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8075 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8076 | { } /* end */ |
| 8077 | }; |
| 8078 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8079 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8080 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8081 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8082 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8083 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8084 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8085 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8086 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8087 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8088 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8089 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8090 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8091 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8092 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8093 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8094 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8095 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8096 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8097 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8098 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8099 | { } /* end */ |
| 8100 | }; |
| 8101 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8102 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8103 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8104 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8105 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8106 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8107 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 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), |
| 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), |
| 8112 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8113 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8114 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8115 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8116 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8117 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8118 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8119 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8120 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8121 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8122 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8123 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8124 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8125 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8126 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8127 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8128 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8129 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8130 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8131 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8132 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8133 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8134 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8135 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8136 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8137 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8138 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8139 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8140 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8141 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8142 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8143 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8144 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8145 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8146 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8147 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8148 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8149 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8150 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8151 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8152 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8153 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8154 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8155 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8156 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8157 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8158 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8159 | { } /* end */ |
| 8160 | }; |
| 8161 | |
| 8162 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8163 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8164 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8165 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8166 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8167 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8168 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8170 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8171 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8172 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8173 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8174 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8175 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8176 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8177 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8178 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8179 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8180 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8181 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8182 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8183 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8184 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8185 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8186 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8187 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8188 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8189 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8190 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8191 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8192 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8193 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8194 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8195 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8196 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8197 | { } /* end */ |
| 8198 | }; |
| 8199 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8200 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8201 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8202 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8203 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8204 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8205 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8206 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8207 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8208 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8209 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8210 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8211 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8212 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8213 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8214 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8215 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8216 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8217 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8218 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8219 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8220 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8221 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8222 | { } /* end */ |
| 8223 | }; |
| 8224 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8225 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8226 | /* Output mixers */ |
| 8227 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8228 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8229 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8230 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8231 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8232 | HDA_OUTPUT), |
| 8233 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8234 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8235 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8236 | /* Output switches */ |
| 8237 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8238 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8239 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8240 | /* Boost mixers */ |
| 8241 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8242 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8243 | /* Input mixers */ |
| 8244 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8245 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8246 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8247 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8248 | { } /* end */ |
| 8249 | }; |
| 8250 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8251 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8252 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8253 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8254 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8255 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8256 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8257 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8258 | { } /* end */ |
| 8259 | }; |
| 8260 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8261 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8262 | .ops = &snd_hda_bind_vol, |
| 8263 | .values = { |
| 8264 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8265 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8266 | 0 |
| 8267 | }, |
| 8268 | }; |
| 8269 | |
| 8270 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8271 | .ops = &snd_hda_bind_sw, |
| 8272 | .values = { |
| 8273 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8274 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8275 | 0 |
| 8276 | }, |
| 8277 | }; |
| 8278 | |
| 8279 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8280 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8281 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8282 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8283 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8284 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8285 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8286 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8287 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8288 | { } /* end */ |
| 8289 | }; |
| 8290 | |
| 8291 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8292 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8293 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8294 | { |
| 8295 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8296 | /* .name = "Capture Source", */ |
| 8297 | .name = "Input Source", |
| 8298 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8299 | .info = alc_mux_enum_info, |
| 8300 | .get = alc_mux_enum_get, |
| 8301 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8302 | }, |
| 8303 | { } /* end */ |
| 8304 | }; |
| 8305 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8306 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8307 | { |
| 8308 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8309 | .name = "Channel Mode", |
| 8310 | .info = alc_ch_mode_info, |
| 8311 | .get = alc_ch_mode_get, |
| 8312 | .put = alc_ch_mode_put, |
| 8313 | }, |
| 8314 | { } /* end */ |
| 8315 | }; |
| 8316 | |
| 8317 | static struct hda_verb alc883_init_verbs[] = { |
| 8318 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8319 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8320 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8321 | /* ADC2: mute amp left and right */ |
| 8322 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8323 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8324 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8325 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8326 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8327 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8328 | /* Rear mixer */ |
| 8329 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8330 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8331 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8332 | /* CLFE mixer */ |
| 8333 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8334 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8335 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8336 | /* Side mixer */ |
| 8337 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8338 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8339 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8340 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8341 | /* mute analog input loopbacks */ |
| 8342 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8343 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8344 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8345 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8346 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8347 | |
| 8348 | /* Front Pin: output 0 (0x0c) */ |
| 8349 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8350 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8351 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8352 | /* Rear Pin: output 1 (0x0d) */ |
| 8353 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8354 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8355 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8356 | /* CLFE Pin: output 2 (0x0e) */ |
| 8357 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8358 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8359 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8360 | /* Side Pin: output 3 (0x0f) */ |
| 8361 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8362 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8363 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8364 | /* Mic (rear) pin: input vref at 80% */ |
| 8365 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8366 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8367 | /* Front Mic pin: input vref at 80% */ |
| 8368 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8369 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8370 | /* Line In pin: input */ |
| 8371 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8372 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8373 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8374 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8375 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8376 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8377 | /* CD pin widget for input */ |
| 8378 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8379 | |
| 8380 | /* FIXME: use matrix-type input source selection */ |
| 8381 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8382 | /* Input mixer2 */ |
| 8383 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8384 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8385 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8386 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8387 | /* Input mixer3 */ |
| 8388 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8389 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8390 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8391 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8392 | { } |
| 8393 | }; |
| 8394 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8395 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8396 | static void alc883_mitac_init_hook(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8397 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8398 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8399 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8400 | spec->autocfg.hp_pins[0] = 0x15; |
| 8401 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8402 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8403 | alc_automute_amp(codec); |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8404 | } |
| 8405 | |
| 8406 | /* auto-toggle front mic */ |
| 8407 | /* |
| 8408 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8409 | { |
| 8410 | unsigned int present; |
| 8411 | unsigned char bits; |
| 8412 | |
| 8413 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8414 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8415 | bits = present ? HDA_AMP_MUTE : 0; |
| 8416 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8417 | } |
| 8418 | */ |
| 8419 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8420 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8421 | /* HP */ |
| 8422 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8423 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8424 | /* Subwoofer */ |
| 8425 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8426 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8427 | |
| 8428 | /* enable unsolicited event */ |
| 8429 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8430 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8431 | |
| 8432 | { } /* end */ |
| 8433 | }; |
| 8434 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8435 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8436 | /* HP */ |
| 8437 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8438 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8439 | /* Int speaker */ |
| 8440 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8441 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8442 | |
| 8443 | /* enable unsolicited event */ |
| 8444 | {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] | 8445 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8446 | |
| 8447 | { } /* end */ |
| 8448 | }; |
| 8449 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8450 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8451 | /* HP */ |
| 8452 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8453 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8454 | /* Subwoofer */ |
| 8455 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8456 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8457 | |
| 8458 | /* enable unsolicited event */ |
| 8459 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8460 | |
| 8461 | { } /* end */ |
| 8462 | }; |
| 8463 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8464 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8465 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8466 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8467 | |
| 8468 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8469 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8470 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8471 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8472 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8473 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8474 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8475 | /* Connect Mic jack to CLFE */ |
| 8476 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8477 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8478 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8479 | /* Connect Line-in jack to Surround */ |
| 8480 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8481 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8482 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8483 | /* Connect HP out jack to Front */ |
| 8484 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8485 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8486 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8487 | |
| 8488 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8489 | |
| 8490 | { } /* end */ |
| 8491 | }; |
| 8492 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8493 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8494 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8495 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8496 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8497 | { } /* end */ |
| 8498 | }; |
| 8499 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8500 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8501 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8502 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8503 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8504 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8505 | { } /* end */ |
| 8506 | }; |
| 8507 | |
| 8508 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8509 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8510 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8511 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8512 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8513 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8514 | { } /* end */ |
| 8515 | }; |
| 8516 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8517 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8519 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8520 | |
| 8521 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8522 | |
| 8523 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8524 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8525 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8526 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8527 | { } /* end */ |
| 8528 | }; |
| 8529 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8530 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8531 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8532 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8533 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8534 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8535 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8536 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8537 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8538 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8539 | { } /* end */ |
| 8540 | }; |
| 8541 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8542 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8543 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8544 | { } |
| 8545 | }; |
| 8546 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8547 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8548 | /* HP */ |
| 8549 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8550 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8551 | |
| 8552 | /* enable unsolicited event */ |
| 8553 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8554 | |
| 8555 | { } /* end */ |
| 8556 | }; |
| 8557 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8558 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8559 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8560 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8561 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8562 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8563 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8564 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8565 | spec->autocfg.speaker_pins[2] = 0x18; |
| 8566 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8567 | } |
| 8568 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8569 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8570 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8571 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8572 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8573 | {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] | 8574 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8575 | }; |
| 8576 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8577 | /* |
| 8578 | * 2ch mode |
| 8579 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8580 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8581 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8582 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8583 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8584 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8585 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8586 | }; |
| 8587 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8588 | /* |
| 8589 | * 4ch mode |
| 8590 | */ |
| 8591 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8592 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8593 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8594 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8595 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8596 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8597 | { } /* end */ |
| 8598 | }; |
| 8599 | |
| 8600 | /* |
| 8601 | * 6ch mode |
| 8602 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8603 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8604 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8605 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8606 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8607 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8608 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8609 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8610 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8611 | }; |
| 8612 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8613 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8614 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8615 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8616 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8617 | }; |
| 8618 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8619 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8620 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8621 | { |
| 8622 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8623 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8624 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8625 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8626 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8627 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8628 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8629 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8630 | } |
| 8631 | |
| 8632 | /* toggle RCA according to the front-jack state */ |
| 8633 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8634 | { |
| 8635 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8636 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8637 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8638 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8639 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8640 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8641 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8642 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8643 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8644 | unsigned int res) |
| 8645 | { |
| 8646 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8647 | alc888_lenovo_ms7195_front_automute(codec); |
| 8648 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8649 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8650 | } |
| 8651 | |
| 8652 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8653 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8654 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8655 | |
| 8656 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8657 | |
| 8658 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8659 | { } /* end */ |
| 8660 | }; |
| 8661 | |
| 8662 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8663 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8664 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8665 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8666 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8667 | spec->autocfg.hp_pins[0] = 0x14; |
| 8668 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8669 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8670 | } |
| 8671 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8672 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8673 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8674 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8675 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8676 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8677 | { |
| 8678 | unsigned int present; |
| 8679 | |
| 8680 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8681 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8682 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8683 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8684 | } |
| 8685 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8686 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8687 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8688 | struct alc_spec *spec = codec->spec; |
| 8689 | |
| 8690 | spec->autocfg.hp_pins[0] = 0x15; |
| 8691 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8692 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8693 | alc883_clevo_m720_mic_automute(codec); |
| 8694 | } |
| 8695 | |
| 8696 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8697 | unsigned int res) |
| 8698 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8699 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8700 | case ALC880_MIC_EVENT: |
| 8701 | alc883_clevo_m720_mic_automute(codec); |
| 8702 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8703 | default: |
| 8704 | alc_automute_amp_unsol_event(codec, res); |
| 8705 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8706 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8707 | } |
| 8708 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8709 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8710 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8711 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8712 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8713 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8714 | spec->autocfg.hp_pins[0] = 0x14; |
| 8715 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8716 | alc_automute_amp(codec); |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8717 | } |
| 8718 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8719 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8720 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8721 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8722 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8723 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8724 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8725 | alc_automute_amp(codec); |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8726 | } |
| 8727 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8728 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8729 | { |
| 8730 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8731 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8732 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8733 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8734 | & AC_PINSENSE_PRESENCE; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8735 | bits = present ? HDA_AMP_MUTE : 0; |
| 8736 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8737 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8738 | } |
| 8739 | |
| 8740 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8741 | { |
| 8742 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8743 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8744 | |
| 8745 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8746 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8747 | bits = present ? HDA_AMP_MUTE : 0; |
| 8748 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8749 | HDA_AMP_MUTE, bits); |
| 8750 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8751 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8752 | } |
| 8753 | |
| 8754 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8755 | unsigned int res) |
| 8756 | { |
| 8757 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8758 | alc883_lenovo_101e_all_automute(codec); |
| 8759 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8760 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8761 | } |
| 8762 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8763 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8764 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8765 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8766 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8767 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8768 | spec->autocfg.hp_pins[0] = 0x14; |
| 8769 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8770 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8771 | alc_automute_amp(codec); |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8772 | } |
| 8773 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8774 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8775 | /* HP Pin: output 0 (0x0c) */ |
| 8776 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8777 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8778 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8779 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8780 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8781 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8782 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8783 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8784 | /* eanable EAPD on medion laptop */ |
| 8785 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8786 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8787 | /* enable unsolicited event */ |
| 8788 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8789 | { } |
| 8790 | }; |
| 8791 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8792 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8793 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8794 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8795 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8796 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8797 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8798 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8799 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8800 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8801 | alc_automute_amp(codec); |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8802 | } |
| 8803 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8804 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8805 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8806 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8807 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8808 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8809 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8810 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8811 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8812 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8813 | spec->autocfg.speaker_pins[4] = 0x1a; |
| 8814 | alc_automute_amp(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8815 | } |
| 8816 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8817 | static void alc883_vaiott_init_hook(struct hda_codec *codec) |
| 8818 | { |
| 8819 | struct alc_spec *spec = codec->spec; |
| 8820 | |
| 8821 | spec->autocfg.hp_pins[0] = 0x15; |
| 8822 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8823 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8824 | alc_automute_amp(codec); |
| 8825 | } |
| 8826 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8827 | /* |
| 8828 | * generic initialization of ADC, input mixers and output mixers |
| 8829 | */ |
| 8830 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8831 | /* |
| 8832 | * Unmute ADC0-2 and set the default input to mic-in |
| 8833 | */ |
| 8834 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8835 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8836 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8837 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8838 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8839 | /* 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] | 8840 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8841 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8842 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8843 | */ |
| 8844 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8845 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8846 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8847 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8848 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8849 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8850 | |
| 8851 | /* |
| 8852 | * Set up output mixers (0x0c - 0x0f) |
| 8853 | */ |
| 8854 | /* set vol=0 to output mixers */ |
| 8855 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8856 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8857 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8858 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8859 | /* set up input amps for analog loopback */ |
| 8860 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8861 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8862 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8863 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8864 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8865 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8866 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8867 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8868 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8869 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8870 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8871 | |
| 8872 | /* FIXME: use matrix-type input source selection */ |
| 8873 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8874 | /* Input mixer1 */ |
| 8875 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8876 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8877 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8878 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8879 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8880 | /* Input mixer2 */ |
| 8881 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8882 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8883 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8884 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8885 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8886 | |
| 8887 | { } |
| 8888 | }; |
| 8889 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8890 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8891 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8892 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8893 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8894 | /* enable unsolicited event */ |
| 8895 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8896 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8897 | { } /* end */ |
| 8898 | }; |
| 8899 | |
| 8900 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8901 | { |
| 8902 | unsigned int present; |
| 8903 | |
| 8904 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8905 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8906 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8907 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8908 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8909 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8910 | } |
| 8911 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8912 | static void alc883_M90V_init_hook(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8913 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8914 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8915 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8916 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8917 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8918 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8919 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8920 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8921 | } |
| 8922 | |
| 8923 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8924 | unsigned int res) |
| 8925 | { |
| 8926 | switch (res >> 26) { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8927 | case ALC880_MIC_EVENT: |
| 8928 | alc883_nb_mic_automute(codec); |
| 8929 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8930 | default: |
| 8931 | alc_sku_unsol_event(codec, res); |
| 8932 | break; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8933 | } |
| 8934 | } |
| 8935 | |
| 8936 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8937 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8938 | alc883_M90V_init_hook(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8939 | alc883_nb_mic_automute(codec); |
| 8940 | } |
| 8941 | |
| 8942 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8943 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8944 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8945 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8946 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8947 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8948 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8949 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8950 | /* enable unsolicited event */ |
| 8951 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8952 | { } /* end */ |
| 8953 | }; |
| 8954 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8955 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8956 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8957 | struct alc_spec *spec = codec->spec; |
| 8958 | |
| 8959 | spec->autocfg.hp_pins[0] = 0x14; |
| 8960 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8961 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8962 | } |
| 8963 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8964 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8965 | /* Init rear pin (used as headphone output) */ |
| 8966 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8967 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8968 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8969 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8970 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8971 | /* Init line 2 pin (used as headphone out by default) */ |
| 8972 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8973 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8974 | { } /* end */ |
| 8975 | }; |
| 8976 | |
| 8977 | /* Mute speakers according to the headphone jack state */ |
| 8978 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8979 | { |
| 8980 | unsigned int present; |
| 8981 | |
| 8982 | /* Mute only in 2ch or 4ch mode */ |
| 8983 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8984 | == 0x00) { |
| 8985 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8986 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 8987 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8988 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8989 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8990 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8991 | } |
| 8992 | } |
| 8993 | |
| 8994 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8995 | { |
| 8996 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8997 | alc889A_mb31_automute(codec); |
| 8998 | } |
| 8999 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9000 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9001 | #define alc883_loopbacks alc880_loopbacks |
| 9002 | #endif |
| 9003 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9004 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9005 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 9006 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9007 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9008 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 9009 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 9010 | |
| 9011 | /* |
| 9012 | * configuration and preset |
| 9013 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9014 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 9015 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 9016 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9017 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 9018 | [ALC883_6ST_DIG] = "6stack-dig", |
| 9019 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9020 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9021 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9022 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9023 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9024 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9025 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9026 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9027 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9028 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9029 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9030 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9031 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9032 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9033 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9034 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9035 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9036 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9037 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9038 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9039 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9040 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9041 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9042 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9043 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9044 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9045 | [ALC883_AUTO] = "auto", |
| 9046 | }; |
| 9047 | |
| 9048 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 9049 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9050 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9051 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9052 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9053 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9054 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9055 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9056 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9057 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9058 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 9059 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9060 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9061 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9062 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9063 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | b3bdb30 | 2009-02-18 13:16:26 +0100 | [diff] [blame] | 9064 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), |
Takashi Iwai | 9468350 | 2009-02-13 09:31:20 +0100 | [diff] [blame] | 9065 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9066 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 9067 | ALC888_ACER_ASPIRE_4930G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9068 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9069 | ALC888_ACER_ASPIRE_6530G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9070 | /* default Acer -- disabled as it causes more problems. |
| 9071 | * model=auto should work fine now |
| 9072 | */ |
| 9073 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9074 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9075 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9076 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9077 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9078 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9079 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9080 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9081 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9082 | 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] | 9083 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9084 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9085 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9086 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9087 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9088 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9089 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9090 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9091 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9092 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 9093 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9094 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9095 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9096 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 9097 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9098 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9099 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9100 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9101 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9102 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9103 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9104 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9105 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 9106 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9107 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9108 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9109 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9110 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9111 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9112 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9113 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9114 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9115 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9116 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9117 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9118 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9119 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9120 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9121 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9122 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9123 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9124 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9125 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9126 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9127 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9128 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9129 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9130 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9131 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9132 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9133 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9134 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9135 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9136 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9137 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9138 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9139 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9140 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 9141 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9142 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9143 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9144 | {} |
| 9145 | }; |
| 9146 | |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9147 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9148 | ALC1200_DIGOUT_NID, 0, |
| 9149 | }; |
| 9150 | |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9151 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9152 | ALC883_DIGOUT_NID, 0, |
| 9153 | }; |
| 9154 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9155 | static struct alc_config_preset alc883_presets[] = { |
| 9156 | [ALC883_3ST_2ch_DIG] = { |
| 9157 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9158 | .init_verbs = { alc883_init_verbs }, |
| 9159 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9160 | .dac_nids = alc883_dac_nids, |
| 9161 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9162 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9163 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9164 | .channel_mode = alc883_3ST_2ch_modes, |
| 9165 | .input_mux = &alc883_capture_source, |
| 9166 | }, |
| 9167 | [ALC883_3ST_6ch_DIG] = { |
| 9168 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9169 | .init_verbs = { alc883_init_verbs }, |
| 9170 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9171 | .dac_nids = alc883_dac_nids, |
| 9172 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9173 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9174 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9175 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9176 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9177 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9178 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9179 | [ALC883_3ST_6ch] = { |
| 9180 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9181 | .init_verbs = { alc883_init_verbs }, |
| 9182 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9183 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9184 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9185 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9186 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9187 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9188 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9189 | [ALC883_3ST_6ch_INTEL] = { |
| 9190 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9191 | .init_verbs = { alc883_init_verbs }, |
| 9192 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9193 | .dac_nids = alc883_dac_nids, |
| 9194 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9195 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9196 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9197 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9198 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9199 | .need_dac_fix = 1, |
| 9200 | .input_mux = &alc883_3stack_6ch_intel, |
| 9201 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9202 | [ALC883_6ST_DIG] = { |
| 9203 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9204 | .init_verbs = { alc883_init_verbs }, |
| 9205 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9206 | .dac_nids = alc883_dac_nids, |
| 9207 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9208 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9209 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9210 | .channel_mode = alc883_sixstack_modes, |
| 9211 | .input_mux = &alc883_capture_source, |
| 9212 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9213 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9214 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
| 9215 | .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9216 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9217 | .dac_nids = alc883_dac_nids, |
| 9218 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9219 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9220 | .channel_mode = alc883_3ST_6ch_modes, |
| 9221 | .need_dac_fix = 1, |
| 9222 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9223 | .unsol_event = alc883_targa_unsol_event, |
| 9224 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9225 | }, |
| 9226 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9227 | .mixers = { alc883_targa_2ch_mixer}, |
| 9228 | .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9229 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9230 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9231 | .adc_nids = alc883_adc_nids_alt, |
| 9232 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9233 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9234 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9235 | .channel_mode = alc883_3ST_2ch_modes, |
| 9236 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9237 | .unsol_event = alc883_targa_unsol_event, |
| 9238 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9239 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9240 | [ALC883_TARGA_8ch_DIG] = { |
| 9241 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9242 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9243 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9244 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9245 | .dac_nids = alc883_dac_nids, |
| 9246 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9247 | .adc_nids = alc883_adc_nids_rev, |
| 9248 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9249 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9250 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9251 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9252 | .channel_mode = alc883_4ST_8ch_modes, |
| 9253 | .need_dac_fix = 1, |
| 9254 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9255 | .unsol_event = alc883_targa_unsol_event, |
| 9256 | .init_hook = alc883_targa_init_hook, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9257 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9258 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9259 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9260 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9261 | * and the headphone jack. Turn this on and rely on the |
| 9262 | * standard mute methods whenever the user wants to turn |
| 9263 | * these outputs off. |
| 9264 | */ |
| 9265 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9266 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9267 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9268 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9269 | .channel_mode = alc883_3ST_2ch_modes, |
| 9270 | .input_mux = &alc883_capture_source, |
| 9271 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9272 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9273 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9274 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9275 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9276 | .dac_nids = alc883_dac_nids, |
| 9277 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9278 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9279 | .channel_mode = alc883_3ST_2ch_modes, |
| 9280 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9281 | .unsol_event = alc_automute_amp_unsol_event, |
| 9282 | .init_hook = alc883_acer_aspire_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9283 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9284 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9285 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9286 | alc883_chmode_mixer }, |
| 9287 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9288 | alc888_acer_aspire_4930g_verbs }, |
| 9289 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9290 | .dac_nids = alc883_dac_nids, |
| 9291 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9292 | .adc_nids = alc883_adc_nids_rev, |
| 9293 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9294 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9295 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9296 | .channel_mode = alc883_3ST_6ch_modes, |
| 9297 | .need_dac_fix = 1, |
| 9298 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9299 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9300 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9301 | .unsol_event = alc_automute_amp_unsol_event, |
| 9302 | .init_hook = alc888_acer_aspire_4930g_init_hook, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9303 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9304 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9305 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9306 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9307 | alc888_acer_aspire_6530g_verbs }, |
| 9308 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9309 | .dac_nids = alc883_dac_nids, |
| 9310 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9311 | .adc_nids = alc883_adc_nids_rev, |
| 9312 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9313 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9314 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9315 | .channel_mode = alc883_3ST_2ch_modes, |
| 9316 | .num_mux_defs = |
| 9317 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9318 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9319 | .unsol_event = alc_automute_amp_unsol_event, |
| 9320 | .init_hook = alc888_acer_aspire_4930g_init_hook, |
| 9321 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9322 | [ALC888_ACER_ASPIRE_8930G] = { |
| 9323 | .mixers = { alc888_base_mixer, |
| 9324 | alc883_chmode_mixer }, |
| 9325 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9326 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9327 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9328 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9329 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9330 | .adc_nids = alc889_adc_nids, |
| 9331 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9332 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9333 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9334 | .channel_mode = alc883_3ST_6ch_modes, |
| 9335 | .need_dac_fix = 1, |
| 9336 | .const_channel_count = 6, |
| 9337 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9338 | ARRAY_SIZE(alc889_capture_sources), |
| 9339 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9340 | .unsol_event = alc_automute_amp_unsol_event, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9341 | .init_hook = alc889_acer_aspire_8930g_init_hook, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9342 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9343 | [ALC883_MEDION] = { |
| 9344 | .mixers = { alc883_fivestack_mixer, |
| 9345 | alc883_chmode_mixer }, |
| 9346 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9347 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9348 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9349 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9350 | .adc_nids = alc883_adc_nids_alt, |
| 9351 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9352 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9353 | .channel_mode = alc883_sixstack_modes, |
| 9354 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9355 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9356 | [ALC883_MEDION_MD2] = { |
| 9357 | .mixers = { alc883_medion_md2_mixer}, |
| 9358 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9359 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9360 | .dac_nids = alc883_dac_nids, |
| 9361 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9362 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9363 | .channel_mode = alc883_3ST_2ch_modes, |
| 9364 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9365 | .unsol_event = alc_automute_amp_unsol_event, |
| 9366 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9367 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9368 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9369 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9370 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9371 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9372 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9373 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9374 | .channel_mode = alc883_3ST_2ch_modes, |
| 9375 | .input_mux = &alc883_capture_source, |
| 9376 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9377 | [ALC883_CLEVO_M720] = { |
| 9378 | .mixers = { alc883_clevo_m720_mixer }, |
| 9379 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9380 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9381 | .dac_nids = alc883_dac_nids, |
| 9382 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9383 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9384 | .channel_mode = alc883_3ST_2ch_modes, |
| 9385 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9386 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9387 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9388 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9389 | [ALC883_LENOVO_101E_2ch] = { |
| 9390 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9391 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9392 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9393 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9394 | .adc_nids = alc883_adc_nids_alt, |
| 9395 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9396 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9397 | .channel_mode = alc883_3ST_2ch_modes, |
| 9398 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9399 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9400 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9401 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9402 | [ALC883_LENOVO_NB0763] = { |
| 9403 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9404 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9405 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9406 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9407 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9408 | .channel_mode = alc883_3ST_2ch_modes, |
| 9409 | .need_dac_fix = 1, |
| 9410 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9411 | .unsol_event = alc_automute_amp_unsol_event, |
| 9412 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9413 | }, |
| 9414 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9415 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9416 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9417 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9418 | .dac_nids = alc883_dac_nids, |
| 9419 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9420 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9421 | .channel_mode = alc883_3ST_6ch_modes, |
| 9422 | .need_dac_fix = 1, |
| 9423 | .input_mux = &alc883_capture_source, |
| 9424 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9425 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9426 | }, |
| 9427 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9428 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9429 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9430 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9431 | .dac_nids = alc883_dac_nids, |
| 9432 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9433 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9434 | .channel_mode = alc883_3ST_2ch_modes, |
| 9435 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9436 | .unsol_event = alc_automute_amp_unsol_event, |
| 9437 | .init_hook = alc883_haier_w66_init_hook, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9438 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9439 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9440 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9441 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9442 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9443 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9444 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9445 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9446 | .need_dac_fix = 1, |
| 9447 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9448 | .unsol_event = alc_automute_amp_unsol_event, |
| 9449 | .init_hook = alc888_3st_hp_init_hook, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9450 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9451 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9452 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9453 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9454 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9455 | .dac_nids = alc883_dac_nids, |
| 9456 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9457 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9458 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9459 | .channel_mode = alc883_sixstack_modes, |
| 9460 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9461 | .unsol_event = alc_automute_amp_unsol_event, |
| 9462 | .init_hook = alc888_6st_dell_init_hook, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9463 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9464 | [ALC883_MITAC] = { |
| 9465 | .mixers = { alc883_mitac_mixer }, |
| 9466 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9467 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9468 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9469 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9470 | .channel_mode = alc883_3ST_2ch_modes, |
| 9471 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9472 | .unsol_event = alc_automute_amp_unsol_event, |
| 9473 | .init_hook = alc883_mitac_init_hook, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9474 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9475 | [ALC883_FUJITSU_PI2515] = { |
| 9476 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9477 | .init_verbs = { alc883_init_verbs, |
| 9478 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9479 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9480 | .dac_nids = alc883_dac_nids, |
| 9481 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9482 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9483 | .channel_mode = alc883_3ST_2ch_modes, |
| 9484 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9485 | .unsol_event = alc_automute_amp_unsol_event, |
| 9486 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9487 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9488 | [ALC888_FUJITSU_XA3530] = { |
| 9489 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9490 | .init_verbs = { alc883_init_verbs, |
| 9491 | alc888_fujitsu_xa3530_verbs }, |
| 9492 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9493 | .dac_nids = alc883_dac_nids, |
| 9494 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9495 | .adc_nids = alc883_adc_nids_rev, |
| 9496 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9497 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9498 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9499 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9500 | .num_mux_defs = |
| 9501 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9502 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9503 | .unsol_event = alc_automute_amp_unsol_event, |
| 9504 | .init_hook = alc888_fujitsu_xa3530_init_hook, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9505 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9506 | [ALC888_LENOVO_SKY] = { |
| 9507 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9508 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9509 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9510 | .dac_nids = alc883_dac_nids, |
| 9511 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9512 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9513 | .channel_mode = alc883_sixstack_modes, |
| 9514 | .need_dac_fix = 1, |
| 9515 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9516 | .unsol_event = alc_automute_amp_unsol_event, |
| 9517 | .init_hook = alc888_lenovo_sky_init_hook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9518 | }, |
| 9519 | [ALC888_ASUS_M90V] = { |
| 9520 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9521 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9522 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9523 | .dac_nids = alc883_dac_nids, |
| 9524 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9525 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9526 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9527 | .channel_mode = alc883_3ST_6ch_modes, |
| 9528 | .need_dac_fix = 1, |
| 9529 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9530 | .unsol_event = alc883_mode2_unsol_event, |
| 9531 | .init_hook = alc883_mode2_inithook, |
| 9532 | }, |
| 9533 | [ALC888_ASUS_EEE1601] = { |
| 9534 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9535 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9536 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9537 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9538 | .dac_nids = alc883_dac_nids, |
| 9539 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9540 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9541 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9542 | .channel_mode = alc883_3ST_2ch_modes, |
| 9543 | .need_dac_fix = 1, |
| 9544 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9545 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9546 | .init_hook = alc883_eee1601_inithook, |
| 9547 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9548 | [ALC1200_ASUS_P5Q] = { |
| 9549 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9550 | .init_verbs = { alc883_init_verbs }, |
| 9551 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9552 | .dac_nids = alc883_dac_nids, |
| 9553 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9554 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9555 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9556 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9557 | .channel_mode = alc883_sixstack_modes, |
| 9558 | .input_mux = &alc883_capture_source, |
| 9559 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9560 | [ALC889A_MB31] = { |
| 9561 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9562 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9563 | alc880_gpio1_init_verbs }, |
| 9564 | .adc_nids = alc883_adc_nids, |
| 9565 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9566 | .dac_nids = alc883_dac_nids, |
| 9567 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9568 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9569 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9570 | .input_mux = &alc889A_mb31_capture_source, |
| 9571 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9572 | .unsol_event = alc889A_mb31_unsol_event, |
| 9573 | .init_hook = alc889A_mb31_automute, |
| 9574 | }, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9575 | [ALC883_SONY_VAIO_TT] = { |
| 9576 | .mixers = { alc883_vaiott_mixer }, |
| 9577 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9578 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9579 | .dac_nids = alc883_dac_nids, |
| 9580 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9581 | .channel_mode = alc883_3ST_2ch_modes, |
| 9582 | .input_mux = &alc883_capture_source, |
| 9583 | .unsol_event = alc_automute_amp_unsol_event, |
| 9584 | .init_hook = alc883_vaiott_init_hook, |
| 9585 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9586 | }; |
| 9587 | |
| 9588 | |
| 9589 | /* |
| 9590 | * BIOS auto configuration |
| 9591 | */ |
| 9592 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9593 | hda_nid_t nid, int pin_type, |
| 9594 | int dac_idx) |
| 9595 | { |
| 9596 | /* set as output */ |
| 9597 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9598 | int idx; |
| 9599 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9600 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9601 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9602 | idx = 4; |
| 9603 | else |
| 9604 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9605 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9606 | |
| 9607 | } |
| 9608 | |
| 9609 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 9610 | { |
| 9611 | struct alc_spec *spec = codec->spec; |
| 9612 | int i; |
| 9613 | |
| 9614 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9615 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9616 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9617 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9618 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9619 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9620 | } |
| 9621 | } |
| 9622 | |
| 9623 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 9624 | { |
| 9625 | struct alc_spec *spec = codec->spec; |
| 9626 | hda_nid_t pin; |
| 9627 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9628 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9629 | if (pin) /* connect to front */ |
| 9630 | /* use dac 0 */ |
| 9631 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9632 | pin = spec->autocfg.speaker_pins[0]; |
| 9633 | if (pin) |
| 9634 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9635 | } |
| 9636 | |
| 9637 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9638 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 9639 | |
| 9640 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 9641 | { |
| 9642 | struct alc_spec *spec = codec->spec; |
| 9643 | int i; |
| 9644 | |
| 9645 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9646 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9647 | if (alc883_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 9648 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 9649 | if (nid != ALC883_PIN_CD_NID && |
| 9650 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9651 | snd_hda_codec_write(codec, nid, 0, |
| 9652 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9653 | AMP_OUT_MUTE); |
| 9654 | } |
| 9655 | } |
| 9656 | } |
| 9657 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9658 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 9659 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9660 | /* almost identical with ALC880 parser... */ |
| 9661 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 9662 | { |
| 9663 | struct alc_spec *spec = codec->spec; |
| 9664 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9665 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 9666 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9667 | |
| 9668 | if (err < 0) |
| 9669 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9670 | else if (!err) |
| 9671 | return 0; /* no config found */ |
| 9672 | |
| 9673 | err = alc_auto_add_mic_boost(codec); |
| 9674 | if (err < 0) |
| 9675 | return err; |
| 9676 | |
| 9677 | /* hack - override the init verbs */ |
| 9678 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9679 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9680 | /* setup input_mux for ALC889 */ |
| 9681 | if (codec->vendor_id == 0x10ec0889) { |
| 9682 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9683 | * because it's under 0x18 |
| 9684 | */ |
| 9685 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9686 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9687 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9688 | for (i = 1; i < 3; i++) |
| 9689 | memcpy(&spec->private_imux[i], |
| 9690 | &spec->private_imux[0], |
| 9691 | sizeof(spec->private_imux[0])); |
| 9692 | imux->items[imux->num_items].label = "Int DMic"; |
| 9693 | imux->items[imux->num_items].index = 0x0b; |
| 9694 | imux->num_items++; |
| 9695 | spec->num_mux_defs = 3; |
| 9696 | spec->input_mux = spec->private_imux; |
| 9697 | } |
| 9698 | } |
| 9699 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9700 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9701 | } |
| 9702 | |
| 9703 | /* additional initialization for auto-configuration model */ |
| 9704 | static void alc883_auto_init(struct hda_codec *codec) |
| 9705 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9706 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9707 | alc883_auto_init_multi_out(codec); |
| 9708 | alc883_auto_init_hp_out(codec); |
| 9709 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9710 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9711 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9712 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9713 | } |
| 9714 | |
| 9715 | static int patch_alc883(struct hda_codec *codec) |
| 9716 | { |
| 9717 | struct alc_spec *spec; |
| 9718 | int err, board_config; |
| 9719 | |
| 9720 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9721 | if (spec == NULL) |
| 9722 | return -ENOMEM; |
| 9723 | |
| 9724 | codec->spec = spec; |
| 9725 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9726 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9727 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9728 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9729 | alc883_models, |
| 9730 | alc883_cfg_tbl); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9731 | if (board_config < 0 || board_config >= ALC883_MODEL_LAST) { |
| 9732 | /* Pick up systems that don't supply PCI SSID */ |
| 9733 | switch (codec->subsystem_id) { |
| 9734 | case 0x106b3600: /* Macbook 3.1 */ |
| 9735 | board_config = ALC889A_MB31; |
| 9736 | break; |
| 9737 | default: |
| 9738 | printk(KERN_INFO |
| 9739 | "hda_codec: Unknown model for %s, trying " |
| 9740 | "auto-probe from BIOS...\n", codec->chip_name); |
| 9741 | board_config = ALC883_AUTO; |
| 9742 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9743 | } |
| 9744 | |
| 9745 | if (board_config == ALC883_AUTO) { |
| 9746 | /* automatic parse from the BIOS config */ |
| 9747 | err = alc883_parse_auto_config(codec); |
| 9748 | if (err < 0) { |
| 9749 | alc_free(codec); |
| 9750 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9751 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9752 | printk(KERN_INFO |
| 9753 | "hda_codec: Cannot set up configuration " |
| 9754 | "from BIOS. Using base mode...\n"); |
| 9755 | board_config = ALC883_3ST_2ch_DIG; |
| 9756 | } |
| 9757 | } |
| 9758 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9759 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9760 | if (err < 0) { |
| 9761 | alc_free(codec); |
| 9762 | return err; |
| 9763 | } |
| 9764 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9765 | if (board_config != ALC883_AUTO) |
| 9766 | setup_preset(spec, &alc883_presets[board_config]); |
| 9767 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9768 | switch (codec->vendor_id) { |
| 9769 | case 0x10ec0888: |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9770 | if (!spec->num_adc_nids) { |
| 9771 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9772 | spec->adc_nids = alc883_adc_nids; |
| 9773 | } |
| 9774 | if (!spec->capsrc_nids) |
| 9775 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9776 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9777 | break; |
| 9778 | case 0x10ec0889: |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9779 | if (!spec->num_adc_nids) { |
| 9780 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9781 | spec->adc_nids = alc889_adc_nids; |
| 9782 | } |
| 9783 | if (!spec->capsrc_nids) |
| 9784 | spec->capsrc_nids = alc889_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9785 | break; |
| 9786 | default: |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9787 | if (!spec->num_adc_nids) { |
| 9788 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9789 | spec->adc_nids = alc883_adc_nids; |
| 9790 | } |
| 9791 | if (!spec->capsrc_nids) |
| 9792 | spec->capsrc_nids = alc883_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9793 | break; |
| 9794 | } |
| 9795 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9796 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9797 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9798 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9799 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9800 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9801 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9802 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9803 | if (!spec->cap_mixer) |
| 9804 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9805 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9806 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9807 | spec->vmaster_nid = 0x0c; |
| 9808 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9809 | codec->patch_ops = alc_patch_ops; |
| 9810 | if (board_config == ALC883_AUTO) |
| 9811 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9812 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9813 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9814 | if (!spec->loopback.amplist) |
| 9815 | spec->loopback.amplist = alc883_loopbacks; |
| 9816 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9817 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9818 | |
| 9819 | return 0; |
| 9820 | } |
| 9821 | |
| 9822 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9823 | * ALC262 support |
| 9824 | */ |
| 9825 | |
| 9826 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9827 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9828 | |
| 9829 | #define alc262_dac_nids alc260_dac_nids |
| 9830 | #define alc262_adc_nids alc882_adc_nids |
| 9831 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9832 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9833 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9834 | |
| 9835 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9836 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9837 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9838 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9839 | /* ADC0 */ |
| 9840 | 0x09 |
| 9841 | }; |
| 9842 | |
| 9843 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9844 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9845 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9846 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9847 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9848 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9849 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9850 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9851 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9852 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9853 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9854 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9855 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9856 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9857 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9858 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9859 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9860 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9861 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9862 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9863 | }; |
| 9864 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9865 | /* update HP, line and mono-out pins according to the master switch */ |
| 9866 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9867 | { |
| 9868 | struct alc_spec *spec = codec->spec; |
| 9869 | int val = spec->master_sw; |
| 9870 | |
| 9871 | /* HP & line-out */ |
| 9872 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9873 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9874 | val ? PIN_HP : 0); |
| 9875 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9876 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9877 | val ? PIN_HP : 0); |
| 9878 | /* mono (speaker) depending on the HP jack sense */ |
| 9879 | val = val && !spec->jack_present; |
| 9880 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9881 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9882 | val ? PIN_OUT : 0); |
| 9883 | } |
| 9884 | |
| 9885 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9886 | { |
| 9887 | struct alc_spec *spec = codec->spec; |
| 9888 | unsigned int presence; |
| 9889 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9890 | AC_VERB_GET_PIN_SENSE, 0); |
| 9891 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9892 | alc262_hp_master_update(codec); |
| 9893 | } |
| 9894 | |
| 9895 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9896 | { |
| 9897 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9898 | return; |
| 9899 | alc262_hp_bpc_automute(codec); |
| 9900 | } |
| 9901 | |
| 9902 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9903 | { |
| 9904 | struct alc_spec *spec = codec->spec; |
| 9905 | unsigned int presence; |
| 9906 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9907 | AC_VERB_GET_PIN_SENSE, 0); |
| 9908 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9909 | alc262_hp_master_update(codec); |
| 9910 | } |
| 9911 | |
| 9912 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9913 | unsigned int res) |
| 9914 | { |
| 9915 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9916 | return; |
| 9917 | alc262_hp_wildwest_automute(codec); |
| 9918 | } |
| 9919 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9920 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9921 | |
| 9922 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9923 | struct snd_ctl_elem_value *ucontrol) |
| 9924 | { |
| 9925 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9926 | struct alc_spec *spec = codec->spec; |
| 9927 | int val = !!*ucontrol->value.integer.value; |
| 9928 | |
| 9929 | if (val == spec->master_sw) |
| 9930 | return 0; |
| 9931 | spec->master_sw = val; |
| 9932 | alc262_hp_master_update(codec); |
| 9933 | return 1; |
| 9934 | } |
| 9935 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9936 | #define ALC262_HP_MASTER_SWITCH \ |
| 9937 | { \ |
| 9938 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9939 | .name = "Master Playback Switch", \ |
| 9940 | .info = snd_ctl_boolean_mono_info, \ |
| 9941 | .get = alc262_hp_master_sw_get, \ |
| 9942 | .put = alc262_hp_master_sw_put, \ |
| 9943 | } |
| 9944 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9945 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9946 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9947 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9948 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9949 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9950 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9951 | HDA_OUTPUT), |
| 9952 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9953 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9954 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9955 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9956 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9957 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9958 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9959 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9960 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9961 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9962 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9963 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9964 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9965 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9966 | { } /* end */ |
| 9967 | }; |
| 9968 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9969 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9970 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9971 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9972 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9973 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9974 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9975 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9976 | HDA_OUTPUT), |
| 9977 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9978 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9979 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9980 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9981 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9982 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9983 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9984 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9985 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9986 | { } /* end */ |
| 9987 | }; |
| 9988 | |
| 9989 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9990 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9991 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9992 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9993 | { } /* end */ |
| 9994 | }; |
| 9995 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9996 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9997 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9998 | { |
| 9999 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10000 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10001 | spec->autocfg.hp_pins[0] = 0x15; |
| 10002 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
| 10003 | alc_automute_amp(codec); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10004 | } |
| 10005 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10006 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10007 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10008 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10009 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10010 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10011 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10012 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10013 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10014 | { } /* end */ |
| 10015 | }; |
| 10016 | |
| 10017 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10018 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10019 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10020 | |
| 10021 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10022 | { } |
| 10023 | }; |
| 10024 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10025 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10026 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10027 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10028 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10029 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10030 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10031 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10032 | { } /* end */ |
| 10033 | }; |
| 10034 | |
| 10035 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10036 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10037 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10038 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10039 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10040 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10041 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10042 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10043 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10044 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10045 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10046 | {} |
| 10047 | }; |
| 10048 | |
| 10049 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10050 | .num_items = 1, |
| 10051 | .items = { |
| 10052 | { "Line", 0x1 }, |
| 10053 | }, |
| 10054 | }; |
| 10055 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10056 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10057 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10058 | { |
| 10059 | struct alc_spec *spec = codec->spec; |
| 10060 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10061 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10062 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10063 | unsigned int mute; |
| 10064 | |
| 10065 | /* HP */ |
| 10066 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10067 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10068 | HDA_AMP_MUTE, mute); |
| 10069 | /* mute internal speaker per jack sense */ |
| 10070 | if (spec->jack_present) |
| 10071 | mute = HDA_AMP_MUTE; |
| 10072 | if (line_nid) |
| 10073 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10074 | HDA_AMP_MUTE, mute); |
| 10075 | if (speaker_nid && speaker_nid != line_nid) |
| 10076 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10077 | HDA_AMP_MUTE, mute); |
| 10078 | } |
| 10079 | |
| 10080 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10081 | |
| 10082 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10083 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10084 | { |
| 10085 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10086 | struct alc_spec *spec = codec->spec; |
| 10087 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10088 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10089 | if (val == spec->master_sw) |
| 10090 | return 0; |
| 10091 | spec->master_sw = val; |
| 10092 | alc262_hippo_master_update(codec); |
| 10093 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10094 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10095 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10096 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10097 | { \ |
| 10098 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10099 | .name = "Master Playback Switch", \ |
| 10100 | .info = snd_ctl_boolean_mono_info, \ |
| 10101 | .get = alc262_hippo_master_sw_get, \ |
| 10102 | .put = alc262_hippo_master_sw_put, \ |
| 10103 | } |
| 10104 | |
| 10105 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10106 | ALC262_HIPPO_MASTER_SWITCH, |
| 10107 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10108 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10109 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10110 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10111 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10112 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10113 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10114 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10115 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10116 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10117 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10118 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10119 | { } /* end */ |
| 10120 | }; |
| 10121 | |
| 10122 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10123 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10124 | ALC262_HIPPO_MASTER_SWITCH, |
| 10125 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10126 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10128 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10130 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10131 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10132 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10133 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10134 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10135 | { } /* end */ |
| 10136 | }; |
| 10137 | |
| 10138 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10139 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10140 | { |
| 10141 | struct alc_spec *spec = codec->spec; |
| 10142 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10143 | unsigned int present; |
| 10144 | |
| 10145 | /* need to execute and sync at first */ |
| 10146 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10147 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 10148 | AC_VERB_GET_PIN_SENSE, 0); |
| 10149 | spec->jack_present = (present & 0x80000000) != 0; |
| 10150 | alc262_hippo_master_update(codec); |
| 10151 | } |
| 10152 | |
| 10153 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10154 | { |
| 10155 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10156 | return; |
| 10157 | alc262_hippo_automute(codec); |
| 10158 | } |
| 10159 | |
| 10160 | static void alc262_hippo_init_hook(struct hda_codec *codec) |
| 10161 | { |
| 10162 | struct alc_spec *spec = codec->spec; |
| 10163 | |
| 10164 | spec->autocfg.hp_pins[0] = 0x15; |
| 10165 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10166 | alc262_hippo_automute(codec); |
| 10167 | } |
| 10168 | |
| 10169 | static void alc262_hippo1_init_hook(struct hda_codec *codec) |
| 10170 | { |
| 10171 | struct alc_spec *spec = codec->spec; |
| 10172 | |
| 10173 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10174 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10175 | alc262_hippo_automute(codec); |
| 10176 | } |
| 10177 | |
| 10178 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10179 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10180 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10181 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10182 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10183 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10184 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10185 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10186 | { } /* end */ |
| 10187 | }; |
| 10188 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10189 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10190 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10191 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10192 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10193 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10194 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10195 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10196 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10197 | { } /* end */ |
| 10198 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10199 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10200 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10201 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10202 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10203 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10204 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10205 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10206 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10207 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10208 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10209 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10210 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10211 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10212 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10213 | { } /* end */ |
| 10214 | }; |
| 10215 | |
| 10216 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10217 | /* Headphone automute */ |
| 10218 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10219 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10220 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10221 | |
| 10222 | /* P11 AUX_IN, white 4-pin connector */ |
| 10223 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10224 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10225 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10226 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10227 | |
| 10228 | {} |
| 10229 | }; |
| 10230 | |
| 10231 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10232 | static void alc262_tyan_init_hook(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10233 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10234 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10235 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10236 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10237 | spec->autocfg.speaker_pins[0] = 0x15; |
| 10238 | alc_automute_amp(codec); |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10239 | } |
| 10240 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10241 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10242 | #define alc262_capture_mixer alc882_capture_mixer |
| 10243 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10244 | |
| 10245 | /* |
| 10246 | * generic initialization of ADC, input mixers and output mixers |
| 10247 | */ |
| 10248 | static struct hda_verb alc262_init_verbs[] = { |
| 10249 | /* |
| 10250 | * Unmute ADC0-2 and set the default input to mic-in |
| 10251 | */ |
| 10252 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10253 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10254 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10255 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10256 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10257 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10258 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10259 | /* 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] | 10260 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10261 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10262 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10263 | */ |
| 10264 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10265 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10266 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10267 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10268 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10269 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10270 | |
| 10271 | /* |
| 10272 | * Set up output mixers (0x0c - 0x0e) |
| 10273 | */ |
| 10274 | /* set vol=0 to output mixers */ |
| 10275 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10276 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10277 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10278 | /* set up input amps for analog loopback */ |
| 10279 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10280 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10281 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10282 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10283 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10284 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10285 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10286 | |
| 10287 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10288 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10289 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10290 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10291 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10292 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10293 | |
| 10294 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10295 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10296 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10297 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10298 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10299 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10300 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10301 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10302 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10303 | /* FIXME: use matrix-type input source selection */ |
| 10304 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10305 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10306 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10307 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10308 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10309 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10310 | /* Input mixer2 */ |
| 10311 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10312 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10313 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10314 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10315 | /* Input mixer3 */ |
| 10316 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10317 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10318 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10319 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10320 | |
| 10321 | { } |
| 10322 | }; |
| 10323 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10324 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10325 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10326 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10327 | { } |
| 10328 | }; |
| 10329 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10330 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 10331 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10332 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10333 | {} |
| 10334 | }; |
| 10335 | |
| 10336 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10337 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10338 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10339 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10340 | |
| 10341 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10342 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10343 | {} |
| 10344 | }; |
| 10345 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10346 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10347 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10348 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10349 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10350 | |
| 10351 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10352 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10353 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10354 | }; |
| 10355 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10356 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 10357 | .num_items = 2, |
| 10358 | .items = { |
| 10359 | { "Int DMic", 0x9 }, |
| 10360 | { "Mic", 0x0 }, |
| 10361 | }, |
| 10362 | }; |
| 10363 | |
| 10364 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10365 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10366 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10367 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10368 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10369 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10370 | { } /* end */ |
| 10371 | }; |
| 10372 | |
| 10373 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10374 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10375 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10376 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10377 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10378 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10379 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10380 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10381 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10382 | {} |
| 10383 | }; |
| 10384 | |
| 10385 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 10386 | { |
| 10387 | unsigned int present; |
| 10388 | |
| 10389 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10390 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10391 | snd_hda_codec_write(codec, 0x22, 0, |
| 10392 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 10393 | } |
| 10394 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10395 | |
| 10396 | /* unsolicited event for HP jack sensing */ |
| 10397 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 10398 | unsigned int res) |
| 10399 | { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10400 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10401 | alc262_dmic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10402 | else |
| 10403 | alc_sku_unsol_event(codec, res); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10404 | } |
| 10405 | |
| 10406 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 10407 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10408 | struct alc_spec *spec = codec->spec; |
| 10409 | |
| 10410 | spec->autocfg.hp_pins[0] = 0x15; |
| 10411 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10412 | alc_automute_pin(codec); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10413 | alc262_dmic_automute(codec); |
| 10414 | } |
| 10415 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10416 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10417 | * nec model |
| 10418 | * 0x15 = headphone |
| 10419 | * 0x16 = internal speaker |
| 10420 | * 0x18 = external mic |
| 10421 | */ |
| 10422 | |
| 10423 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10424 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10425 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10426 | |
| 10427 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10428 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10429 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10430 | |
| 10431 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10432 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10433 | { } /* end */ |
| 10434 | }; |
| 10435 | |
| 10436 | static struct hda_verb alc262_nec_verbs[] = { |
| 10437 | /* Unmute Speaker */ |
| 10438 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10439 | |
| 10440 | /* Headphone */ |
| 10441 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10442 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10443 | |
| 10444 | /* External mic to headphone */ |
| 10445 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10446 | /* External mic to speaker */ |
| 10447 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10448 | {} |
| 10449 | }; |
| 10450 | |
| 10451 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10452 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10453 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10454 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10455 | */ |
| 10456 | |
| 10457 | #define ALC_HP_EVENT 0x37 |
| 10458 | |
| 10459 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10460 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10461 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10462 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10463 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10464 | {} |
| 10465 | }; |
| 10466 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10467 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10468 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10469 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10470 | {} |
| 10471 | }; |
| 10472 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10473 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10474 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10475 | .items = { |
| 10476 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10477 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10478 | { "CD", 0x4 }, |
| 10479 | }, |
| 10480 | }; |
| 10481 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10482 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10483 | .num_items = 5, |
| 10484 | .items = { |
| 10485 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10486 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10487 | { "Line", 0x2 }, |
| 10488 | { "CD", 0x4 }, |
| 10489 | { "AUX IN", 0x6 }, |
| 10490 | }, |
| 10491 | }; |
| 10492 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10493 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10494 | .num_items = 4, |
| 10495 | .items = { |
| 10496 | { "Mic", 0x0 }, |
| 10497 | { "Front Mic", 0x2 }, |
| 10498 | { "Line", 0x1 }, |
| 10499 | { "CD", 0x4 }, |
| 10500 | }, |
| 10501 | }; |
| 10502 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10503 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10504 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10505 | { |
| 10506 | struct alc_spec *spec = codec->spec; |
| 10507 | unsigned int mute; |
| 10508 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10509 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10510 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10511 | /* need to execute and sync at first */ |
| 10512 | 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] | 10513 | /* check laptop HP jack */ |
| 10514 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10515 | AC_VERB_GET_PIN_SENSE, 0); |
| 10516 | /* need to execute and sync at first */ |
| 10517 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10518 | /* check docking HP jack */ |
| 10519 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10520 | AC_VERB_GET_PIN_SENSE, 0); |
| 10521 | if (present & AC_PINSENSE_PRESENCE) |
| 10522 | spec->jack_present = 1; |
| 10523 | else |
| 10524 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10525 | spec->sense_updated = 1; |
| 10526 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10527 | /* unmute internal speaker only if both HPs are unplugged and |
| 10528 | * master switch is on |
| 10529 | */ |
| 10530 | if (spec->jack_present) |
| 10531 | mute = HDA_AMP_MUTE; |
| 10532 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10533 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10534 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10535 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10536 | } |
| 10537 | |
| 10538 | /* unsolicited event for HP jack sensing */ |
| 10539 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10540 | unsigned int res) |
| 10541 | { |
| 10542 | if ((res >> 26) != ALC_HP_EVENT) |
| 10543 | return; |
| 10544 | alc262_fujitsu_automute(codec, 1); |
| 10545 | } |
| 10546 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10547 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10548 | { |
| 10549 | alc262_fujitsu_automute(codec, 1); |
| 10550 | } |
| 10551 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10552 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10553 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10554 | .ops = &snd_hda_bind_vol, |
| 10555 | .values = { |
| 10556 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10557 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10558 | 0 |
| 10559 | }, |
| 10560 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10561 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10562 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10563 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10564 | { |
| 10565 | struct alc_spec *spec = codec->spec; |
| 10566 | unsigned int mute; |
| 10567 | |
| 10568 | if (force || !spec->sense_updated) { |
| 10569 | unsigned int present_int_hp; |
| 10570 | /* need to execute and sync at first */ |
| 10571 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10572 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10573 | AC_VERB_GET_PIN_SENSE, 0); |
| 10574 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10575 | spec->sense_updated = 1; |
| 10576 | } |
| 10577 | if (spec->jack_present) { |
| 10578 | /* mute internal speaker */ |
| 10579 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10580 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10581 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10582 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10583 | } else { |
| 10584 | /* unmute internal speaker if necessary */ |
| 10585 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10586 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10587 | HDA_AMP_MUTE, mute); |
| 10588 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10589 | HDA_AMP_MUTE, mute); |
| 10590 | } |
| 10591 | } |
| 10592 | |
| 10593 | /* unsolicited event for HP jack sensing */ |
| 10594 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10595 | unsigned int res) |
| 10596 | { |
| 10597 | if ((res >> 26) != ALC_HP_EVENT) |
| 10598 | return; |
| 10599 | alc262_lenovo_3000_automute(codec, 1); |
| 10600 | } |
| 10601 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10602 | /* bind hp and internal speaker mute (with plug check) */ |
| 10603 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10604 | struct snd_ctl_elem_value *ucontrol) |
| 10605 | { |
| 10606 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10607 | long *valp = ucontrol->value.integer.value; |
| 10608 | int change; |
| 10609 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10610 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10611 | HDA_AMP_MUTE, |
| 10612 | valp ? 0 : HDA_AMP_MUTE); |
| 10613 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10614 | HDA_AMP_MUTE, |
| 10615 | valp ? 0 : HDA_AMP_MUTE); |
| 10616 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10617 | if (change) |
| 10618 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10619 | return change; |
| 10620 | } |
| 10621 | |
| 10622 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10623 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10624 | { |
| 10625 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10626 | .name = "Master Playback Switch", |
| 10627 | .info = snd_hda_mixer_amp_switch_info, |
| 10628 | .get = snd_hda_mixer_amp_switch_get, |
| 10629 | .put = alc262_fujitsu_master_sw_put, |
| 10630 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10631 | }, |
| 10632 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10633 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10634 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10635 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10636 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10637 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10638 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10639 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10640 | { } /* end */ |
| 10641 | }; |
| 10642 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10643 | /* bind hp and internal speaker mute (with plug check) */ |
| 10644 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10645 | struct snd_ctl_elem_value *ucontrol) |
| 10646 | { |
| 10647 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10648 | long *valp = ucontrol->value.integer.value; |
| 10649 | int change; |
| 10650 | |
| 10651 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10652 | HDA_AMP_MUTE, |
| 10653 | valp ? 0 : HDA_AMP_MUTE); |
| 10654 | |
| 10655 | if (change) |
| 10656 | alc262_lenovo_3000_automute(codec, 0); |
| 10657 | return change; |
| 10658 | } |
| 10659 | |
| 10660 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10661 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10662 | { |
| 10663 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10664 | .name = "Master Playback Switch", |
| 10665 | .info = snd_hda_mixer_amp_switch_info, |
| 10666 | .get = snd_hda_mixer_amp_switch_get, |
| 10667 | .put = alc262_lenovo_3000_master_sw_put, |
| 10668 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10669 | }, |
| 10670 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10671 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10672 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10673 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10674 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10675 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10676 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10677 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10678 | { } /* end */ |
| 10679 | }; |
| 10680 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10681 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10682 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10683 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10684 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10685 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10686 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10687 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10688 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10689 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10690 | { } /* end */ |
| 10691 | }; |
| 10692 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10693 | /* additional init verbs for Benq laptops */ |
| 10694 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10695 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10696 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10697 | {} |
| 10698 | }; |
| 10699 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10700 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10701 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10702 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10703 | |
| 10704 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10705 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10706 | {} |
| 10707 | }; |
| 10708 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10709 | /* Samsung Q1 Ultra Vista model setup */ |
| 10710 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10711 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10712 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10713 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10714 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10715 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10716 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10717 | { } /* end */ |
| 10718 | }; |
| 10719 | |
| 10720 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10721 | /* output mixer */ |
| 10722 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10723 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10724 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10725 | /* speaker */ |
| 10726 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10727 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10728 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10729 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10730 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10731 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10732 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10733 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10734 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10735 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10736 | /* internal mic */ |
| 10737 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10738 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10739 | /* ADC, choose mic */ |
| 10740 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10741 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10742 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10743 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10744 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10745 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10746 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10747 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10748 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10749 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10750 | {} |
| 10751 | }; |
| 10752 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10753 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10754 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10755 | { |
| 10756 | struct alc_spec *spec = codec->spec; |
| 10757 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10758 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10759 | mute = 0; |
| 10760 | /* auto-mute only when HP is used as HP */ |
| 10761 | if (!spec->cur_mux[0]) { |
| 10762 | unsigned int present; |
| 10763 | /* need to execute and sync at first */ |
| 10764 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10765 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10766 | AC_VERB_GET_PIN_SENSE, 0); |
| 10767 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10768 | if (spec->jack_present) |
| 10769 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10770 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10771 | /* mute/unmute internal speaker */ |
| 10772 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10773 | HDA_AMP_MUTE, mute); |
| 10774 | /* mute/unmute HP */ |
| 10775 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10776 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10777 | } |
| 10778 | |
| 10779 | /* unsolicited event for HP jack sensing */ |
| 10780 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10781 | unsigned int res) |
| 10782 | { |
| 10783 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10784 | return; |
| 10785 | alc262_ultra_automute(codec); |
| 10786 | } |
| 10787 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10788 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10789 | .num_items = 2, |
| 10790 | .items = { |
| 10791 | { "Mic", 0x1 }, |
| 10792 | { "Headphone", 0x7 }, |
| 10793 | }, |
| 10794 | }; |
| 10795 | |
| 10796 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10797 | struct snd_ctl_elem_value *ucontrol) |
| 10798 | { |
| 10799 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10800 | struct alc_spec *spec = codec->spec; |
| 10801 | int ret; |
| 10802 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10803 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10804 | if (!ret) |
| 10805 | return 0; |
| 10806 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10807 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10808 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10809 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10810 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10811 | return ret; |
| 10812 | } |
| 10813 | |
| 10814 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10815 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10816 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10817 | { |
| 10818 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10819 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10820 | .info = alc_mux_enum_info, |
| 10821 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10822 | .put = alc262_ultra_mux_enum_put, |
| 10823 | }, |
| 10824 | { } /* end */ |
| 10825 | }; |
| 10826 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10827 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10828 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10829 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10830 | { |
| 10831 | hda_nid_t nid; |
| 10832 | int err; |
| 10833 | |
| 10834 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10835 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10836 | spec->multiout.dac_nids[0] = 2; |
| 10837 | |
| 10838 | nid = cfg->line_out_pins[0]; |
| 10839 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10840 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10841 | "Front Playback Volume", |
| 10842 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10843 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10844 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10845 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10846 | "Front Playback Switch", |
| 10847 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10848 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10849 | return err; |
| 10850 | } |
| 10851 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10852 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10853 | if (nid) { |
| 10854 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10855 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10856 | "Speaker Playback Volume", |
| 10857 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10858 | HDA_OUTPUT)); |
| 10859 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10860 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10861 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10862 | "Speaker Playback Switch", |
| 10863 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10864 | HDA_OUTPUT)); |
| 10865 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10866 | return err; |
| 10867 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10868 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10869 | "Speaker Playback Switch", |
| 10870 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10871 | HDA_OUTPUT)); |
| 10872 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10873 | return err; |
| 10874 | } |
| 10875 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10876 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10877 | if (nid) { |
| 10878 | /* spec->multiout.hp_nid = 2; */ |
| 10879 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10880 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10881 | "Headphone Playback Volume", |
| 10882 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10883 | HDA_OUTPUT)); |
| 10884 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10885 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10886 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10887 | "Headphone Playback Switch", |
| 10888 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10889 | HDA_OUTPUT)); |
| 10890 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10891 | return err; |
| 10892 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10893 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10894 | "Headphone Playback Switch", |
| 10895 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10896 | HDA_OUTPUT)); |
| 10897 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10898 | return err; |
| 10899 | } |
| 10900 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10901 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10902 | } |
| 10903 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame^] | 10904 | static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10905 | const struct auto_pin_cfg *cfg) |
| 10906 | { |
| 10907 | int err; |
| 10908 | |
| 10909 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 10910 | if (err < 0) |
| 10911 | return err; |
| 10912 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 10913 | * because it's under 0x18 |
| 10914 | */ |
| 10915 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 10916 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 10917 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 10918 | imux->items[imux->num_items].label = "Int Mic"; |
| 10919 | imux->items[imux->num_items].index = 0x09; |
| 10920 | imux->num_items++; |
| 10921 | } |
| 10922 | return 0; |
| 10923 | } |
| 10924 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10925 | |
| 10926 | /* |
| 10927 | * generic initialization of ADC, input mixers and output mixers |
| 10928 | */ |
| 10929 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10930 | /* |
| 10931 | * Unmute ADC0-2 and set the default input to mic-in |
| 10932 | */ |
| 10933 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10934 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10935 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10936 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10937 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10938 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10939 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10940 | /* 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] | 10941 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10942 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10943 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10944 | */ |
| 10945 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10946 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10947 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10948 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10949 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10950 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10951 | |
| 10952 | /* |
| 10953 | * Set up output mixers (0x0c - 0x0f) |
| 10954 | */ |
| 10955 | /* set vol=0 to output mixers */ |
| 10956 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10957 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10958 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10959 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10960 | /* set up input amps for analog loopback */ |
| 10961 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10962 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10963 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10964 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10965 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10966 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10967 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10968 | |
| 10969 | /* FIXME: use matrix-type input source selection */ |
| 10970 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10971 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10972 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10973 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10974 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10975 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10976 | /* Input mixer2 */ |
| 10977 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10978 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10979 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10980 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10981 | /* Input mixer3 */ |
| 10982 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10983 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10984 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10985 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10986 | |
| 10987 | { } |
| 10988 | }; |
| 10989 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10990 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10991 | /* |
| 10992 | * Unmute ADC0-2 and set the default input to mic-in |
| 10993 | */ |
| 10994 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10995 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10996 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10997 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10998 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10999 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11000 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11001 | /* 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] | 11002 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11003 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11004 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11005 | */ |
| 11006 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11007 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11008 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11009 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11010 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11011 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11012 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11013 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11014 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11015 | /* |
| 11016 | * Set up output mixers (0x0c - 0x0e) |
| 11017 | */ |
| 11018 | /* set vol=0 to output mixers */ |
| 11019 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11020 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11021 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11022 | |
| 11023 | /* set up input amps for analog loopback */ |
| 11024 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11025 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11027 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11028 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11029 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11030 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11031 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11032 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11033 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11034 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11035 | |
| 11036 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11037 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11038 | |
| 11039 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11040 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11041 | |
| 11042 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11043 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11044 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11045 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11046 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11047 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11048 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11049 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11050 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11051 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11052 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11053 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11054 | |
| 11055 | |
| 11056 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11057 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11058 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11059 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11061 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11062 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11063 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11064 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11065 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11066 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11067 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11068 | /* Input mixer2 */ |
| 11069 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11070 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11071 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11072 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11073 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11074 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11075 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11076 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11077 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11078 | /* Input mixer3 */ |
| 11079 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11081 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11082 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11083 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11084 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11087 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11088 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11089 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11090 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11091 | { } |
| 11092 | }; |
| 11093 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11094 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11095 | /* |
| 11096 | * Unmute ADC0-2 and set the default input to mic-in |
| 11097 | */ |
| 11098 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11099 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11100 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11101 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11102 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11103 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11104 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11105 | /* 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] | 11106 | * mixer widget |
| 11107 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11108 | * panel mic (mic 2) |
| 11109 | */ |
| 11110 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11111 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11118 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11119 | /* |
| 11120 | * Set up output mixers (0x0c - 0x0e) |
| 11121 | */ |
| 11122 | /* set vol=0 to output mixers */ |
| 11123 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11124 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11125 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11126 | |
| 11127 | /* set up input amps for analog loopback */ |
| 11128 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11130 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11131 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11132 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11133 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11134 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11135 | |
| 11136 | |
| 11137 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11138 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11139 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11140 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11141 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11142 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11143 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11144 | |
| 11145 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11146 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11147 | |
| 11148 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11149 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11150 | |
| 11151 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11152 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11153 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11154 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11155 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11156 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11157 | |
| 11158 | /* FIXME: use matrix-type input source selection */ |
| 11159 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11160 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11161 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11162 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11163 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11164 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11165 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11166 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11167 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11168 | /* Input mixer2 */ |
| 11169 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11170 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11171 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11172 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11173 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11174 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11175 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11176 | /* Input mixer3 */ |
| 11177 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11178 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11179 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11180 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11181 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11182 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11183 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11184 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11185 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11186 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11187 | { } |
| 11188 | }; |
| 11189 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11190 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11191 | |
| 11192 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11193 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11194 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11195 | |
| 11196 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11197 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11198 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11199 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11200 | |
| 11201 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11202 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11203 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11204 | {} |
| 11205 | }; |
| 11206 | |
| 11207 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11208 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11209 | #define alc262_loopbacks alc880_loopbacks |
| 11210 | #endif |
| 11211 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11212 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11213 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11214 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11215 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11216 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11217 | |
| 11218 | /* |
| 11219 | * BIOS auto configuration |
| 11220 | */ |
| 11221 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11222 | { |
| 11223 | struct alc_spec *spec = codec->spec; |
| 11224 | int err; |
| 11225 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11226 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11227 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11228 | alc262_ignore); |
| 11229 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11230 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11231 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11232 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11233 | spec->multiout.max_channels = 2; |
| 11234 | spec->no_analog = 1; |
| 11235 | goto dig_only; |
| 11236 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11237 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11238 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11239 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11240 | if (err < 0) |
| 11241 | return err; |
| 11242 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11243 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11244 | return err; |
| 11245 | |
| 11246 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11247 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11248 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11249 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11250 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11251 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11252 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11253 | if (spec->autocfg.dig_in_pin) |
| 11254 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11255 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11256 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11257 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11258 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11259 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11260 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11261 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11262 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11263 | err = alc_auto_add_mic_boost(codec); |
| 11264 | if (err < 0) |
| 11265 | return err; |
| 11266 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11267 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11268 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11269 | return 1; |
| 11270 | } |
| 11271 | |
| 11272 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11273 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11274 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11275 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11276 | |
| 11277 | |
| 11278 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11279 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11280 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11281 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11282 | alc262_auto_init_multi_out(codec); |
| 11283 | alc262_auto_init_hp_out(codec); |
| 11284 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11285 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11286 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11287 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11288 | } |
| 11289 | |
| 11290 | /* |
| 11291 | * configuration and preset |
| 11292 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11293 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11294 | [ALC262_BASIC] = "basic", |
| 11295 | [ALC262_HIPPO] = "hippo", |
| 11296 | [ALC262_HIPPO_1] = "hippo_1", |
| 11297 | [ALC262_FUJITSU] = "fujitsu", |
| 11298 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11299 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11300 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11301 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11302 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11303 | [ALC262_BENQ_T31] = "benq-t31", |
| 11304 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11305 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11306 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11307 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11308 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11309 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11310 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11311 | [ALC262_AUTO] = "auto", |
| 11312 | }; |
| 11313 | |
| 11314 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11315 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11316 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11317 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11318 | ALC262_HP_BPC), |
| 11319 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11320 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11321 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11322 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11323 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11324 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11325 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11326 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11327 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11328 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11329 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11330 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11331 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11332 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11333 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11334 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11335 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11336 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11337 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11338 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11339 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11340 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11341 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11342 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11343 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11344 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11345 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11346 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11347 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11348 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11349 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11350 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11351 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11352 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11353 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11354 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11355 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11356 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11357 | {} |
| 11358 | }; |
| 11359 | |
| 11360 | static struct alc_config_preset alc262_presets[] = { |
| 11361 | [ALC262_BASIC] = { |
| 11362 | .mixers = { alc262_base_mixer }, |
| 11363 | .init_verbs = { alc262_init_verbs }, |
| 11364 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11365 | .dac_nids = alc262_dac_nids, |
| 11366 | .hp_nid = 0x03, |
| 11367 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11368 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11369 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11370 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11371 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11372 | .mixers = { alc262_hippo_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11373 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 11374 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11375 | .dac_nids = alc262_dac_nids, |
| 11376 | .hp_nid = 0x03, |
| 11377 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11378 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11379 | .channel_mode = alc262_modes, |
| 11380 | .input_mux = &alc262_capture_source, |
| 11381 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11382 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11383 | }, |
| 11384 | [ALC262_HIPPO_1] = { |
| 11385 | .mixers = { alc262_hippo1_mixer }, |
| 11386 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11387 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11388 | .dac_nids = alc262_dac_nids, |
| 11389 | .hp_nid = 0x02, |
| 11390 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11391 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11392 | .channel_mode = alc262_modes, |
| 11393 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11394 | .unsol_event = alc262_hippo_unsol_event, |
| 11395 | .init_hook = alc262_hippo1_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11396 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11397 | [ALC262_FUJITSU] = { |
| 11398 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11399 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11400 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11401 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11402 | .dac_nids = alc262_dac_nids, |
| 11403 | .hp_nid = 0x03, |
| 11404 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11405 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11406 | .channel_mode = alc262_modes, |
| 11407 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11408 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11409 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11410 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11411 | [ALC262_HP_BPC] = { |
| 11412 | .mixers = { alc262_HP_BPC_mixer }, |
| 11413 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11414 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11415 | .dac_nids = alc262_dac_nids, |
| 11416 | .hp_nid = 0x03, |
| 11417 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11418 | .channel_mode = alc262_modes, |
| 11419 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11420 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11421 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11422 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11423 | [ALC262_HP_BPC_D7000_WF] = { |
| 11424 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11425 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11426 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11427 | .dac_nids = alc262_dac_nids, |
| 11428 | .hp_nid = 0x03, |
| 11429 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11430 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11431 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11432 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11433 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11434 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11435 | [ALC262_HP_BPC_D7000_WL] = { |
| 11436 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11437 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11438 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11439 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11440 | .dac_nids = alc262_dac_nids, |
| 11441 | .hp_nid = 0x03, |
| 11442 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11443 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11444 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11445 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11446 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11447 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11448 | [ALC262_HP_TC_T5735] = { |
| 11449 | .mixers = { alc262_hp_t5735_mixer }, |
| 11450 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11451 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11452 | .dac_nids = alc262_dac_nids, |
| 11453 | .hp_nid = 0x03, |
| 11454 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11455 | .channel_mode = alc262_modes, |
| 11456 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11457 | .unsol_event = alc_automute_amp_unsol_event, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11458 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11459 | }, |
| 11460 | [ALC262_HP_RP5700] = { |
| 11461 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11462 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11463 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11464 | .dac_nids = alc262_dac_nids, |
| 11465 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11466 | .channel_mode = alc262_modes, |
| 11467 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11468 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11469 | [ALC262_BENQ_ED8] = { |
| 11470 | .mixers = { alc262_base_mixer }, |
| 11471 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11472 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11473 | .dac_nids = alc262_dac_nids, |
| 11474 | .hp_nid = 0x03, |
| 11475 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11476 | .channel_mode = alc262_modes, |
| 11477 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11478 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11479 | [ALC262_SONY_ASSAMD] = { |
| 11480 | .mixers = { alc262_sony_mixer }, |
| 11481 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11482 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11483 | .dac_nids = alc262_dac_nids, |
| 11484 | .hp_nid = 0x02, |
| 11485 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11486 | .channel_mode = alc262_modes, |
| 11487 | .input_mux = &alc262_capture_source, |
| 11488 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11489 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11490 | }, |
| 11491 | [ALC262_BENQ_T31] = { |
| 11492 | .mixers = { alc262_benq_t31_mixer }, |
| 11493 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 11494 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11495 | .dac_nids = alc262_dac_nids, |
| 11496 | .hp_nid = 0x03, |
| 11497 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11498 | .channel_mode = alc262_modes, |
| 11499 | .input_mux = &alc262_capture_source, |
| 11500 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11501 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11502 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11503 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11504 | .mixers = { alc262_ultra_mixer }, |
| 11505 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11506 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11507 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11508 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11509 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11510 | .channel_mode = alc262_modes, |
| 11511 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11512 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11513 | .capsrc_nids = alc262_capsrc_nids, |
| 11514 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11515 | .unsol_event = alc262_ultra_unsol_event, |
| 11516 | .init_hook = alc262_ultra_automute, |
| 11517 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11518 | [ALC262_LENOVO_3000] = { |
| 11519 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11520 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11521 | alc262_lenovo_3000_unsol_verbs }, |
| 11522 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11523 | .dac_nids = alc262_dac_nids, |
| 11524 | .hp_nid = 0x03, |
| 11525 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11526 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11527 | .channel_mode = alc262_modes, |
| 11528 | .input_mux = &alc262_fujitsu_capture_source, |
| 11529 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11530 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11531 | [ALC262_NEC] = { |
| 11532 | .mixers = { alc262_nec_mixer }, |
| 11533 | .init_verbs = { alc262_nec_verbs }, |
| 11534 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11535 | .dac_nids = alc262_dac_nids, |
| 11536 | .hp_nid = 0x03, |
| 11537 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11538 | .channel_mode = alc262_modes, |
| 11539 | .input_mux = &alc262_capture_source, |
| 11540 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11541 | [ALC262_TOSHIBA_S06] = { |
| 11542 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11543 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11544 | alc262_eapd_verbs }, |
| 11545 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11546 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11547 | .dac_nids = alc262_dac_nids, |
| 11548 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11549 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11550 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11551 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11552 | .channel_mode = alc262_modes, |
| 11553 | .input_mux = &alc262_dmic_capture_source, |
| 11554 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11555 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11556 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11557 | [ALC262_TOSHIBA_RX1] = { |
| 11558 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11559 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_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 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11567 | .init_hook = alc262_hippo_init_hook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11568 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11569 | [ALC262_TYAN] = { |
| 11570 | .mixers = { alc262_tyan_mixer }, |
| 11571 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11572 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11573 | .dac_nids = alc262_dac_nids, |
| 11574 | .hp_nid = 0x02, |
| 11575 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11576 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11577 | .channel_mode = alc262_modes, |
| 11578 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11579 | .unsol_event = alc_automute_amp_unsol_event, |
| 11580 | .init_hook = alc262_tyan_init_hook, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11581 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11582 | }; |
| 11583 | |
| 11584 | static int patch_alc262(struct hda_codec *codec) |
| 11585 | { |
| 11586 | struct alc_spec *spec; |
| 11587 | int board_config; |
| 11588 | int err; |
| 11589 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11590 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11591 | if (spec == NULL) |
| 11592 | return -ENOMEM; |
| 11593 | |
| 11594 | codec->spec = spec; |
| 11595 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11596 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11597 | * under-run |
| 11598 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11599 | { |
| 11600 | int tmp; |
| 11601 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11602 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11603 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11604 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11605 | } |
| 11606 | #endif |
| 11607 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11608 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11609 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11610 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11611 | alc262_models, |
| 11612 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11613 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11614 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 11615 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 11616 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11617 | board_config = ALC262_AUTO; |
| 11618 | } |
| 11619 | |
| 11620 | if (board_config == ALC262_AUTO) { |
| 11621 | /* automatic parse from the BIOS config */ |
| 11622 | err = alc262_parse_auto_config(codec); |
| 11623 | if (err < 0) { |
| 11624 | alc_free(codec); |
| 11625 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11626 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11627 | printk(KERN_INFO |
| 11628 | "hda_codec: Cannot set up configuration " |
| 11629 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11630 | board_config = ALC262_BASIC; |
| 11631 | } |
| 11632 | } |
| 11633 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11634 | if (!spec->no_analog) { |
| 11635 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11636 | if (err < 0) { |
| 11637 | alc_free(codec); |
| 11638 | return err; |
| 11639 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11640 | } |
| 11641 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11642 | if (board_config != ALC262_AUTO) |
| 11643 | setup_preset(spec, &alc262_presets[board_config]); |
| 11644 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11645 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11646 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11647 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11648 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11649 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11650 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11651 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame^] | 11652 | int i; |
| 11653 | /* check whether the digital-mic has to be supported */ |
| 11654 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11655 | if (spec->input_mux->items[i].index >= 9) |
| 11656 | break; |
| 11657 | } |
| 11658 | if (i < spec->input_mux->num_items) { |
| 11659 | /* use only ADC0 */ |
| 11660 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11661 | spec->num_adc_nids = 1; |
| 11662 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11663 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame^] | 11664 | /* all analog inputs */ |
| 11665 | /* check whether NID 0x07 is valid */ |
| 11666 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11667 | |
| 11668 | /* get type */ |
| 11669 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 11670 | if (wcap != AC_WID_AUD_IN) { |
| 11671 | spec->adc_nids = alc262_adc_nids_alt; |
| 11672 | spec->num_adc_nids = |
| 11673 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11674 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11675 | } else { |
| 11676 | spec->adc_nids = alc262_adc_nids; |
| 11677 | spec->num_adc_nids = |
| 11678 | ARRAY_SIZE(alc262_adc_nids); |
| 11679 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11680 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11681 | } |
| 11682 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11683 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11684 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11685 | if (!spec->no_analog) |
| 11686 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11687 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11688 | spec->vmaster_nid = 0x0c; |
| 11689 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11690 | codec->patch_ops = alc_patch_ops; |
| 11691 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11692 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11693 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11694 | if (!spec->loopback.amplist) |
| 11695 | spec->loopback.amplist = alc262_loopbacks; |
| 11696 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11697 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11698 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11699 | return 0; |
| 11700 | } |
| 11701 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11702 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11703 | * ALC268 channel source setting (2 channel) |
| 11704 | */ |
| 11705 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11706 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11707 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11708 | static hda_nid_t alc268_dac_nids[2] = { |
| 11709 | /* front, hp */ |
| 11710 | 0x02, 0x03 |
| 11711 | }; |
| 11712 | |
| 11713 | static hda_nid_t alc268_adc_nids[2] = { |
| 11714 | /* ADC0-1 */ |
| 11715 | 0x08, 0x07 |
| 11716 | }; |
| 11717 | |
| 11718 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11719 | /* ADC0 */ |
| 11720 | 0x08 |
| 11721 | }; |
| 11722 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11723 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11724 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11725 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11726 | /* output mixer control */ |
| 11727 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11728 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11729 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11730 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11731 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11732 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11733 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11734 | { } |
| 11735 | }; |
| 11736 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11737 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11738 | /* output mixer control */ |
| 11739 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11740 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11741 | ALC262_HIPPO_MASTER_SWITCH, |
| 11742 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11743 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11744 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11745 | { } |
| 11746 | }; |
| 11747 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11748 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11749 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11750 | .ops = &snd_hda_bind_sw, |
| 11751 | .values = { |
| 11752 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11753 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11754 | 0 |
| 11755 | }, |
| 11756 | }; |
| 11757 | |
| 11758 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11759 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11760 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11761 | { } |
| 11762 | }; |
| 11763 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11764 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11765 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11766 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11767 | { } |
| 11768 | }; |
| 11769 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11770 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11771 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11772 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11773 | { } /* end */ |
| 11774 | }; |
| 11775 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11776 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11777 | .num_items = 2, |
| 11778 | .items = { |
| 11779 | { "i-Mic", 0x6 }, |
| 11780 | { "E-Mic", 0x0 }, |
| 11781 | }, |
| 11782 | }; |
| 11783 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11784 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11785 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11786 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11787 | .ops = &snd_hda_bind_vol, |
| 11788 | .values = { |
| 11789 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11790 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11791 | 0 |
| 11792 | }, |
| 11793 | }; |
| 11794 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11795 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11796 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11797 | { |
| 11798 | struct alc_spec *spec = codec->spec; |
| 11799 | unsigned int mute; |
| 11800 | |
| 11801 | if (force || !spec->sense_updated) { |
| 11802 | unsigned int present; |
| 11803 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11804 | AC_VERB_GET_PIN_SENSE, 0); |
| 11805 | spec->jack_present = (present & 0x80000000) != 0; |
| 11806 | spec->sense_updated = 1; |
| 11807 | } |
| 11808 | if (spec->jack_present) |
| 11809 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11810 | else /* unmute internal speaker if necessary */ |
| 11811 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11812 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11813 | HDA_AMP_MUTE, mute); |
| 11814 | } |
| 11815 | |
| 11816 | |
| 11817 | /* bind hp and internal speaker mute (with plug check) */ |
| 11818 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11819 | struct snd_ctl_elem_value *ucontrol) |
| 11820 | { |
| 11821 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11822 | long *valp = ucontrol->value.integer.value; |
| 11823 | int change; |
| 11824 | |
| 11825 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11826 | HDA_AMP_MUTE, |
| 11827 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11828 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11829 | HDA_AMP_MUTE, |
| 11830 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11831 | if (change) |
| 11832 | alc268_acer_automute(codec, 0); |
| 11833 | return change; |
| 11834 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11835 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11836 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11837 | /* output mixer control */ |
| 11838 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11839 | { |
| 11840 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11841 | .name = "Master Playback Switch", |
| 11842 | .info = snd_hda_mixer_amp_switch_info, |
| 11843 | .get = snd_hda_mixer_amp_switch_get, |
| 11844 | .put = alc268_acer_master_sw_put, |
| 11845 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11846 | }, |
| 11847 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11848 | { } |
| 11849 | }; |
| 11850 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11851 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11852 | /* output mixer control */ |
| 11853 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11854 | { |
| 11855 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11856 | .name = "Master Playback Switch", |
| 11857 | .info = snd_hda_mixer_amp_switch_info, |
| 11858 | .get = snd_hda_mixer_amp_switch_get, |
| 11859 | .put = alc268_acer_master_sw_put, |
| 11860 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11861 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11862 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11863 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11864 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11865 | { } |
| 11866 | }; |
| 11867 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11868 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11869 | /* output mixer control */ |
| 11870 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11871 | { |
| 11872 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11873 | .name = "Master Playback Switch", |
| 11874 | .info = snd_hda_mixer_amp_switch_info, |
| 11875 | .get = snd_hda_mixer_amp_switch_get, |
| 11876 | .put = alc268_acer_master_sw_put, |
| 11877 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11878 | }, |
| 11879 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11880 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11881 | { } |
| 11882 | }; |
| 11883 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11884 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11885 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11886 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11887 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11888 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11889 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11890 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11891 | { } |
| 11892 | }; |
| 11893 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11894 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11895 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11896 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11897 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11898 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11899 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11900 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11901 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11902 | { } |
| 11903 | }; |
| 11904 | |
| 11905 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11906 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
| 11907 | #define alc268_toshiba_init_hook alc262_hippo_init_hook |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11908 | |
| 11909 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11910 | unsigned int res) |
| 11911 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11912 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11913 | return; |
| 11914 | alc268_acer_automute(codec, 1); |
| 11915 | } |
| 11916 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11917 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11918 | { |
| 11919 | alc268_acer_automute(codec, 1); |
| 11920 | } |
| 11921 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11922 | /* toggle speaker-output according to the hp-jack state */ |
| 11923 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11924 | { |
| 11925 | unsigned int present; |
| 11926 | unsigned char bits; |
| 11927 | |
| 11928 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11929 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11930 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11931 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11932 | AMP_IN_MUTE(0), bits); |
| 11933 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11934 | AMP_IN_MUTE(0), bits); |
| 11935 | } |
| 11936 | |
| 11937 | |
| 11938 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11939 | { |
| 11940 | unsigned int present; |
| 11941 | |
| 11942 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11943 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11944 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11945 | present ? 0x0 : 0x6); |
| 11946 | } |
| 11947 | |
| 11948 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11949 | unsigned int res) |
| 11950 | { |
| 11951 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11952 | alc268_aspire_one_speaker_automute(codec); |
| 11953 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11954 | alc268_acer_mic_automute(codec); |
| 11955 | } |
| 11956 | |
| 11957 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11958 | { |
| 11959 | alc268_aspire_one_speaker_automute(codec); |
| 11960 | alc268_acer_mic_automute(codec); |
| 11961 | } |
| 11962 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11963 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11964 | /* output mixer control */ |
| 11965 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11966 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11967 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11968 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11969 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11970 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11971 | { } |
| 11972 | }; |
| 11973 | |
| 11974 | static struct hda_verb alc268_dell_verbs[] = { |
| 11975 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11976 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11977 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11978 | { } |
| 11979 | }; |
| 11980 | |
| 11981 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11982 | static void alc268_dell_init_hook(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11983 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11984 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11985 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11986 | spec->autocfg.hp_pins[0] = 0x15; |
| 11987 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11988 | alc_automute_pin(codec); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11989 | } |
| 11990 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11991 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11992 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11993 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11994 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11995 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11996 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11997 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11998 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11999 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12000 | { } |
| 12001 | }; |
| 12002 | |
| 12003 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12004 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12005 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12006 | { } |
| 12007 | }; |
| 12008 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12009 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 12010 | { |
| 12011 | unsigned int present; |
| 12012 | |
| 12013 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12014 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12015 | snd_hda_codec_write(codec, 0x23, 0, |
| 12016 | AC_VERB_SET_CONNECT_SEL, |
| 12017 | present ? 0x00 : 0x01); |
| 12018 | } |
| 12019 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12020 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12021 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12022 | struct alc_spec *spec = codec->spec; |
| 12023 | |
| 12024 | spec->autocfg.hp_pins[0] = 0x15; |
| 12025 | spec->autocfg.speaker_pins[0] = 0x14; |
| 12026 | alc_automute_pin(codec); |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12027 | alc267_quanta_il1_mic_automute(codec); |
| 12028 | } |
| 12029 | |
| 12030 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 12031 | unsigned int res) |
| 12032 | { |
| 12033 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12034 | case ALC880_MIC_EVENT: |
| 12035 | alc267_quanta_il1_mic_automute(codec); |
| 12036 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12037 | default: |
| 12038 | alc_sku_unsol_event(codec, res); |
| 12039 | break; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12040 | } |
| 12041 | } |
| 12042 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12043 | /* |
| 12044 | * generic initialization of ADC, input mixers and output mixers |
| 12045 | */ |
| 12046 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12047 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12048 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12049 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12050 | |
| 12051 | /* |
| 12052 | * Set up output mixers (0x0c - 0x0e) |
| 12053 | */ |
| 12054 | /* set vol=0 to output mixers */ |
| 12055 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12056 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12057 | |
| 12058 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12059 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12060 | |
| 12061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12062 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12063 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12064 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12065 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12066 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12067 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12068 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12069 | |
| 12070 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12071 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12072 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12073 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12074 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12075 | |
| 12076 | /* set PCBEEP vol = 0, mute connections */ |
| 12077 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12078 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12079 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12080 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12081 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12082 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12083 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12084 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12085 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12086 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12087 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12088 | { } |
| 12089 | }; |
| 12090 | |
| 12091 | /* |
| 12092 | * generic initialization of ADC, input mixers and output mixers |
| 12093 | */ |
| 12094 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12095 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12096 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12097 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12098 | |
| 12099 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12100 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12101 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12102 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12103 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12104 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12105 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12106 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12107 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12108 | |
| 12109 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12110 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12111 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12112 | /* set PCBEEP vol = 0, mute connections */ |
| 12113 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12114 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12115 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12116 | |
| 12117 | { } |
| 12118 | }; |
| 12119 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12120 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12121 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12122 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12123 | { |
| 12124 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12125 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12126 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12127 | */ |
| 12128 | /* .name = "Capture Source", */ |
| 12129 | .name = "Input Source", |
| 12130 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12131 | .info = alc_mux_enum_info, |
| 12132 | .get = alc_mux_enum_get, |
| 12133 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12134 | }, |
| 12135 | { } /* end */ |
| 12136 | }; |
| 12137 | |
| 12138 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12139 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12140 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12141 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12142 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12143 | { |
| 12144 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12145 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12146 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12147 | */ |
| 12148 | /* .name = "Capture Source", */ |
| 12149 | .name = "Input Source", |
| 12150 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12151 | .info = alc_mux_enum_info, |
| 12152 | .get = alc_mux_enum_get, |
| 12153 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12154 | }, |
| 12155 | { } /* end */ |
| 12156 | }; |
| 12157 | |
| 12158 | static struct hda_input_mux alc268_capture_source = { |
| 12159 | .num_items = 4, |
| 12160 | .items = { |
| 12161 | { "Mic", 0x0 }, |
| 12162 | { "Front Mic", 0x1 }, |
| 12163 | { "Line", 0x2 }, |
| 12164 | { "CD", 0x3 }, |
| 12165 | }, |
| 12166 | }; |
| 12167 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12168 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12169 | .num_items = 3, |
| 12170 | .items = { |
| 12171 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12172 | { "Internal Mic", 0x1 }, |
| 12173 | { "Line", 0x2 }, |
| 12174 | }, |
| 12175 | }; |
| 12176 | |
| 12177 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12178 | .num_items = 3, |
| 12179 | .items = { |
| 12180 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12181 | { "Internal Mic", 0x6 }, |
| 12182 | { "Line", 0x2 }, |
| 12183 | }, |
| 12184 | }; |
| 12185 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12186 | #ifdef CONFIG_SND_DEBUG |
| 12187 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12188 | /* Volume widgets */ |
| 12189 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12190 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12191 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12192 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12193 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12194 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12195 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12196 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12197 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12198 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12199 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12200 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12201 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12202 | /* The below appears problematic on some hardwares */ |
| 12203 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12204 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12205 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12206 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12207 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12208 | |
| 12209 | /* Modes for retasking pin widgets */ |
| 12210 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12211 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12212 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12213 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12214 | |
| 12215 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12216 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12217 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12218 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12219 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12220 | |
| 12221 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12222 | * The ALC268 does not have an SPDIF input. |
| 12223 | */ |
| 12224 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12225 | |
| 12226 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12227 | * this output to turn on an external amplifier. |
| 12228 | */ |
| 12229 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12230 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12231 | |
| 12232 | { } /* end */ |
| 12233 | }; |
| 12234 | #endif |
| 12235 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12236 | /* create input playback/capture controls for the given pin */ |
| 12237 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12238 | const char *ctlname, int idx) |
| 12239 | { |
| 12240 | char name[32]; |
| 12241 | int err; |
| 12242 | |
| 12243 | sprintf(name, "%s Playback Volume", ctlname); |
| 12244 | if (nid == 0x14) { |
| 12245 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12246 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 12247 | HDA_OUTPUT)); |
| 12248 | if (err < 0) |
| 12249 | return err; |
| 12250 | } else if (nid == 0x15) { |
| 12251 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12252 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 12253 | HDA_OUTPUT)); |
| 12254 | if (err < 0) |
| 12255 | return err; |
| 12256 | } else |
| 12257 | return -1; |
| 12258 | sprintf(name, "%s Playback Switch", ctlname); |
| 12259 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12260 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 12261 | if (err < 0) |
| 12262 | return err; |
| 12263 | return 0; |
| 12264 | } |
| 12265 | |
| 12266 | /* add playback controls from the parsed DAC table */ |
| 12267 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12268 | const struct auto_pin_cfg *cfg) |
| 12269 | { |
| 12270 | hda_nid_t nid; |
| 12271 | int err; |
| 12272 | |
| 12273 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 12274 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12275 | spec->multiout.dac_nids[0] = 2; |
| 12276 | spec->multiout.dac_nids[1] = 3; |
| 12277 | |
| 12278 | nid = cfg->line_out_pins[0]; |
| 12279 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12280 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12281 | |
| 12282 | nid = cfg->speaker_pins[0]; |
| 12283 | if (nid == 0x1d) { |
| 12284 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12285 | "Speaker Playback Volume", |
| 12286 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12287 | if (err < 0) |
| 12288 | return err; |
| 12289 | } |
| 12290 | nid = cfg->hp_pins[0]; |
| 12291 | if (nid) |
| 12292 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12293 | |
| 12294 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12295 | if (nid == 0x16) { |
| 12296 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12297 | "Mono Playback Switch", |
| 12298 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 12299 | if (err < 0) |
| 12300 | return err; |
| 12301 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12302 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12303 | } |
| 12304 | |
| 12305 | /* create playback/capture controls for input pins */ |
| 12306 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12307 | const struct auto_pin_cfg *cfg) |
| 12308 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12309 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12310 | int i, idx1; |
| 12311 | |
| 12312 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12313 | switch(cfg->input_pins[i]) { |
| 12314 | case 0x18: |
| 12315 | idx1 = 0; /* Mic 1 */ |
| 12316 | break; |
| 12317 | case 0x19: |
| 12318 | idx1 = 1; /* Mic 2 */ |
| 12319 | break; |
| 12320 | case 0x1a: |
| 12321 | idx1 = 2; /* Line In */ |
| 12322 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12323 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12324 | idx1 = 3; /* CD */ |
| 12325 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 12326 | case 0x12: |
| 12327 | case 0x13: |
| 12328 | idx1 = 6; /* digital mics */ |
| 12329 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12330 | default: |
| 12331 | continue; |
| 12332 | } |
| 12333 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 12334 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12335 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12336 | } |
| 12337 | return 0; |
| 12338 | } |
| 12339 | |
| 12340 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12341 | { |
| 12342 | struct alc_spec *spec = codec->spec; |
| 12343 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12344 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12345 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12346 | unsigned int dac_vol1, dac_vol2; |
| 12347 | |
| 12348 | if (speaker_nid) { |
| 12349 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12350 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 12351 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12352 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12353 | AMP_IN_UNMUTE(1)); |
| 12354 | snd_hda_codec_write(codec, 0x10, 0, |
| 12355 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12356 | AMP_IN_UNMUTE(1)); |
| 12357 | } else { |
| 12358 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12359 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12360 | snd_hda_codec_write(codec, 0x10, 0, |
| 12361 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12362 | } |
| 12363 | |
| 12364 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12365 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12366 | dac_vol2 = AMP_OUT_ZERO; |
| 12367 | else if (line_nid == 0x15) |
| 12368 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12369 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12370 | dac_vol2 = AMP_OUT_ZERO; |
| 12371 | else if (hp_nid == 0x15) |
| 12372 | dac_vol1 = AMP_OUT_ZERO; |
| 12373 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12374 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12375 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12376 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12377 | |
| 12378 | snd_hda_codec_write(codec, 0x02, 0, |
| 12379 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12380 | snd_hda_codec_write(codec, 0x03, 0, |
| 12381 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12382 | } |
| 12383 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12384 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12385 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12386 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12387 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12388 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12389 | |
| 12390 | /* |
| 12391 | * BIOS auto configuration |
| 12392 | */ |
| 12393 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12394 | { |
| 12395 | struct alc_spec *spec = codec->spec; |
| 12396 | int err; |
| 12397 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12398 | |
| 12399 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12400 | alc268_ignore); |
| 12401 | if (err < 0) |
| 12402 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12403 | if (!spec->autocfg.line_outs) { |
| 12404 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12405 | spec->multiout.max_channels = 2; |
| 12406 | spec->no_analog = 1; |
| 12407 | goto dig_only; |
| 12408 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12409 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12410 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12411 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12412 | if (err < 0) |
| 12413 | return err; |
| 12414 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12415 | if (err < 0) |
| 12416 | return err; |
| 12417 | |
| 12418 | spec->multiout.max_channels = 2; |
| 12419 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12420 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12421 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12422 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12423 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12424 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12425 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12426 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12427 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12428 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12429 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12430 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12431 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12432 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12433 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12434 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12435 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12436 | err = alc_auto_add_mic_boost(codec); |
| 12437 | if (err < 0) |
| 12438 | return err; |
| 12439 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12440 | return 1; |
| 12441 | } |
| 12442 | |
| 12443 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12444 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12445 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12446 | |
| 12447 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12448 | static void alc268_auto_init(struct hda_codec *codec) |
| 12449 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12450 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12451 | alc268_auto_init_multi_out(codec); |
| 12452 | alc268_auto_init_hp_out(codec); |
| 12453 | alc268_auto_init_mono_speaker_out(codec); |
| 12454 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12455 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12456 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12457 | } |
| 12458 | |
| 12459 | /* |
| 12460 | * configuration and preset |
| 12461 | */ |
| 12462 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12463 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12464 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12465 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12466 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12467 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12468 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12469 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12470 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12471 | #ifdef CONFIG_SND_DEBUG |
| 12472 | [ALC268_TEST] = "test", |
| 12473 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12474 | [ALC268_AUTO] = "auto", |
| 12475 | }; |
| 12476 | |
| 12477 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12478 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12479 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12480 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12481 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12482 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12483 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12484 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12485 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12486 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12487 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
| 12488 | ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12489 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12490 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
| 12491 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12492 | ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12493 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12494 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12495 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12496 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12497 | {} |
| 12498 | }; |
| 12499 | |
| 12500 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12501 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12502 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12503 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12504 | alc267_quanta_il1_verbs }, |
| 12505 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12506 | .dac_nids = alc268_dac_nids, |
| 12507 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12508 | .adc_nids = alc268_adc_nids_alt, |
| 12509 | .hp_nid = 0x03, |
| 12510 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12511 | .channel_mode = alc268_modes, |
| 12512 | .input_mux = &alc268_capture_source, |
| 12513 | .unsol_event = alc267_quanta_il1_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12514 | .init_hook = alc267_quanta_il1_init_hook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12515 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12516 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12517 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12518 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12519 | .init_verbs = { alc268_base_init_verbs }, |
| 12520 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12521 | .dac_nids = alc268_dac_nids, |
| 12522 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12523 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12524 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12525 | .hp_nid = 0x03, |
| 12526 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12527 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12528 | .channel_mode = alc268_modes, |
| 12529 | .input_mux = &alc268_capture_source, |
| 12530 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12531 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12532 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12533 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12534 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12535 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12536 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12537 | .dac_nids = alc268_dac_nids, |
| 12538 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12539 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12540 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12541 | .hp_nid = 0x03, |
| 12542 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12543 | .channel_mode = alc268_modes, |
| 12544 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12545 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12546 | .init_hook = alc268_toshiba_init_hook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12547 | }, |
| 12548 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12549 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12550 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12551 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12552 | alc268_acer_verbs }, |
| 12553 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12554 | .dac_nids = alc268_dac_nids, |
| 12555 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12556 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12557 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12558 | .hp_nid = 0x02, |
| 12559 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12560 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12561 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12562 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12563 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12564 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12565 | [ALC268_ACER_DMIC] = { |
| 12566 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12567 | alc268_beep_mixer }, |
| 12568 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12569 | alc268_acer_verbs }, |
| 12570 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12571 | .dac_nids = alc268_dac_nids, |
| 12572 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12573 | .adc_nids = alc268_adc_nids_alt, |
| 12574 | .capsrc_nids = alc268_capsrc_nids, |
| 12575 | .hp_nid = 0x02, |
| 12576 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12577 | .channel_mode = alc268_modes, |
| 12578 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12579 | .unsol_event = alc268_acer_unsol_event, |
| 12580 | .init_hook = alc268_acer_init_hook, |
| 12581 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12582 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12583 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12584 | alc268_beep_mixer, |
| 12585 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12586 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12587 | alc268_acer_aspire_one_verbs }, |
| 12588 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12589 | .dac_nids = alc268_dac_nids, |
| 12590 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12591 | .adc_nids = alc268_adc_nids_alt, |
| 12592 | .capsrc_nids = alc268_capsrc_nids, |
| 12593 | .hp_nid = 0x03, |
| 12594 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12595 | .channel_mode = alc268_modes, |
| 12596 | .input_mux = &alc268_acer_lc_capture_source, |
| 12597 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12598 | .init_hook = alc268_acer_lc_init_hook, |
| 12599 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12600 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12601 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12602 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12603 | alc268_dell_verbs }, |
| 12604 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12605 | .dac_nids = alc268_dac_nids, |
| 12606 | .hp_nid = 0x02, |
| 12607 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12608 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12609 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12610 | .init_hook = alc268_dell_init_hook, |
| 12611 | .input_mux = &alc268_capture_source, |
| 12612 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12613 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12614 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12615 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12616 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12617 | alc268_toshiba_verbs }, |
| 12618 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12619 | .dac_nids = alc268_dac_nids, |
| 12620 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12621 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12622 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12623 | .hp_nid = 0x03, |
| 12624 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12625 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12626 | .channel_mode = alc268_modes, |
| 12627 | .input_mux = &alc268_capture_source, |
| 12628 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12629 | .init_hook = alc268_toshiba_init_hook |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12630 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12631 | #ifdef CONFIG_SND_DEBUG |
| 12632 | [ALC268_TEST] = { |
| 12633 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12634 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12635 | alc268_volume_init_verbs }, |
| 12636 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12637 | .dac_nids = alc268_dac_nids, |
| 12638 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12639 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12640 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12641 | .hp_nid = 0x03, |
| 12642 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12643 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12644 | .channel_mode = alc268_modes, |
| 12645 | .input_mux = &alc268_capture_source, |
| 12646 | }, |
| 12647 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12648 | }; |
| 12649 | |
| 12650 | static int patch_alc268(struct hda_codec *codec) |
| 12651 | { |
| 12652 | struct alc_spec *spec; |
| 12653 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12654 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12655 | |
| 12656 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12657 | if (spec == NULL) |
| 12658 | return -ENOMEM; |
| 12659 | |
| 12660 | codec->spec = spec; |
| 12661 | |
| 12662 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12663 | alc268_models, |
| 12664 | alc268_cfg_tbl); |
| 12665 | |
| 12666 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 12667 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 12668 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12669 | board_config = ALC268_AUTO; |
| 12670 | } |
| 12671 | |
| 12672 | if (board_config == ALC268_AUTO) { |
| 12673 | /* automatic parse from the BIOS config */ |
| 12674 | err = alc268_parse_auto_config(codec); |
| 12675 | if (err < 0) { |
| 12676 | alc_free(codec); |
| 12677 | return err; |
| 12678 | } else if (!err) { |
| 12679 | printk(KERN_INFO |
| 12680 | "hda_codec: Cannot set up configuration " |
| 12681 | "from BIOS. Using base mode...\n"); |
| 12682 | board_config = ALC268_3ST; |
| 12683 | } |
| 12684 | } |
| 12685 | |
| 12686 | if (board_config != ALC268_AUTO) |
| 12687 | setup_preset(spec, &alc268_presets[board_config]); |
| 12688 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12689 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12690 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12691 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12692 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12693 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12694 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12695 | has_beep = 0; |
| 12696 | for (i = 0; i < spec->num_mixers; i++) { |
| 12697 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12698 | has_beep = 1; |
| 12699 | break; |
| 12700 | } |
| 12701 | } |
| 12702 | |
| 12703 | if (has_beep) { |
| 12704 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12705 | if (err < 0) { |
| 12706 | alc_free(codec); |
| 12707 | return err; |
| 12708 | } |
| 12709 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12710 | /* override the amp caps for beep generator */ |
| 12711 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12712 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12713 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12714 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12715 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12716 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12717 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12718 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12719 | /* check whether NID 0x07 is valid */ |
| 12720 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12721 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12722 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12723 | /* get type */ |
| 12724 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12725 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12726 | spec->adc_nids = alc268_adc_nids_alt; |
| 12727 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12728 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12729 | } else { |
| 12730 | spec->adc_nids = alc268_adc_nids; |
| 12731 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12732 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12733 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12734 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12735 | /* set default input source */ |
| 12736 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12737 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12738 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12739 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12740 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12741 | |
| 12742 | spec->vmaster_nid = 0x02; |
| 12743 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12744 | codec->patch_ops = alc_patch_ops; |
| 12745 | if (board_config == ALC268_AUTO) |
| 12746 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12747 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12748 | codec->proc_widget_hook = print_realtek_coef; |
| 12749 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12750 | return 0; |
| 12751 | } |
| 12752 | |
| 12753 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12754 | * ALC269 channel source setting (2 channel) |
| 12755 | */ |
| 12756 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12757 | |
| 12758 | #define alc269_dac_nids alc260_dac_nids |
| 12759 | |
| 12760 | static hda_nid_t alc269_adc_nids[1] = { |
| 12761 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12762 | 0x08, |
| 12763 | }; |
| 12764 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12765 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12766 | 0x23, |
| 12767 | }; |
| 12768 | |
| 12769 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12770 | * not a mux! |
| 12771 | */ |
| 12772 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12773 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12774 | .num_items = 2, |
| 12775 | .items = { |
| 12776 | { "i-Mic", 0x5 }, |
| 12777 | { "e-Mic", 0x0 }, |
| 12778 | }, |
| 12779 | }; |
| 12780 | |
| 12781 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12782 | .num_items = 2, |
| 12783 | .items = { |
| 12784 | { "i-Mic", 0x1 }, |
| 12785 | { "e-Mic", 0x0 }, |
| 12786 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12787 | }; |
| 12788 | |
| 12789 | #define alc269_modes alc260_modes |
| 12790 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12791 | |
| 12792 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12793 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12794 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12795 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12796 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12797 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12798 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12799 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12800 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12801 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12802 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12803 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12804 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12805 | { } /* end */ |
| 12806 | }; |
| 12807 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12808 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12809 | /* output mixer control */ |
| 12810 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12811 | { |
| 12812 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12813 | .name = "Master Playback Switch", |
| 12814 | .info = snd_hda_mixer_amp_switch_info, |
| 12815 | .get = snd_hda_mixer_amp_switch_get, |
| 12816 | .put = alc268_acer_master_sw_put, |
| 12817 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12818 | }, |
| 12819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12821 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12822 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12823 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12824 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12825 | { } |
| 12826 | }; |
| 12827 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12828 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12829 | /* output mixer control */ |
| 12830 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12831 | { |
| 12832 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12833 | .name = "Master Playback Switch", |
| 12834 | .info = snd_hda_mixer_amp_switch_info, |
| 12835 | .get = snd_hda_mixer_amp_switch_get, |
| 12836 | .put = alc268_acer_master_sw_put, |
| 12837 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12838 | }, |
| 12839 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12840 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12841 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12842 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12843 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12844 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12845 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12846 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12847 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12848 | { } |
| 12849 | }; |
| 12850 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12851 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12852 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12853 | .ops = &snd_hda_bind_vol, |
| 12854 | .values = { |
| 12855 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12856 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12857 | 0 |
| 12858 | }, |
| 12859 | }; |
| 12860 | |
| 12861 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12862 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12863 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12864 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12865 | { } /* end */ |
| 12866 | }; |
| 12867 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12868 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12869 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12870 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12871 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12872 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12873 | { } /* end */ |
| 12874 | }; |
| 12875 | |
| 12876 | /* FSC amilo */ |
| 12877 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12878 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12879 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12880 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12881 | { } /* end */ |
| 12882 | }; |
| 12883 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12884 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12885 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12886 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12887 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12888 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12889 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12890 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12891 | { } |
| 12892 | }; |
| 12893 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12894 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12895 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12896 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12897 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12898 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12899 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12900 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12901 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12902 | {0x1a, 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 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12908 | /* toggle speaker-output according to the hp-jack state */ |
| 12909 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12910 | { |
| 12911 | unsigned int present; |
| 12912 | unsigned char bits; |
| 12913 | |
| 12914 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12915 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12916 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12917 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12918 | AMP_IN_MUTE(0), bits); |
| 12919 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12920 | AMP_IN_MUTE(0), bits); |
| 12921 | |
| 12922 | snd_hda_codec_write(codec, 0x20, 0, |
| 12923 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12924 | snd_hda_codec_write(codec, 0x20, 0, |
| 12925 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12926 | |
| 12927 | snd_hda_codec_write(codec, 0x20, 0, |
| 12928 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12929 | snd_hda_codec_write(codec, 0x20, 0, |
| 12930 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12931 | } |
| 12932 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12933 | /* toggle speaker-output according to the hp-jacks state */ |
| 12934 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12935 | { |
| 12936 | unsigned int present; |
| 12937 | unsigned char bits; |
| 12938 | |
| 12939 | /* Check laptop headphone socket */ |
| 12940 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12941 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12942 | |
| 12943 | /* Check port replicator headphone socket */ |
| 12944 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12945 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12946 | |
| 12947 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12948 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12949 | AMP_IN_MUTE(0), bits); |
| 12950 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12951 | AMP_IN_MUTE(0), bits); |
| 12952 | |
| 12953 | snd_hda_codec_write(codec, 0x20, 0, |
| 12954 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12955 | snd_hda_codec_write(codec, 0x20, 0, |
| 12956 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12957 | |
| 12958 | snd_hda_codec_write(codec, 0x20, 0, |
| 12959 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12960 | snd_hda_codec_write(codec, 0x20, 0, |
| 12961 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12962 | } |
| 12963 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12964 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12965 | { |
| 12966 | unsigned int present; |
| 12967 | |
| 12968 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12969 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12970 | snd_hda_codec_write(codec, 0x23, 0, |
| 12971 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12972 | } |
| 12973 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12974 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12975 | { |
| 12976 | unsigned int present_laptop; |
| 12977 | unsigned int present_dock; |
| 12978 | |
| 12979 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12980 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12981 | |
| 12982 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12983 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12984 | |
| 12985 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12986 | if (present_dock) |
| 12987 | snd_hda_codec_write(codec, 0x23, 0, |
| 12988 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12989 | if (present_laptop) |
| 12990 | snd_hda_codec_write(codec, 0x23, 0, |
| 12991 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12992 | if (!present_dock && !present_laptop) |
| 12993 | snd_hda_codec_write(codec, 0x23, 0, |
| 12994 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12995 | } |
| 12996 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12997 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12998 | unsigned int res) |
| 12999 | { |
| 13000 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13001 | alc269_quanta_fl1_speaker_automute(codec); |
| 13002 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13003 | alc269_quanta_fl1_mic_automute(codec); |
| 13004 | } |
| 13005 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13006 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13007 | unsigned int res) |
| 13008 | { |
| 13009 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13010 | alc269_lifebook_speaker_automute(codec); |
| 13011 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13012 | alc269_lifebook_mic_autoswitch(codec); |
| 13013 | } |
| 13014 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13015 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13016 | { |
| 13017 | alc269_quanta_fl1_speaker_automute(codec); |
| 13018 | alc269_quanta_fl1_mic_automute(codec); |
| 13019 | } |
| 13020 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13021 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13022 | { |
| 13023 | alc269_lifebook_speaker_automute(codec); |
| 13024 | alc269_lifebook_mic_autoswitch(codec); |
| 13025 | } |
| 13026 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13027 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 13028 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13029 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13030 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13031 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13032 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13033 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13034 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13035 | {} |
| 13036 | }; |
| 13037 | |
| 13038 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 13039 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13040 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13041 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13042 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13043 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13044 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13045 | {} |
| 13046 | }; |
| 13047 | |
| 13048 | /* toggle speaker-output according to the hp-jack state */ |
| 13049 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13050 | { |
| 13051 | unsigned int present; |
| 13052 | unsigned char bits; |
| 13053 | |
| 13054 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13055 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13056 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13057 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13058 | AMP_IN_MUTE(0), bits); |
| 13059 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13060 | AMP_IN_MUTE(0), bits); |
| 13061 | } |
| 13062 | |
| 13063 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 13064 | { |
| 13065 | unsigned int present; |
| 13066 | |
| 13067 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13068 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13069 | snd_hda_codec_write(codec, 0x23, 0, |
| 13070 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 13071 | } |
| 13072 | |
| 13073 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 13074 | { |
| 13075 | unsigned int present; |
| 13076 | |
| 13077 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13078 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13079 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13080 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13081 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13082 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13083 | } |
| 13084 | |
| 13085 | /* unsolicited event for HP jack sensing */ |
| 13086 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 13087 | unsigned int res) |
| 13088 | { |
| 13089 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13090 | alc269_speaker_automute(codec); |
| 13091 | |
| 13092 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13093 | alc269_eeepc_dmic_automute(codec); |
| 13094 | } |
| 13095 | |
| 13096 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 13097 | { |
| 13098 | alc269_speaker_automute(codec); |
| 13099 | alc269_eeepc_dmic_automute(codec); |
| 13100 | } |
| 13101 | |
| 13102 | /* unsolicited event for HP jack sensing */ |
| 13103 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 13104 | unsigned int res) |
| 13105 | { |
| 13106 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13107 | alc269_speaker_automute(codec); |
| 13108 | |
| 13109 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13110 | alc269_eeepc_amic_automute(codec); |
| 13111 | } |
| 13112 | |
| 13113 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 13114 | { |
| 13115 | alc269_speaker_automute(codec); |
| 13116 | alc269_eeepc_amic_automute(codec); |
| 13117 | } |
| 13118 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13119 | /* |
| 13120 | * generic initialization of ADC, input mixers and output mixers |
| 13121 | */ |
| 13122 | static struct hda_verb alc269_init_verbs[] = { |
| 13123 | /* |
| 13124 | * Unmute ADC0 and set the default input to mic-in |
| 13125 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13126 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13127 | |
| 13128 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 13129 | * analog-loopback mixer widget |
| 13130 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 13131 | * front panel mic (mic 2) |
| 13132 | */ |
| 13133 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 13134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13135 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13136 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13137 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13138 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13139 | |
| 13140 | /* |
| 13141 | * Set up output mixers (0x0c - 0x0e) |
| 13142 | */ |
| 13143 | /* set vol=0 to output mixers */ |
| 13144 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13145 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13146 | |
| 13147 | /* set up input amps for analog loopback */ |
| 13148 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13149 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13150 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13151 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13152 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13153 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13154 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13155 | |
| 13156 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13157 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13158 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13159 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13160 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13161 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13162 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13163 | |
| 13164 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13165 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13166 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13167 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13168 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13169 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13170 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13171 | |
| 13172 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13173 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13174 | |
| 13175 | /* FIXME: use matrix-type input source selection */ |
| 13176 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13177 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13178 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13179 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13180 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13181 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13182 | |
| 13183 | /* set EAPD */ |
| 13184 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13185 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13186 | { } |
| 13187 | }; |
| 13188 | |
| 13189 | /* add playback controls from the parsed DAC table */ |
| 13190 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13191 | const struct auto_pin_cfg *cfg) |
| 13192 | { |
| 13193 | hda_nid_t nid; |
| 13194 | int err; |
| 13195 | |
| 13196 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 13197 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13198 | spec->multiout.dac_nids[0] = 2; |
| 13199 | |
| 13200 | nid = cfg->line_out_pins[0]; |
| 13201 | if (nid) { |
| 13202 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13203 | "Front Playback Volume", |
| 13204 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 13205 | if (err < 0) |
| 13206 | return err; |
| 13207 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13208 | "Front Playback Switch", |
| 13209 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13210 | if (err < 0) |
| 13211 | return err; |
| 13212 | } |
| 13213 | |
| 13214 | nid = cfg->speaker_pins[0]; |
| 13215 | if (nid) { |
| 13216 | if (!cfg->line_out_pins[0]) { |
| 13217 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13218 | "Speaker Playback Volume", |
| 13219 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13220 | HDA_OUTPUT)); |
| 13221 | if (err < 0) |
| 13222 | return err; |
| 13223 | } |
| 13224 | if (nid == 0x16) { |
| 13225 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13226 | "Speaker Playback Switch", |
| 13227 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13228 | HDA_OUTPUT)); |
| 13229 | if (err < 0) |
| 13230 | return err; |
| 13231 | } else { |
| 13232 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13233 | "Speaker Playback Switch", |
| 13234 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13235 | HDA_OUTPUT)); |
| 13236 | if (err < 0) |
| 13237 | return err; |
| 13238 | } |
| 13239 | } |
| 13240 | nid = cfg->hp_pins[0]; |
| 13241 | if (nid) { |
| 13242 | /* spec->multiout.hp_nid = 2; */ |
| 13243 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 13244 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13245 | "Headphone Playback Volume", |
| 13246 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13247 | HDA_OUTPUT)); |
| 13248 | if (err < 0) |
| 13249 | return err; |
| 13250 | } |
| 13251 | if (nid == 0x16) { |
| 13252 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13253 | "Headphone Playback Switch", |
| 13254 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13255 | HDA_OUTPUT)); |
| 13256 | if (err < 0) |
| 13257 | return err; |
| 13258 | } else { |
| 13259 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13260 | "Headphone Playback Switch", |
| 13261 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13262 | HDA_OUTPUT)); |
| 13263 | if (err < 0) |
| 13264 | return err; |
| 13265 | } |
| 13266 | } |
| 13267 | return 0; |
| 13268 | } |
| 13269 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame^] | 13270 | #define alc269_auto_create_analog_input_ctls \ |
| 13271 | alc262_auto_create_analog_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13272 | |
| 13273 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13274 | #define alc269_loopbacks alc880_loopbacks |
| 13275 | #endif |
| 13276 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13277 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13278 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13279 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13280 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13281 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13282 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13283 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13284 | .substreams = 1, |
| 13285 | .channels_min = 2, |
| 13286 | .channels_max = 8, |
| 13287 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13288 | /* NID is set in alc_build_pcms */ |
| 13289 | .ops = { |
| 13290 | .open = alc880_playback_pcm_open, |
| 13291 | .prepare = alc880_playback_pcm_prepare, |
| 13292 | .cleanup = alc880_playback_pcm_cleanup |
| 13293 | }, |
| 13294 | }; |
| 13295 | |
| 13296 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13297 | .substreams = 1, |
| 13298 | .channels_min = 2, |
| 13299 | .channels_max = 2, |
| 13300 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13301 | /* NID is set in alc_build_pcms */ |
| 13302 | }; |
| 13303 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13304 | /* |
| 13305 | * BIOS auto configuration |
| 13306 | */ |
| 13307 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13308 | { |
| 13309 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13310 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13311 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13312 | |
| 13313 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13314 | alc269_ignore); |
| 13315 | if (err < 0) |
| 13316 | return err; |
| 13317 | |
| 13318 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13319 | if (err < 0) |
| 13320 | return err; |
| 13321 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13322 | if (err < 0) |
| 13323 | return err; |
| 13324 | |
| 13325 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13326 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13327 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13328 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13329 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13330 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13331 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13332 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13333 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13334 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13335 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13336 | /* set default input source */ |
| 13337 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13338 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13339 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13340 | |
| 13341 | err = alc_auto_add_mic_boost(codec); |
| 13342 | if (err < 0) |
| 13343 | return err; |
| 13344 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13345 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13346 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13347 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13348 | return 1; |
| 13349 | } |
| 13350 | |
| 13351 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 13352 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 13353 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13354 | |
| 13355 | |
| 13356 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13357 | static void alc269_auto_init(struct hda_codec *codec) |
| 13358 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13359 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13360 | alc269_auto_init_multi_out(codec); |
| 13361 | alc269_auto_init_hp_out(codec); |
| 13362 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13363 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13364 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13365 | } |
| 13366 | |
| 13367 | /* |
| 13368 | * configuration and preset |
| 13369 | */ |
| 13370 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13371 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13372 | [ALC269_QUANTA_FL1] = "quanta", |
| 13373 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13374 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13375 | [ALC269_FUJITSU] = "fujitsu", |
| 13376 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13377 | }; |
| 13378 | |
| 13379 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13380 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13381 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13382 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13383 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13384 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13385 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13386 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13387 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13388 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13389 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13390 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13391 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13392 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13393 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13394 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13395 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13396 | {} |
| 13397 | }; |
| 13398 | |
| 13399 | static struct alc_config_preset alc269_presets[] = { |
| 13400 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13401 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13402 | .init_verbs = { alc269_init_verbs }, |
| 13403 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13404 | .dac_nids = alc269_dac_nids, |
| 13405 | .hp_nid = 0x03, |
| 13406 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13407 | .channel_mode = alc269_modes, |
| 13408 | .input_mux = &alc269_capture_source, |
| 13409 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13410 | [ALC269_QUANTA_FL1] = { |
| 13411 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13412 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13413 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13414 | .dac_nids = alc269_dac_nids, |
| 13415 | .hp_nid = 0x03, |
| 13416 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13417 | .channel_mode = alc269_modes, |
| 13418 | .input_mux = &alc269_capture_source, |
| 13419 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 13420 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13421 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13422 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13423 | .mixers = { alc269_eeepc_mixer }, |
| 13424 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13425 | .init_verbs = { alc269_init_verbs, |
| 13426 | alc269_eeepc_amic_init_verbs }, |
| 13427 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13428 | .dac_nids = alc269_dac_nids, |
| 13429 | .hp_nid = 0x03, |
| 13430 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13431 | .channel_mode = alc269_modes, |
| 13432 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 13433 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 13434 | .init_hook = alc269_eeepc_amic_inithook, |
| 13435 | }, |
| 13436 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13437 | .mixers = { alc269_eeepc_mixer }, |
| 13438 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13439 | .init_verbs = { alc269_init_verbs, |
| 13440 | alc269_eeepc_dmic_init_verbs }, |
| 13441 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13442 | .dac_nids = alc269_dac_nids, |
| 13443 | .hp_nid = 0x03, |
| 13444 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13445 | .channel_mode = alc269_modes, |
| 13446 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13447 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13448 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13449 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13450 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13451 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13452 | .cap_mixer = alc269_epc_capture_mixer, |
| 13453 | .init_verbs = { alc269_init_verbs, |
| 13454 | alc269_eeepc_dmic_init_verbs }, |
| 13455 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13456 | .dac_nids = alc269_dac_nids, |
| 13457 | .hp_nid = 0x03, |
| 13458 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13459 | .channel_mode = alc269_modes, |
| 13460 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13461 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13462 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13463 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13464 | [ALC269_LIFEBOOK] = { |
| 13465 | .mixers = { alc269_lifebook_mixer }, |
| 13466 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13467 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13468 | .dac_nids = alc269_dac_nids, |
| 13469 | .hp_nid = 0x03, |
| 13470 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13471 | .channel_mode = alc269_modes, |
| 13472 | .input_mux = &alc269_capture_source, |
| 13473 | .unsol_event = alc269_lifebook_unsol_event, |
| 13474 | .init_hook = alc269_lifebook_init_hook, |
| 13475 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13476 | }; |
| 13477 | |
| 13478 | static int patch_alc269(struct hda_codec *codec) |
| 13479 | { |
| 13480 | struct alc_spec *spec; |
| 13481 | int board_config; |
| 13482 | int err; |
| 13483 | |
| 13484 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13485 | if (spec == NULL) |
| 13486 | return -ENOMEM; |
| 13487 | |
| 13488 | codec->spec = spec; |
| 13489 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13490 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13491 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13492 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13493 | alc269_models, |
| 13494 | alc269_cfg_tbl); |
| 13495 | |
| 13496 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 13497 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 13498 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13499 | board_config = ALC269_AUTO; |
| 13500 | } |
| 13501 | |
| 13502 | if (board_config == ALC269_AUTO) { |
| 13503 | /* automatic parse from the BIOS config */ |
| 13504 | err = alc269_parse_auto_config(codec); |
| 13505 | if (err < 0) { |
| 13506 | alc_free(codec); |
| 13507 | return err; |
| 13508 | } else if (!err) { |
| 13509 | printk(KERN_INFO |
| 13510 | "hda_codec: Cannot set up configuration " |
| 13511 | "from BIOS. Using base mode...\n"); |
| 13512 | board_config = ALC269_BASIC; |
| 13513 | } |
| 13514 | } |
| 13515 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13516 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13517 | if (err < 0) { |
| 13518 | alc_free(codec); |
| 13519 | return err; |
| 13520 | } |
| 13521 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13522 | if (board_config != ALC269_AUTO) |
| 13523 | setup_preset(spec, &alc269_presets[board_config]); |
| 13524 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13525 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13526 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13527 | * fix the sample rate of analog I/O to 44.1kHz |
| 13528 | */ |
| 13529 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13530 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13531 | } else { |
| 13532 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13533 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13534 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13535 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13536 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13537 | |
| 13538 | spec->adc_nids = alc269_adc_nids; |
| 13539 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13540 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13541 | if (!spec->cap_mixer) |
| 13542 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13543 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13544 | |
| 13545 | codec->patch_ops = alc_patch_ops; |
| 13546 | if (board_config == ALC269_AUTO) |
| 13547 | spec->init_hook = alc269_auto_init; |
| 13548 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13549 | if (!spec->loopback.amplist) |
| 13550 | spec->loopback.amplist = alc269_loopbacks; |
| 13551 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13552 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13553 | |
| 13554 | return 0; |
| 13555 | } |
| 13556 | |
| 13557 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13558 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13559 | */ |
| 13560 | |
| 13561 | /* |
| 13562 | * set the path ways for 2 channel output |
| 13563 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13564 | */ |
| 13565 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13566 | /* set pin widget 1Ah (line in) for input */ |
| 13567 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13568 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13569 | * the vref |
| 13570 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13571 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13572 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13573 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13574 | #if 0 |
| 13575 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13576 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13577 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13578 | { } /* end */ |
| 13579 | }; |
| 13580 | /* |
| 13581 | * 6ch mode |
| 13582 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13583 | */ |
| 13584 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13585 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13586 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13587 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13588 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13589 | |
| 13590 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13591 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13592 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13593 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13594 | #if 0 |
| 13595 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13596 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13597 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13598 | { } /* end */ |
| 13599 | }; |
| 13600 | |
| 13601 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13602 | { 2, alc861_threestack_ch2_init }, |
| 13603 | { 6, alc861_threestack_ch6_init }, |
| 13604 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13605 | /* Set mic1 as input and unmute the mixer */ |
| 13606 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13607 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13608 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13609 | { } /* end */ |
| 13610 | }; |
| 13611 | /* Set mic1 as output and mute mixer */ |
| 13612 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13613 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13614 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13615 | { } /* end */ |
| 13616 | }; |
| 13617 | |
| 13618 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13619 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13620 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13621 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13622 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13623 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13624 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13625 | /* set pin widget 1Ah (line in) for input */ |
| 13626 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13627 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13628 | * the vref |
| 13629 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13630 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13631 | |
| 13632 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13633 | #if 0 |
| 13634 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13635 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13636 | #endif |
| 13637 | { } /* end */ |
| 13638 | }; |
| 13639 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13640 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13641 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13642 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13643 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13644 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13645 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13646 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13647 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13648 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13649 | |
| 13650 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13651 | #if 0 |
| 13652 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13653 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13654 | #endif |
| 13655 | { } /* end */ |
| 13656 | }; |
| 13657 | |
| 13658 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13659 | { 2, alc861_asus_ch2_init }, |
| 13660 | { 6, alc861_asus_ch6_init }, |
| 13661 | }; |
| 13662 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13663 | /* patch-ALC861 */ |
| 13664 | |
| 13665 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13666 | /* output mixer control */ |
| 13667 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13668 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13669 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13670 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13671 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13672 | |
| 13673 | /*Input mixer control */ |
| 13674 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13675 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13676 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13677 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13678 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13679 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13680 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13681 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13682 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13683 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13684 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13685 | { } /* end */ |
| 13686 | }; |
| 13687 | |
| 13688 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13689 | /* output mixer control */ |
| 13690 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13691 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13692 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13693 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13694 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13695 | |
| 13696 | /* Input mixer control */ |
| 13697 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13698 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13699 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13700 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13701 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13702 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13703 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13704 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13705 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13706 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13707 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13708 | { |
| 13709 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13710 | .name = "Channel Mode", |
| 13711 | .info = alc_ch_mode_info, |
| 13712 | .get = alc_ch_mode_get, |
| 13713 | .put = alc_ch_mode_put, |
| 13714 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13715 | }, |
| 13716 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13717 | }; |
| 13718 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13719 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13720 | /* output mixer control */ |
| 13721 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13722 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13724 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13725 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13726 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13727 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13728 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13729 | /* output mixer control */ |
| 13730 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13731 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13732 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13733 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13734 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13735 | |
| 13736 | /* Input mixer control */ |
| 13737 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13738 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13739 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13740 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13741 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13742 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13743 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13744 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13745 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13746 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13747 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13748 | { |
| 13749 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13750 | .name = "Channel Mode", |
| 13751 | .info = alc_ch_mode_info, |
| 13752 | .get = alc_ch_mode_get, |
| 13753 | .put = alc_ch_mode_put, |
| 13754 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13755 | }, |
| 13756 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13757 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13758 | |
| 13759 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13760 | /* output mixer control */ |
| 13761 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13762 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13763 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13764 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13765 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13766 | |
| 13767 | /* Input mixer control */ |
| 13768 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13769 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13770 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13771 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13772 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13773 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13774 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13775 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13776 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13777 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13778 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13779 | { |
| 13780 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13781 | .name = "Channel Mode", |
| 13782 | .info = alc_ch_mode_info, |
| 13783 | .get = alc_ch_mode_get, |
| 13784 | .put = alc_ch_mode_put, |
| 13785 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13786 | }, |
| 13787 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13788 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13789 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13790 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13791 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13792 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13793 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13794 | { } |
| 13795 | }; |
| 13796 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13797 | /* |
| 13798 | * generic initialization of ADC, input mixers and output mixers |
| 13799 | */ |
| 13800 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13801 | /* |
| 13802 | * Unmute ADC0 and set the default input to mic-in |
| 13803 | */ |
| 13804 | /* port-A for surround (rear panel) */ |
| 13805 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13806 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13807 | /* port-B for mic-in (rear panel) with vref */ |
| 13808 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13809 | /* port-C for line-in (rear panel) */ |
| 13810 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13811 | /* port-D for Front */ |
| 13812 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13813 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13814 | /* port-E for HP out (front panel) */ |
| 13815 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13816 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13817 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13818 | /* port-F for mic-in (front panel) with vref */ |
| 13819 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13820 | /* port-G for CLFE (rear panel) */ |
| 13821 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13822 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13823 | /* port-H for side (rear panel) */ |
| 13824 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13825 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13826 | /* CD-in */ |
| 13827 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13828 | /* route front mic to ADC1*/ |
| 13829 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13830 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13831 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13832 | /* Unmute DAC0~3 & spdif out*/ |
| 13833 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13834 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13835 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13836 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13837 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13838 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13839 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13840 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13841 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13842 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13843 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13844 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13845 | /* Unmute Stereo Mixer 15 */ |
| 13846 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13847 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13848 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13849 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13850 | |
| 13851 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13852 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13853 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13854 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13855 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13856 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13857 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13858 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13859 | /* hp used DAC 3 (Front) */ |
| 13860 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13861 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13862 | |
| 13863 | { } |
| 13864 | }; |
| 13865 | |
| 13866 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13867 | /* |
| 13868 | * Unmute ADC0 and set the default input to mic-in |
| 13869 | */ |
| 13870 | /* port-A for surround (rear panel) */ |
| 13871 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13872 | /* port-B for mic-in (rear panel) with vref */ |
| 13873 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13874 | /* port-C for line-in (rear panel) */ |
| 13875 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13876 | /* port-D for Front */ |
| 13877 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13878 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13879 | /* port-E for HP out (front panel) */ |
| 13880 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13881 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13882 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13883 | /* port-F for mic-in (front panel) with vref */ |
| 13884 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13885 | /* port-G for CLFE (rear panel) */ |
| 13886 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13887 | /* port-H for side (rear panel) */ |
| 13888 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13889 | /* CD-in */ |
| 13890 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13891 | /* route front mic to ADC1*/ |
| 13892 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13893 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13894 | /* Unmute DAC0~3 & spdif out*/ |
| 13895 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13896 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13897 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13898 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13899 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13900 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13901 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13902 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13903 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13904 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13905 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13906 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13907 | /* Unmute Stereo Mixer 15 */ |
| 13908 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13909 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13910 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13911 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13912 | |
| 13913 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13914 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13915 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13916 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13917 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13918 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13919 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13920 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13921 | /* hp used DAC 3 (Front) */ |
| 13922 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13923 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13924 | { } |
| 13925 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13926 | |
| 13927 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13928 | /* |
| 13929 | * Unmute ADC0 and set the default input to mic-in |
| 13930 | */ |
| 13931 | /* port-A for surround (rear panel) */ |
| 13932 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13933 | /* port-B for mic-in (rear panel) with vref */ |
| 13934 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13935 | /* port-C for line-in (rear panel) */ |
| 13936 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13937 | /* port-D for Front */ |
| 13938 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13939 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13940 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13941 | /* this has to be set to VREF80 */ |
| 13942 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13943 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13944 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13945 | /* port-F for mic-in (front panel) with vref */ |
| 13946 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13947 | /* port-G for CLFE (rear panel) */ |
| 13948 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13949 | /* port-H for side (rear panel) */ |
| 13950 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13951 | /* CD-in */ |
| 13952 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13953 | /* route front mic to ADC1*/ |
| 13954 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13955 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13956 | /* Unmute DAC0~3 & spdif out*/ |
| 13957 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13958 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13959 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13960 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13961 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13962 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13963 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13964 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13965 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13966 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13967 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13968 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13969 | /* Unmute Stereo Mixer 15 */ |
| 13970 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13971 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13972 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13973 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13974 | |
| 13975 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13976 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13977 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13978 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13979 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13980 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13981 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13982 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13983 | /* hp used DAC 3 (Front) */ |
| 13984 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13985 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13986 | { } |
| 13987 | }; |
| 13988 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13989 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13990 | /* |
| 13991 | * Unmute ADC0 and set the default input to mic-in |
| 13992 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13993 | /* port-A for surround (rear panel) |
| 13994 | * according to codec#0 this is the HP jack |
| 13995 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13996 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13997 | /* route front PCM to HP */ |
| 13998 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13999 | /* port-B for mic-in (rear panel) with vref */ |
| 14000 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14001 | /* port-C for line-in (rear panel) */ |
| 14002 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14003 | /* port-D for Front */ |
| 14004 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14005 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14006 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14007 | /* this has to be set to VREF80 */ |
| 14008 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14009 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14010 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14011 | /* port-F for mic-in (front panel) with vref */ |
| 14012 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14013 | /* port-G for CLFE (rear panel) */ |
| 14014 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14015 | /* port-H for side (rear panel) */ |
| 14016 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14017 | /* CD-in */ |
| 14018 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14019 | /* route front mic to ADC1*/ |
| 14020 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14021 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14022 | /* Unmute DAC0~3 & spdif out*/ |
| 14023 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14024 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14025 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14026 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14027 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14028 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14029 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14030 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14031 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14032 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14033 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14034 | /* Unmute Stereo Mixer 15 */ |
| 14035 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14036 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14037 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14038 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14039 | |
| 14040 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14041 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14042 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14043 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14044 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14045 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14046 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14047 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14048 | /* hp used DAC 3 (Front) */ |
| 14049 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14050 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14051 | { } |
| 14052 | }; |
| 14053 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14054 | /* additional init verbs for ASUS laptops */ |
| 14055 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14056 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14057 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14058 | { } |
| 14059 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14060 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14061 | /* |
| 14062 | * generic initialization of ADC, input mixers and output mixers |
| 14063 | */ |
| 14064 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14065 | /* |
| 14066 | * Unmute ADC0 and set the default input to mic-in |
| 14067 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14068 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14069 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14070 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14071 | /* Unmute DAC0~3 & spdif out*/ |
| 14072 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14073 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14074 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14075 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14076 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14077 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14078 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14079 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14080 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14081 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14082 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14083 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14084 | /* Unmute Stereo Mixer 15 */ |
| 14085 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14086 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14087 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14088 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14089 | |
| 14090 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14091 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14092 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14093 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14094 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14095 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14096 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14097 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14098 | |
| 14099 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14100 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14101 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14102 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14103 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14104 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14105 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14106 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14107 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14108 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14109 | |
| 14110 | { } |
| 14111 | }; |
| 14112 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14113 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14114 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14115 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14116 | { } |
| 14117 | }; |
| 14118 | |
| 14119 | /* toggle speaker-output according to the hp-jack state */ |
| 14120 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14121 | { |
| 14122 | unsigned int present; |
| 14123 | |
| 14124 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 14125 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14126 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14127 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14128 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14129 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14130 | } |
| 14131 | |
| 14132 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14133 | unsigned int res) |
| 14134 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14135 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14136 | alc861_toshiba_automute(codec); |
| 14137 | } |
| 14138 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14139 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14140 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14141 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14142 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14143 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14144 | |
| 14145 | |
| 14146 | #define ALC861_DIGOUT_NID 0x07 |
| 14147 | |
| 14148 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14149 | { 8, NULL } |
| 14150 | }; |
| 14151 | |
| 14152 | static hda_nid_t alc861_dac_nids[4] = { |
| 14153 | /* front, surround, clfe, side */ |
| 14154 | 0x03, 0x06, 0x05, 0x04 |
| 14155 | }; |
| 14156 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14157 | static hda_nid_t alc660_dac_nids[3] = { |
| 14158 | /* front, clfe, surround */ |
| 14159 | 0x03, 0x05, 0x06 |
| 14160 | }; |
| 14161 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14162 | static hda_nid_t alc861_adc_nids[1] = { |
| 14163 | /* ADC0-2 */ |
| 14164 | 0x08, |
| 14165 | }; |
| 14166 | |
| 14167 | static struct hda_input_mux alc861_capture_source = { |
| 14168 | .num_items = 5, |
| 14169 | .items = { |
| 14170 | { "Mic", 0x0 }, |
| 14171 | { "Front Mic", 0x3 }, |
| 14172 | { "Line", 0x1 }, |
| 14173 | { "CD", 0x4 }, |
| 14174 | { "Mixer", 0x5 }, |
| 14175 | }, |
| 14176 | }; |
| 14177 | |
| 14178 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14179 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 14180 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14181 | { |
| 14182 | int i; |
| 14183 | hda_nid_t nid; |
| 14184 | |
| 14185 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14186 | for (i = 0; i < cfg->line_outs; i++) { |
| 14187 | nid = cfg->line_out_pins[i]; |
| 14188 | if (nid) { |
| 14189 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 14190 | continue; |
| 14191 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 14192 | } |
| 14193 | } |
| 14194 | spec->multiout.num_dacs = cfg->line_outs; |
| 14195 | return 0; |
| 14196 | } |
| 14197 | |
| 14198 | /* add playback controls from the parsed DAC table */ |
| 14199 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14200 | const struct auto_pin_cfg *cfg) |
| 14201 | { |
| 14202 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14203 | static const char *chname[4] = { |
| 14204 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14205 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14206 | hda_nid_t nid; |
| 14207 | int i, idx, err; |
| 14208 | |
| 14209 | for (i = 0; i < cfg->line_outs; i++) { |
| 14210 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14211 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14212 | continue; |
| 14213 | if (nid == 0x05) { |
| 14214 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14215 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14216 | "Center Playback Switch", |
| 14217 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 14218 | HDA_OUTPUT)); |
| 14219 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14220 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14221 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14222 | "LFE Playback Switch", |
| 14223 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 14224 | HDA_OUTPUT)); |
| 14225 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14226 | return err; |
| 14227 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14228 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 14229 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14230 | if (nid == alc861_dac_nids[idx]) |
| 14231 | break; |
| 14232 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14233 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14234 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 14235 | HDA_OUTPUT)); |
| 14236 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14237 | return err; |
| 14238 | } |
| 14239 | } |
| 14240 | return 0; |
| 14241 | } |
| 14242 | |
| 14243 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 14244 | { |
| 14245 | int err; |
| 14246 | hda_nid_t nid; |
| 14247 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14248 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14249 | return 0; |
| 14250 | |
| 14251 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 14252 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14253 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 14254 | "Headphone Playback Switch", |
| 14255 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 14256 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14257 | return err; |
| 14258 | spec->multiout.hp_nid = nid; |
| 14259 | } |
| 14260 | return 0; |
| 14261 | } |
| 14262 | |
| 14263 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14264 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 14265 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14266 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14267 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14268 | int i, err, idx, idx1; |
| 14269 | |
| 14270 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14271 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14272 | case 0x0c: |
| 14273 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14274 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14275 | break; |
| 14276 | case 0x0f: |
| 14277 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14278 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14279 | break; |
| 14280 | case 0x0d: |
| 14281 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14282 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14283 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14284 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14285 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14286 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14287 | break; |
| 14288 | case 0x11: |
| 14289 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14290 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14291 | break; |
| 14292 | default: |
| 14293 | continue; |
| 14294 | } |
| 14295 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14296 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14297 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14298 | if (err < 0) |
| 14299 | return err; |
| 14300 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14301 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14302 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14303 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14304 | } |
| 14305 | return 0; |
| 14306 | } |
| 14307 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14308 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14309 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14310 | int pin_type, int dac_idx) |
| 14311 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14312 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14313 | pin_type); |
| 14314 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14315 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14316 | } |
| 14317 | |
| 14318 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14319 | { |
| 14320 | struct alc_spec *spec = codec->spec; |
| 14321 | int i; |
| 14322 | |
| 14323 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14324 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14325 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14326 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14327 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14328 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14329 | } |
| 14330 | } |
| 14331 | |
| 14332 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14333 | { |
| 14334 | struct alc_spec *spec = codec->spec; |
| 14335 | hda_nid_t pin; |
| 14336 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 14337 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14338 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14339 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 14340 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14341 | pin = spec->autocfg.speaker_pins[0]; |
| 14342 | if (pin) |
| 14343 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14344 | } |
| 14345 | |
| 14346 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14347 | { |
| 14348 | struct alc_spec *spec = codec->spec; |
| 14349 | int i; |
| 14350 | |
| 14351 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14352 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14353 | if (nid >= 0x0c && nid <= 0x11) |
| 14354 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14355 | } |
| 14356 | } |
| 14357 | |
| 14358 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14359 | /* return 1 if successful, 0 if the proper config is not found, |
| 14360 | * or a negative error code |
| 14361 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14362 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14363 | { |
| 14364 | struct alc_spec *spec = codec->spec; |
| 14365 | int err; |
| 14366 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14367 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14368 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14369 | alc861_ignore); |
| 14370 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14371 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14372 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14373 | return 0; /* can't find valid BIOS pin config */ |
| 14374 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14375 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14376 | if (err < 0) |
| 14377 | return err; |
| 14378 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14379 | if (err < 0) |
| 14380 | return err; |
| 14381 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 14382 | if (err < 0) |
| 14383 | return err; |
| 14384 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14385 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14386 | return err; |
| 14387 | |
| 14388 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14389 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14390 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14391 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14392 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14393 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14394 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14395 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14396 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14397 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14398 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14399 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14400 | |
| 14401 | spec->adc_nids = alc861_adc_nids; |
| 14402 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14403 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14404 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14405 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14406 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14407 | return 1; |
| 14408 | } |
| 14409 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14410 | /* additional initialization for auto-configuration model */ |
| 14411 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14412 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14413 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14414 | alc861_auto_init_multi_out(codec); |
| 14415 | alc861_auto_init_hp_out(codec); |
| 14416 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14417 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14418 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14419 | } |
| 14420 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14421 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14422 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14423 | { 0x15, HDA_INPUT, 0 }, |
| 14424 | { 0x15, HDA_INPUT, 1 }, |
| 14425 | { 0x15, HDA_INPUT, 2 }, |
| 14426 | { 0x15, HDA_INPUT, 3 }, |
| 14427 | { } /* end */ |
| 14428 | }; |
| 14429 | #endif |
| 14430 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14431 | |
| 14432 | /* |
| 14433 | * configuration and preset |
| 14434 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14435 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14436 | [ALC861_3ST] = "3stack", |
| 14437 | [ALC660_3ST] = "3stack-660", |
| 14438 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14439 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14440 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14441 | [ALC861_TOSHIBA] = "toshiba", |
| 14442 | [ALC861_ASUS] = "asus", |
| 14443 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14444 | [ALC861_AUTO] = "auto", |
| 14445 | }; |
| 14446 | |
| 14447 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14448 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14449 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14450 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14451 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14452 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14453 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14454 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14455 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14456 | * Any other models that need this preset? |
| 14457 | */ |
| 14458 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14459 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14460 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14461 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14462 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14463 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14464 | /* FIXME: the below seems conflict */ |
| 14465 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14466 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14467 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14468 | {} |
| 14469 | }; |
| 14470 | |
| 14471 | static struct alc_config_preset alc861_presets[] = { |
| 14472 | [ALC861_3ST] = { |
| 14473 | .mixers = { alc861_3ST_mixer }, |
| 14474 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14475 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14476 | .dac_nids = alc861_dac_nids, |
| 14477 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14478 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14479 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14480 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14481 | .adc_nids = alc861_adc_nids, |
| 14482 | .input_mux = &alc861_capture_source, |
| 14483 | }, |
| 14484 | [ALC861_3ST_DIG] = { |
| 14485 | .mixers = { alc861_base_mixer }, |
| 14486 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14487 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14488 | .dac_nids = alc861_dac_nids, |
| 14489 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14490 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14491 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14492 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14493 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14494 | .adc_nids = alc861_adc_nids, |
| 14495 | .input_mux = &alc861_capture_source, |
| 14496 | }, |
| 14497 | [ALC861_6ST_DIG] = { |
| 14498 | .mixers = { alc861_base_mixer }, |
| 14499 | .init_verbs = { alc861_base_init_verbs }, |
| 14500 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14501 | .dac_nids = alc861_dac_nids, |
| 14502 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14503 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14504 | .channel_mode = alc861_8ch_modes, |
| 14505 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14506 | .adc_nids = alc861_adc_nids, |
| 14507 | .input_mux = &alc861_capture_source, |
| 14508 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14509 | [ALC660_3ST] = { |
| 14510 | .mixers = { alc861_3ST_mixer }, |
| 14511 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14512 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14513 | .dac_nids = alc660_dac_nids, |
| 14514 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14515 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14516 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14517 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14518 | .adc_nids = alc861_adc_nids, |
| 14519 | .input_mux = &alc861_capture_source, |
| 14520 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14521 | [ALC861_UNIWILL_M31] = { |
| 14522 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14523 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14524 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14525 | .dac_nids = alc861_dac_nids, |
| 14526 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14527 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14528 | .channel_mode = alc861_uniwill_m31_modes, |
| 14529 | .need_dac_fix = 1, |
| 14530 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14531 | .adc_nids = alc861_adc_nids, |
| 14532 | .input_mux = &alc861_capture_source, |
| 14533 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14534 | [ALC861_TOSHIBA] = { |
| 14535 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14536 | .init_verbs = { alc861_base_init_verbs, |
| 14537 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14538 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14539 | .dac_nids = alc861_dac_nids, |
| 14540 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14541 | .channel_mode = alc883_3ST_2ch_modes, |
| 14542 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14543 | .adc_nids = alc861_adc_nids, |
| 14544 | .input_mux = &alc861_capture_source, |
| 14545 | .unsol_event = alc861_toshiba_unsol_event, |
| 14546 | .init_hook = alc861_toshiba_automute, |
| 14547 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14548 | [ALC861_ASUS] = { |
| 14549 | .mixers = { alc861_asus_mixer }, |
| 14550 | .init_verbs = { alc861_asus_init_verbs }, |
| 14551 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14552 | .dac_nids = alc861_dac_nids, |
| 14553 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14554 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14555 | .channel_mode = alc861_asus_modes, |
| 14556 | .need_dac_fix = 1, |
| 14557 | .hp_nid = 0x06, |
| 14558 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14559 | .adc_nids = alc861_adc_nids, |
| 14560 | .input_mux = &alc861_capture_source, |
| 14561 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14562 | [ALC861_ASUS_LAPTOP] = { |
| 14563 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14564 | .init_verbs = { alc861_asus_init_verbs, |
| 14565 | alc861_asus_laptop_init_verbs }, |
| 14566 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14567 | .dac_nids = alc861_dac_nids, |
| 14568 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14569 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14570 | .channel_mode = alc883_3ST_2ch_modes, |
| 14571 | .need_dac_fix = 1, |
| 14572 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14573 | .adc_nids = alc861_adc_nids, |
| 14574 | .input_mux = &alc861_capture_source, |
| 14575 | }, |
| 14576 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14577 | |
| 14578 | |
| 14579 | static int patch_alc861(struct hda_codec *codec) |
| 14580 | { |
| 14581 | struct alc_spec *spec; |
| 14582 | int board_config; |
| 14583 | int err; |
| 14584 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14585 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14586 | if (spec == NULL) |
| 14587 | return -ENOMEM; |
| 14588 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14589 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14590 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14591 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14592 | alc861_models, |
| 14593 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14594 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14595 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 14596 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 14597 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14598 | board_config = ALC861_AUTO; |
| 14599 | } |
| 14600 | |
| 14601 | if (board_config == ALC861_AUTO) { |
| 14602 | /* automatic parse from the BIOS config */ |
| 14603 | err = alc861_parse_auto_config(codec); |
| 14604 | if (err < 0) { |
| 14605 | alc_free(codec); |
| 14606 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14607 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14608 | printk(KERN_INFO |
| 14609 | "hda_codec: Cannot set up configuration " |
| 14610 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14611 | board_config = ALC861_3ST_DIG; |
| 14612 | } |
| 14613 | } |
| 14614 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14615 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14616 | if (err < 0) { |
| 14617 | alc_free(codec); |
| 14618 | return err; |
| 14619 | } |
| 14620 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14621 | if (board_config != ALC861_AUTO) |
| 14622 | setup_preset(spec, &alc861_presets[board_config]); |
| 14623 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14624 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14625 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14626 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14627 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14628 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14629 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14630 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14631 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14632 | spec->vmaster_nid = 0x03; |
| 14633 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14634 | codec->patch_ops = alc_patch_ops; |
| 14635 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14636 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14637 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14638 | if (!spec->loopback.amplist) |
| 14639 | spec->loopback.amplist = alc861_loopbacks; |
| 14640 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14641 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14642 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14643 | return 0; |
| 14644 | } |
| 14645 | |
| 14646 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14647 | * ALC861-VD support |
| 14648 | * |
| 14649 | * Based on ALC882 |
| 14650 | * |
| 14651 | * In addition, an independent DAC |
| 14652 | */ |
| 14653 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14654 | |
| 14655 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14656 | /* front, surr, clfe, side surr */ |
| 14657 | 0x02, 0x03, 0x04, 0x05 |
| 14658 | }; |
| 14659 | |
| 14660 | /* dac_nids for ALC660vd are in a different order - according to |
| 14661 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14662 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14663 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14664 | * - and it is the same as in 861vd. |
| 14665 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14666 | */ |
| 14667 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14668 | /* front, rear, clfe, rear_surr */ |
| 14669 | 0x02, 0x04, 0x03 |
| 14670 | }; |
| 14671 | |
| 14672 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14673 | /* ADC0 */ |
| 14674 | 0x09, |
| 14675 | }; |
| 14676 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14677 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14678 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14679 | /* input MUX */ |
| 14680 | /* FIXME: should be a matrix-type input source selection */ |
| 14681 | static struct hda_input_mux alc861vd_capture_source = { |
| 14682 | .num_items = 4, |
| 14683 | .items = { |
| 14684 | { "Mic", 0x0 }, |
| 14685 | { "Front Mic", 0x1 }, |
| 14686 | { "Line", 0x2 }, |
| 14687 | { "CD", 0x4 }, |
| 14688 | }, |
| 14689 | }; |
| 14690 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14691 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14692 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14693 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14694 | { "Ext Mic", 0x0 }, |
| 14695 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14696 | }, |
| 14697 | }; |
| 14698 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14699 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14700 | .num_items = 2, |
| 14701 | .items = { |
| 14702 | { "Front Mic", 0x0 }, |
| 14703 | { "ATAPI Mic", 0x1 }, |
| 14704 | }, |
| 14705 | }; |
| 14706 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14707 | /* |
| 14708 | * 2ch mode |
| 14709 | */ |
| 14710 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14711 | { 2, NULL } |
| 14712 | }; |
| 14713 | |
| 14714 | /* |
| 14715 | * 6ch mode |
| 14716 | */ |
| 14717 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14718 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14719 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14720 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14721 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14722 | { } /* end */ |
| 14723 | }; |
| 14724 | |
| 14725 | /* |
| 14726 | * 8ch mode |
| 14727 | */ |
| 14728 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14729 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14730 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14731 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14732 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14733 | { } /* end */ |
| 14734 | }; |
| 14735 | |
| 14736 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14737 | { 6, alc861vd_6stack_ch6_init }, |
| 14738 | { 8, alc861vd_6stack_ch8_init }, |
| 14739 | }; |
| 14740 | |
| 14741 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14742 | { |
| 14743 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14744 | .name = "Channel Mode", |
| 14745 | .info = alc_ch_mode_info, |
| 14746 | .get = alc_ch_mode_get, |
| 14747 | .put = alc_ch_mode_put, |
| 14748 | }, |
| 14749 | { } /* end */ |
| 14750 | }; |
| 14751 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14752 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14753 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14754 | */ |
| 14755 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14756 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14757 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14758 | |
| 14759 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14760 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14761 | |
| 14762 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14763 | HDA_OUTPUT), |
| 14764 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14765 | HDA_OUTPUT), |
| 14766 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14767 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14768 | |
| 14769 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14770 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14771 | |
| 14772 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14773 | |
| 14774 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14775 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14776 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14777 | |
| 14778 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14779 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14780 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14781 | |
| 14782 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14783 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14784 | |
| 14785 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14786 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14787 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14788 | { } /* end */ |
| 14789 | }; |
| 14790 | |
| 14791 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14792 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14793 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14794 | |
| 14795 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14796 | |
| 14797 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14798 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14800 | |
| 14801 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14802 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14803 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14804 | |
| 14805 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14806 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14807 | |
| 14808 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14809 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14810 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14811 | { } /* end */ |
| 14812 | }; |
| 14813 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14814 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14815 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14816 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14817 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14818 | |
| 14819 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14820 | |
| 14821 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14822 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14823 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14824 | |
| 14825 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14826 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14827 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14828 | |
| 14829 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14830 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14831 | |
| 14832 | { } /* end */ |
| 14833 | }; |
| 14834 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14835 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14836 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14837 | */ |
| 14838 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14839 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14840 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14841 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14842 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14843 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14844 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14845 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14846 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14847 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14848 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14849 | { } /* end */ |
| 14850 | }; |
| 14851 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14852 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14853 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14854 | */ |
| 14855 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14856 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14857 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14858 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14859 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14860 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14861 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14862 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14863 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14864 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14865 | { } /* end */ |
| 14866 | }; |
| 14867 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14868 | /* |
| 14869 | * generic initialization of ADC, input mixers and output mixers |
| 14870 | */ |
| 14871 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14872 | /* |
| 14873 | * Unmute ADC0 and set the default input to mic-in |
| 14874 | */ |
| 14875 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14876 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14877 | |
| 14878 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14879 | * the analog-loopback mixer widget |
| 14880 | */ |
| 14881 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14882 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14883 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14884 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14885 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14886 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14887 | |
| 14888 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14889 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14890 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14891 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14892 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14893 | |
| 14894 | /* |
| 14895 | * Set up output mixers (0x02 - 0x05) |
| 14896 | */ |
| 14897 | /* set vol=0 to output mixers */ |
| 14898 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14899 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14900 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14901 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14902 | |
| 14903 | /* set up input amps for analog loopback */ |
| 14904 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14905 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14906 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14907 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14908 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14909 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14910 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14911 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14912 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14913 | |
| 14914 | { } |
| 14915 | }; |
| 14916 | |
| 14917 | /* |
| 14918 | * 3-stack pin configuration: |
| 14919 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14920 | */ |
| 14921 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14922 | /* |
| 14923 | * Set pin mode and muting |
| 14924 | */ |
| 14925 | /* set front pin widgets 0x14 for output */ |
| 14926 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14927 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14928 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14929 | |
| 14930 | /* Mic (rear) pin: input vref at 80% */ |
| 14931 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14932 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14933 | /* Front Mic pin: input vref at 80% */ |
| 14934 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14935 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14936 | /* Line In pin: input */ |
| 14937 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14938 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14939 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14940 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14941 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14942 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14943 | /* CD pin widget for input */ |
| 14944 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14945 | |
| 14946 | { } |
| 14947 | }; |
| 14948 | |
| 14949 | /* |
| 14950 | * 6-stack pin configuration: |
| 14951 | */ |
| 14952 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14953 | /* |
| 14954 | * Set pin mode and muting |
| 14955 | */ |
| 14956 | /* set front pin widgets 0x14 for output */ |
| 14957 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14958 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14959 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14960 | |
| 14961 | /* Rear Pin: output 1 (0x0d) */ |
| 14962 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14963 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14964 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14965 | /* CLFE Pin: output 2 (0x0e) */ |
| 14966 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14967 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14968 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14969 | /* Side Pin: output 3 (0x0f) */ |
| 14970 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14971 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14972 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14973 | |
| 14974 | /* Mic (rear) pin: input vref at 80% */ |
| 14975 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14976 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14977 | /* Front Mic pin: input vref at 80% */ |
| 14978 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14979 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14980 | /* Line In pin: input */ |
| 14981 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14982 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14983 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14984 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14985 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14986 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14987 | /* CD pin widget for input */ |
| 14988 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14989 | |
| 14990 | { } |
| 14991 | }; |
| 14992 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14993 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14994 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14995 | { } |
| 14996 | }; |
| 14997 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14998 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14999 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15000 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15001 | { } |
| 15002 | }; |
| 15003 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15004 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 15005 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15006 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15007 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 15008 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15009 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15010 | {} |
| 15011 | }; |
| 15012 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15013 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 15014 | { |
| 15015 | unsigned int present; |
| 15016 | unsigned char bits; |
| 15017 | |
| 15018 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15019 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15020 | bits = present ? HDA_AMP_MUTE : 0; |
| 15021 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15022 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15023 | } |
| 15024 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15025 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15026 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15027 | struct alc_spec *spec = codec->spec; |
| 15028 | |
| 15029 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15030 | spec->autocfg.speaker_pins[0] = 0x14; |
| 15031 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15032 | alc861vd_lenovo_mic_automute(codec); |
| 15033 | } |
| 15034 | |
| 15035 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15036 | unsigned int res) |
| 15037 | { |
| 15038 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15039 | case ALC880_MIC_EVENT: |
| 15040 | alc861vd_lenovo_mic_automute(codec); |
| 15041 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15042 | default: |
| 15043 | alc_automute_amp_unsol_event(codec, res); |
| 15044 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15045 | } |
| 15046 | } |
| 15047 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15048 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15049 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15050 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15051 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15052 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15053 | |
| 15054 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15055 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15056 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15057 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15058 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15059 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15060 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15061 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15062 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15063 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15064 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15065 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15066 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15067 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15068 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15069 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15070 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15071 | |
| 15072 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15073 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15074 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15075 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15076 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15077 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15078 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15079 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15080 | |
| 15081 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15082 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15083 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15084 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15085 | |
| 15086 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15087 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15088 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15089 | |
| 15090 | { } /* end */ |
| 15091 | }; |
| 15092 | |
| 15093 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15094 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15095 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15096 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15097 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15098 | spec->autocfg.hp_pins[0] = 0x15; |
| 15099 | spec->autocfg.speaker_pins[0] = 0x14; |
| 15100 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15101 | } |
| 15102 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15103 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15104 | #define alc861vd_loopbacks alc880_loopbacks |
| 15105 | #endif |
| 15106 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15107 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15108 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15109 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15110 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15111 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15112 | |
| 15113 | /* |
| 15114 | * configuration and preset |
| 15115 | */ |
| 15116 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15117 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15118 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15119 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15120 | [ALC861VD_3ST] = "3stack", |
| 15121 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15122 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15123 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15124 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15125 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15126 | [ALC861VD_AUTO] = "auto", |
| 15127 | }; |
| 15128 | |
| 15129 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15130 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15131 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15132 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15133 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15134 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15135 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15136 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15137 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15138 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15139 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15140 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15141 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15142 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15143 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15144 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15145 | {} |
| 15146 | }; |
| 15147 | |
| 15148 | static struct alc_config_preset alc861vd_presets[] = { |
| 15149 | [ALC660VD_3ST] = { |
| 15150 | .mixers = { alc861vd_3st_mixer }, |
| 15151 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15152 | alc861vd_3stack_init_verbs }, |
| 15153 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15154 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15155 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15156 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15157 | .input_mux = &alc861vd_capture_source, |
| 15158 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15159 | [ALC660VD_3ST_DIG] = { |
| 15160 | .mixers = { alc861vd_3st_mixer }, |
| 15161 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15162 | alc861vd_3stack_init_verbs }, |
| 15163 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15164 | .dac_nids = alc660vd_dac_nids, |
| 15165 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15166 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15167 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15168 | .input_mux = &alc861vd_capture_source, |
| 15169 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15170 | [ALC861VD_3ST] = { |
| 15171 | .mixers = { alc861vd_3st_mixer }, |
| 15172 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15173 | alc861vd_3stack_init_verbs }, |
| 15174 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15175 | .dac_nids = alc861vd_dac_nids, |
| 15176 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15177 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15178 | .input_mux = &alc861vd_capture_source, |
| 15179 | }, |
| 15180 | [ALC861VD_3ST_DIG] = { |
| 15181 | .mixers = { alc861vd_3st_mixer }, |
| 15182 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15183 | alc861vd_3stack_init_verbs }, |
| 15184 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15185 | .dac_nids = alc861vd_dac_nids, |
| 15186 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15187 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15188 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15189 | .input_mux = &alc861vd_capture_source, |
| 15190 | }, |
| 15191 | [ALC861VD_6ST_DIG] = { |
| 15192 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15193 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15194 | alc861vd_6stack_init_verbs }, |
| 15195 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15196 | .dac_nids = alc861vd_dac_nids, |
| 15197 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15198 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15199 | .channel_mode = alc861vd_6stack_modes, |
| 15200 | .input_mux = &alc861vd_capture_source, |
| 15201 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15202 | [ALC861VD_LENOVO] = { |
| 15203 | .mixers = { alc861vd_lenovo_mixer }, |
| 15204 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15205 | alc861vd_3stack_init_verbs, |
| 15206 | alc861vd_eapd_verbs, |
| 15207 | alc861vd_lenovo_unsol_verbs }, |
| 15208 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15209 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15210 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15211 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15212 | .input_mux = &alc861vd_capture_source, |
| 15213 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15214 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15215 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15216 | [ALC861VD_DALLAS] = { |
| 15217 | .mixers = { alc861vd_dallas_mixer }, |
| 15218 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15219 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15220 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15221 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15222 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15223 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15224 | .unsol_event = alc_automute_amp_unsol_event, |
| 15225 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15226 | }, |
| 15227 | [ALC861VD_HP] = { |
| 15228 | .mixers = { alc861vd_hp_mixer }, |
| 15229 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15230 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15231 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15232 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15233 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15234 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15235 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15236 | .unsol_event = alc_automute_amp_unsol_event, |
| 15237 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15238 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15239 | [ALC660VD_ASUS_V1S] = { |
| 15240 | .mixers = { alc861vd_lenovo_mixer }, |
| 15241 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15242 | alc861vd_3stack_init_verbs, |
| 15243 | alc861vd_eapd_verbs, |
| 15244 | alc861vd_lenovo_unsol_verbs }, |
| 15245 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15246 | .dac_nids = alc660vd_dac_nids, |
| 15247 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15248 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15249 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15250 | .input_mux = &alc861vd_capture_source, |
| 15251 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15252 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15253 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15254 | }; |
| 15255 | |
| 15256 | /* |
| 15257 | * BIOS auto configuration |
| 15258 | */ |
| 15259 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15260 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15261 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15262 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15263 | } |
| 15264 | |
| 15265 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15266 | { |
| 15267 | struct alc_spec *spec = codec->spec; |
| 15268 | int i; |
| 15269 | |
| 15270 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15271 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15272 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15273 | if (nid) |
| 15274 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15275 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15276 | } |
| 15277 | } |
| 15278 | |
| 15279 | |
| 15280 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15281 | { |
| 15282 | struct alc_spec *spec = codec->spec; |
| 15283 | hda_nid_t pin; |
| 15284 | |
| 15285 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15286 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15287 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15288 | pin = spec->autocfg.speaker_pins[0]; |
| 15289 | if (pin) |
| 15290 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15291 | } |
| 15292 | |
| 15293 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 15294 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15295 | |
| 15296 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15297 | { |
| 15298 | struct alc_spec *spec = codec->spec; |
| 15299 | int i; |
| 15300 | |
| 15301 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15302 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 15303 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15304 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15305 | if (nid != ALC861VD_PIN_CD_NID && |
| 15306 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15307 | snd_hda_codec_write(codec, nid, 0, |
| 15308 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15309 | AMP_OUT_MUTE); |
| 15310 | } |
| 15311 | } |
| 15312 | } |
| 15313 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15314 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15315 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15316 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15317 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15318 | |
| 15319 | /* add playback controls from the parsed DAC table */ |
| 15320 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15321 | * different NIDs for mute/unmute switch and volume control */ |
| 15322 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15323 | const struct auto_pin_cfg *cfg) |
| 15324 | { |
| 15325 | char name[32]; |
| 15326 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15327 | hda_nid_t nid_v, nid_s; |
| 15328 | int i, err; |
| 15329 | |
| 15330 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15331 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15332 | continue; |
| 15333 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15334 | alc880_dac_to_idx( |
| 15335 | spec->multiout.dac_nids[i])); |
| 15336 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15337 | alc880_dac_to_idx( |
| 15338 | spec->multiout.dac_nids[i])); |
| 15339 | |
| 15340 | if (i == 2) { |
| 15341 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15342 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15343 | "Center Playback Volume", |
| 15344 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15345 | HDA_OUTPUT)); |
| 15346 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15347 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15348 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15349 | "LFE Playback Volume", |
| 15350 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15351 | HDA_OUTPUT)); |
| 15352 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15353 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15354 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15355 | "Center Playback Switch", |
| 15356 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15357 | HDA_INPUT)); |
| 15358 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15359 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15360 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15361 | "LFE Playback Switch", |
| 15362 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15363 | HDA_INPUT)); |
| 15364 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15365 | return err; |
| 15366 | } else { |
| 15367 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15368 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15369 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15370 | HDA_OUTPUT)); |
| 15371 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15372 | return err; |
| 15373 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15374 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15375 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15376 | HDA_INPUT)); |
| 15377 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15378 | return err; |
| 15379 | } |
| 15380 | } |
| 15381 | return 0; |
| 15382 | } |
| 15383 | |
| 15384 | /* add playback controls for speaker and HP outputs */ |
| 15385 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15386 | * different NIDs for mute/unmute switch and volume control */ |
| 15387 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15388 | hda_nid_t pin, const char *pfx) |
| 15389 | { |
| 15390 | hda_nid_t nid_v, nid_s; |
| 15391 | int err; |
| 15392 | char name[32]; |
| 15393 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15394 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15395 | return 0; |
| 15396 | |
| 15397 | if (alc880_is_fixed_pin(pin)) { |
| 15398 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15399 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15400 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15401 | spec->multiout.hp_nid = nid_v; |
| 15402 | else |
| 15403 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15404 | /* control HP volume/switch on the output mixer amp */ |
| 15405 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15406 | alc880_fixed_pin_idx(pin)); |
| 15407 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15408 | alc880_fixed_pin_idx(pin)); |
| 15409 | |
| 15410 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15411 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15412 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15413 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15414 | return err; |
| 15415 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15416 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15417 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15418 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15419 | return err; |
| 15420 | } else if (alc880_is_multi_pin(pin)) { |
| 15421 | /* set manual connection */ |
| 15422 | /* we have only a switch on HP-out PIN */ |
| 15423 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15424 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15425 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15426 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15427 | return err; |
| 15428 | } |
| 15429 | return 0; |
| 15430 | } |
| 15431 | |
| 15432 | /* parse the BIOS configuration and set up the alc_spec |
| 15433 | * return 1 if successful, 0 if the proper config is not found, |
| 15434 | * or a negative error code |
| 15435 | * Based on ALC880 version - had to change it to override |
| 15436 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15437 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15438 | { |
| 15439 | struct alc_spec *spec = codec->spec; |
| 15440 | int err; |
| 15441 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15442 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15443 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15444 | alc861vd_ignore); |
| 15445 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15446 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15447 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15448 | return 0; /* can't find valid BIOS pin config */ |
| 15449 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15450 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15451 | if (err < 0) |
| 15452 | return err; |
| 15453 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15454 | if (err < 0) |
| 15455 | return err; |
| 15456 | err = alc861vd_auto_create_extra_out(spec, |
| 15457 | spec->autocfg.speaker_pins[0], |
| 15458 | "Speaker"); |
| 15459 | if (err < 0) |
| 15460 | return err; |
| 15461 | err = alc861vd_auto_create_extra_out(spec, |
| 15462 | spec->autocfg.hp_pins[0], |
| 15463 | "Headphone"); |
| 15464 | if (err < 0) |
| 15465 | return err; |
| 15466 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15467 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15468 | return err; |
| 15469 | |
| 15470 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15471 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15472 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15473 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15474 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15475 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15476 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15477 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15478 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15479 | |
| 15480 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15481 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15482 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15483 | err = alc_auto_add_mic_boost(codec); |
| 15484 | if (err < 0) |
| 15485 | return err; |
| 15486 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15487 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15488 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15489 | return 1; |
| 15490 | } |
| 15491 | |
| 15492 | /* additional initialization for auto-configuration model */ |
| 15493 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15494 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15495 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15496 | alc861vd_auto_init_multi_out(codec); |
| 15497 | alc861vd_auto_init_hp_out(codec); |
| 15498 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15499 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15500 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15501 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15502 | } |
| 15503 | |
| 15504 | static int patch_alc861vd(struct hda_codec *codec) |
| 15505 | { |
| 15506 | struct alc_spec *spec; |
| 15507 | int err, board_config; |
| 15508 | |
| 15509 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15510 | if (spec == NULL) |
| 15511 | return -ENOMEM; |
| 15512 | |
| 15513 | codec->spec = spec; |
| 15514 | |
| 15515 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15516 | alc861vd_models, |
| 15517 | alc861vd_cfg_tbl); |
| 15518 | |
| 15519 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 15520 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 15521 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15522 | board_config = ALC861VD_AUTO; |
| 15523 | } |
| 15524 | |
| 15525 | if (board_config == ALC861VD_AUTO) { |
| 15526 | /* automatic parse from the BIOS config */ |
| 15527 | err = alc861vd_parse_auto_config(codec); |
| 15528 | if (err < 0) { |
| 15529 | alc_free(codec); |
| 15530 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15531 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15532 | printk(KERN_INFO |
| 15533 | "hda_codec: Cannot set up configuration " |
| 15534 | "from BIOS. Using base mode...\n"); |
| 15535 | board_config = ALC861VD_3ST; |
| 15536 | } |
| 15537 | } |
| 15538 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15539 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15540 | if (err < 0) { |
| 15541 | alc_free(codec); |
| 15542 | return err; |
| 15543 | } |
| 15544 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15545 | if (board_config != ALC861VD_AUTO) |
| 15546 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15547 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15548 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15549 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15550 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15551 | } |
| 15552 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15553 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15554 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15555 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15556 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15557 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15558 | |
| 15559 | spec->adc_nids = alc861vd_adc_nids; |
| 15560 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15561 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15562 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15563 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15564 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15565 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15566 | spec->vmaster_nid = 0x02; |
| 15567 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15568 | codec->patch_ops = alc_patch_ops; |
| 15569 | |
| 15570 | if (board_config == ALC861VD_AUTO) |
| 15571 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15572 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15573 | if (!spec->loopback.amplist) |
| 15574 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15575 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15576 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15577 | |
| 15578 | return 0; |
| 15579 | } |
| 15580 | |
| 15581 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15582 | * ALC662 support |
| 15583 | * |
| 15584 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15585 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15586 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15587 | * 6-channel independent captures. |
| 15588 | * |
| 15589 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15590 | * driver yet). |
| 15591 | */ |
| 15592 | #define ALC662_DIGOUT_NID 0x06 |
| 15593 | #define ALC662_DIGIN_NID 0x0a |
| 15594 | |
| 15595 | static hda_nid_t alc662_dac_nids[4] = { |
| 15596 | /* front, rear, clfe, rear_surr */ |
| 15597 | 0x02, 0x03, 0x04 |
| 15598 | }; |
| 15599 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15600 | static hda_nid_t alc272_dac_nids[2] = { |
| 15601 | 0x02, 0x03 |
| 15602 | }; |
| 15603 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15604 | static hda_nid_t alc662_adc_nids[1] = { |
| 15605 | /* ADC1-2 */ |
| 15606 | 0x09, |
| 15607 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15608 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15609 | static hda_nid_t alc272_adc_nids[1] = { |
| 15610 | /* ADC1-2 */ |
| 15611 | 0x08, |
| 15612 | }; |
| 15613 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15614 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15615 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15616 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15617 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15618 | /* input MUX */ |
| 15619 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15620 | static struct hda_input_mux alc662_capture_source = { |
| 15621 | .num_items = 4, |
| 15622 | .items = { |
| 15623 | { "Mic", 0x0 }, |
| 15624 | { "Front Mic", 0x1 }, |
| 15625 | { "Line", 0x2 }, |
| 15626 | { "CD", 0x4 }, |
| 15627 | }, |
| 15628 | }; |
| 15629 | |
| 15630 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15631 | .num_items = 2, |
| 15632 | .items = { |
| 15633 | { "Mic", 0x1 }, |
| 15634 | { "Line", 0x2 }, |
| 15635 | }, |
| 15636 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15637 | |
| 15638 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15639 | .num_items = 2, |
| 15640 | .items = { |
| 15641 | { "i-Mic", 0x1 }, |
| 15642 | { "e-Mic", 0x0 }, |
| 15643 | }, |
| 15644 | }; |
| 15645 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15646 | static struct hda_input_mux alc663_capture_source = { |
| 15647 | .num_items = 3, |
| 15648 | .items = { |
| 15649 | { "Mic", 0x0 }, |
| 15650 | { "Front Mic", 0x1 }, |
| 15651 | { "Line", 0x2 }, |
| 15652 | }, |
| 15653 | }; |
| 15654 | |
| 15655 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15656 | .num_items = 2, |
| 15657 | .items = { |
| 15658 | { "Ext-Mic", 0x0 }, |
| 15659 | { "D-Mic", 0x9 }, |
| 15660 | }, |
| 15661 | }; |
| 15662 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15663 | #if 1 /* set to 0 for testing other input sources below */ |
| 15664 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15665 | .num_items = 2, |
| 15666 | .items = { |
| 15667 | { "Autoselect Mic", 0x0 }, |
| 15668 | { "Internal Mic", 0x1 }, |
| 15669 | }, |
| 15670 | }; |
| 15671 | #else |
| 15672 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15673 | .num_items = 16, |
| 15674 | .items = { |
| 15675 | { "Autoselect Mic", 0x0 }, |
| 15676 | { "Internal Mic", 0x1 }, |
| 15677 | { "In-0x02", 0x2 }, |
| 15678 | { "In-0x03", 0x3 }, |
| 15679 | { "In-0x04", 0x4 }, |
| 15680 | { "In-0x05", 0x5 }, |
| 15681 | { "In-0x06", 0x6 }, |
| 15682 | { "In-0x07", 0x7 }, |
| 15683 | { "In-0x08", 0x8 }, |
| 15684 | { "In-0x09", 0x9 }, |
| 15685 | { "In-0x0a", 0x0a }, |
| 15686 | { "In-0x0b", 0x0b }, |
| 15687 | { "In-0x0c", 0x0c }, |
| 15688 | { "In-0x0d", 0x0d }, |
| 15689 | { "In-0x0e", 0x0e }, |
| 15690 | { "In-0x0f", 0x0f }, |
| 15691 | }, |
| 15692 | }; |
| 15693 | #endif |
| 15694 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15695 | /* |
| 15696 | * 2ch mode |
| 15697 | */ |
| 15698 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15699 | { 2, NULL } |
| 15700 | }; |
| 15701 | |
| 15702 | /* |
| 15703 | * 2ch mode |
| 15704 | */ |
| 15705 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15706 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15707 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15708 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15709 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15710 | { } /* end */ |
| 15711 | }; |
| 15712 | |
| 15713 | /* |
| 15714 | * 6ch mode |
| 15715 | */ |
| 15716 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15717 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15718 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15719 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15720 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15721 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15722 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15723 | { } /* end */ |
| 15724 | }; |
| 15725 | |
| 15726 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15727 | { 2, alc662_3ST_ch2_init }, |
| 15728 | { 6, alc662_3ST_ch6_init }, |
| 15729 | }; |
| 15730 | |
| 15731 | /* |
| 15732 | * 2ch mode |
| 15733 | */ |
| 15734 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15735 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15736 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15737 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15738 | { } /* end */ |
| 15739 | }; |
| 15740 | |
| 15741 | /* |
| 15742 | * 6ch mode |
| 15743 | */ |
| 15744 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15745 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15746 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15747 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15748 | { } /* end */ |
| 15749 | }; |
| 15750 | |
| 15751 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15752 | { 2, alc662_sixstack_ch6_init }, |
| 15753 | { 6, alc662_sixstack_ch8_init }, |
| 15754 | }; |
| 15755 | |
| 15756 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15757 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15758 | */ |
| 15759 | |
| 15760 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15761 | /* output mixer control */ |
| 15762 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15763 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15764 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15765 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15766 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15767 | 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] | 15768 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15769 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15770 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15771 | |
| 15772 | /*Input mixer control */ |
| 15773 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15774 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15775 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15776 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15777 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15778 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15779 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15780 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15781 | { } /* end */ |
| 15782 | }; |
| 15783 | |
| 15784 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15785 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15786 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15787 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15788 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15789 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15790 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15791 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15792 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15793 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15794 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15795 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15796 | { } /* end */ |
| 15797 | }; |
| 15798 | |
| 15799 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15800 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15801 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15802 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15803 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15804 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15805 | 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] | 15806 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15807 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15808 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15809 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15810 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15811 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15812 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15813 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15814 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15815 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15816 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15817 | { } /* end */ |
| 15818 | }; |
| 15819 | |
| 15820 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15821 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15822 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15823 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15824 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15825 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15826 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15827 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15828 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15829 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15830 | { } /* end */ |
| 15831 | }; |
| 15832 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15833 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15834 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15835 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15836 | |
| 15837 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15838 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15839 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15840 | |
| 15841 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15842 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15843 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15844 | { } /* end */ |
| 15845 | }; |
| 15846 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15847 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15848 | ALC262_HIPPO_MASTER_SWITCH, |
| 15849 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15850 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15851 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15852 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15853 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15854 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15855 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15856 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15857 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15858 | { } /* end */ |
| 15859 | }; |
| 15860 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15861 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15862 | .ops = &snd_hda_bind_vol, |
| 15863 | .values = { |
| 15864 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15865 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15866 | 0 |
| 15867 | }, |
| 15868 | }; |
| 15869 | |
| 15870 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15871 | .ops = &snd_hda_bind_sw, |
| 15872 | .values = { |
| 15873 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15874 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15875 | 0 |
| 15876 | }, |
| 15877 | }; |
| 15878 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15879 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15880 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15881 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15882 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15883 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15884 | { } /* end */ |
| 15885 | }; |
| 15886 | |
| 15887 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15888 | .ops = &snd_hda_bind_sw, |
| 15889 | .values = { |
| 15890 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15891 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15892 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15893 | 0 |
| 15894 | }, |
| 15895 | }; |
| 15896 | |
| 15897 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15898 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15899 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15900 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15901 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15902 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15903 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15904 | |
| 15905 | { } /* end */ |
| 15906 | }; |
| 15907 | |
| 15908 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15909 | .ops = &snd_hda_bind_sw, |
| 15910 | .values = { |
| 15911 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15912 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15913 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15914 | 0 |
| 15915 | }, |
| 15916 | }; |
| 15917 | |
| 15918 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15919 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15920 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15921 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15922 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15923 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15924 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15925 | { } /* end */ |
| 15926 | }; |
| 15927 | |
| 15928 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15929 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15930 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15931 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15932 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15933 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15934 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15935 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15936 | { } /* end */ |
| 15937 | }; |
| 15938 | |
| 15939 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15940 | .ops = &snd_hda_bind_vol, |
| 15941 | .values = { |
| 15942 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15943 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15944 | 0 |
| 15945 | }, |
| 15946 | }; |
| 15947 | |
| 15948 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15949 | .ops = &snd_hda_bind_sw, |
| 15950 | .values = { |
| 15951 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15952 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15953 | 0 |
| 15954 | }, |
| 15955 | }; |
| 15956 | |
| 15957 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15958 | HDA_BIND_VOL("Master Playback Volume", |
| 15959 | &alc663_asus_two_bind_master_vol), |
| 15960 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15961 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15962 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15963 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15964 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15965 | { } /* end */ |
| 15966 | }; |
| 15967 | |
| 15968 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15969 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15970 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15971 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15972 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15973 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15974 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15975 | { } /* end */ |
| 15976 | }; |
| 15977 | |
| 15978 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15979 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15980 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15981 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15982 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15983 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15984 | |
| 15985 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15986 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15987 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15988 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15989 | { } /* end */ |
| 15990 | }; |
| 15991 | |
| 15992 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15993 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15994 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15995 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15996 | |
| 15997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15998 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15999 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16000 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16001 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16002 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16003 | { } /* end */ |
| 16004 | }; |
| 16005 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16006 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 16007 | { |
| 16008 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16009 | .name = "Channel Mode", |
| 16010 | .info = alc_ch_mode_info, |
| 16011 | .get = alc_ch_mode_get, |
| 16012 | .put = alc_ch_mode_put, |
| 16013 | }, |
| 16014 | { } /* end */ |
| 16015 | }; |
| 16016 | |
| 16017 | static struct hda_verb alc662_init_verbs[] = { |
| 16018 | /* ADC: mute amp left and right */ |
| 16019 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16020 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16021 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 16022 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16023 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16024 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16025 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16026 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16027 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16028 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16029 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16030 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16031 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16032 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16033 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16034 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16035 | |
| 16036 | /* Front Pin: output 0 (0x0c) */ |
| 16037 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16038 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16039 | |
| 16040 | /* Rear Pin: output 1 (0x0d) */ |
| 16041 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16042 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16043 | |
| 16044 | /* CLFE Pin: output 2 (0x0e) */ |
| 16045 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16046 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16047 | |
| 16048 | /* Mic (rear) pin: input vref at 80% */ |
| 16049 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16050 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16051 | /* Front Mic pin: input vref at 80% */ |
| 16052 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16053 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16054 | /* Line In pin: input */ |
| 16055 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16056 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16057 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16058 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16059 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16060 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16061 | /* CD pin widget for input */ |
| 16062 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16063 | |
| 16064 | /* FIXME: use matrix-type input source selection */ |
| 16065 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16066 | /* Input mixer */ |
| 16067 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16068 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16069 | |
| 16070 | /* always trun on EAPD */ |
| 16071 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16072 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16073 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16074 | { } |
| 16075 | }; |
| 16076 | |
| 16077 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 16078 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16079 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16080 | {} |
| 16081 | }; |
| 16082 | |
| 16083 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 16084 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16085 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16086 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16087 | }; |
| 16088 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16089 | /* Set Unsolicited Event*/ |
| 16090 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 16091 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16092 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16093 | {} |
| 16094 | }; |
| 16095 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16096 | /* |
| 16097 | * generic initialization of ADC, input mixers and output mixers |
| 16098 | */ |
| 16099 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 16100 | /* |
| 16101 | * Unmute ADC and set the default input to mic-in |
| 16102 | */ |
| 16103 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16104 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16105 | |
| 16106 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 16107 | * mixer widget |
| 16108 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 16109 | * panel mic (mic 2) |
| 16110 | */ |
| 16111 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16117 | |
| 16118 | /* |
| 16119 | * Set up output mixers (0x0c - 0x0f) |
| 16120 | */ |
| 16121 | /* set vol=0 to output mixers */ |
| 16122 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16123 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16124 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16125 | |
| 16126 | /* set up input amps for analog loopback */ |
| 16127 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16128 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16130 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16131 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16132 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16133 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16134 | |
| 16135 | |
| 16136 | /* FIXME: use matrix-type input source selection */ |
| 16137 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16138 | /* Input mixer */ |
| 16139 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16140 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16141 | { } |
| 16142 | }; |
| 16143 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16144 | /* additional verbs for ALC663 */ |
| 16145 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16146 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16147 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16148 | { } |
| 16149 | }; |
| 16150 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16151 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16152 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16153 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16154 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16155 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16156 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16157 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16158 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16159 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16160 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16161 | {} |
| 16162 | }; |
| 16163 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16164 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16165 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16166 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16167 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16168 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16169 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16170 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16171 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16172 | {} |
| 16173 | }; |
| 16174 | |
| 16175 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16176 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16177 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16178 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16179 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16180 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16181 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16182 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16183 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16184 | {} |
| 16185 | }; |
| 16186 | |
| 16187 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16188 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16189 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16190 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16191 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16192 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16193 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16194 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16195 | {} |
| 16196 | }; |
| 16197 | |
| 16198 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16199 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16200 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16201 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16202 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16203 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16204 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16205 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16206 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16207 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16208 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16209 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_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_m2_init_verbs[] = { |
| 16215 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16216 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16217 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16218 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* 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, 0x01}, /* 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 | {0x1b, 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 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16230 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16231 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16232 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16233 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16234 | |
| 16235 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16236 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16237 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16238 | |
| 16239 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16240 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16241 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16242 | {} |
| 16243 | }; |
| 16244 | |
| 16245 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16246 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16247 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16248 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16249 | |
| 16250 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16251 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16252 | {} |
| 16253 | }; |
| 16254 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16255 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16256 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16257 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16258 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16259 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16260 | {} |
| 16261 | }; |
| 16262 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16263 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16264 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16265 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16266 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16267 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16268 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16269 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16270 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16271 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16272 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16273 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16274 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16275 | {} |
| 16276 | }; |
| 16277 | |
| 16278 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16279 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16280 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16281 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16282 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16283 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16284 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16285 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16286 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16287 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16288 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16289 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16290 | {} |
| 16291 | }; |
| 16292 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16293 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16294 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16295 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16296 | { } /* end */ |
| 16297 | }; |
| 16298 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16299 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16300 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16301 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16302 | { } /* end */ |
| 16303 | }; |
| 16304 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16305 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16306 | { |
| 16307 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16308 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16309 | |
| 16310 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16311 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16312 | bits = present ? HDA_AMP_MUTE : 0; |
| 16313 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16314 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16315 | } |
| 16316 | |
| 16317 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16318 | { |
| 16319 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16320 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16321 | |
| 16322 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16323 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16324 | bits = present ? HDA_AMP_MUTE : 0; |
| 16325 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16326 | HDA_AMP_MUTE, bits); |
| 16327 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16328 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16329 | } |
| 16330 | |
| 16331 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16332 | unsigned int res) |
| 16333 | { |
| 16334 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16335 | alc662_lenovo_101e_all_automute(codec); |
| 16336 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16337 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16338 | } |
| 16339 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16340 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 16341 | { |
| 16342 | unsigned int present; |
| 16343 | |
| 16344 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 16345 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 16346 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16347 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16348 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16349 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16350 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16351 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16352 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16353 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16354 | } |
| 16355 | |
| 16356 | /* unsolicited event for HP jack sensing */ |
| 16357 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16358 | unsigned int res) |
| 16359 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16360 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 16361 | alc662_eeepc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16362 | else |
| 16363 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16364 | } |
| 16365 | |
| 16366 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16367 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16368 | alc262_hippo1_init_hook(codec); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16369 | alc662_eeepc_mic_automute(codec); |
| 16370 | } |
| 16371 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16372 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 16373 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16374 | struct alc_spec *spec = codec->spec; |
| 16375 | |
| 16376 | spec->autocfg.hp_pins[0] = 0x14; |
| 16377 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 16378 | alc262_hippo_master_update(codec); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16379 | } |
| 16380 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16381 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16382 | { |
| 16383 | unsigned int present; |
| 16384 | unsigned char bits; |
| 16385 | |
| 16386 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16387 | AC_VERB_GET_PIN_SENSE, 0) |
| 16388 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16389 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16390 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16391 | AMP_IN_MUTE(0), bits); |
| 16392 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16393 | AMP_IN_MUTE(0), bits); |
| 16394 | } |
| 16395 | |
| 16396 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16397 | { |
| 16398 | unsigned int present; |
| 16399 | unsigned char bits; |
| 16400 | |
| 16401 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16402 | AC_VERB_GET_PIN_SENSE, 0) |
| 16403 | & AC_PINSENSE_PRESENCE; |
| 16404 | bits = present ? HDA_AMP_MUTE : 0; |
| 16405 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16406 | AMP_IN_MUTE(0), bits); |
| 16407 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16408 | AMP_IN_MUTE(0), bits); |
| 16409 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16410 | AMP_IN_MUTE(0), bits); |
| 16411 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16412 | AMP_IN_MUTE(0), bits); |
| 16413 | } |
| 16414 | |
| 16415 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16416 | { |
| 16417 | unsigned int present; |
| 16418 | unsigned char bits; |
| 16419 | |
| 16420 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16421 | AC_VERB_GET_PIN_SENSE, 0) |
| 16422 | & AC_PINSENSE_PRESENCE; |
| 16423 | bits = present ? HDA_AMP_MUTE : 0; |
| 16424 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16425 | AMP_IN_MUTE(0), bits); |
| 16426 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16427 | AMP_IN_MUTE(0), bits); |
| 16428 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16429 | AMP_IN_MUTE(0), bits); |
| 16430 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16431 | AMP_IN_MUTE(0), bits); |
| 16432 | } |
| 16433 | |
| 16434 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16435 | { |
| 16436 | unsigned int present; |
| 16437 | unsigned char bits; |
| 16438 | |
| 16439 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16440 | AC_VERB_GET_PIN_SENSE, 0) |
| 16441 | & AC_PINSENSE_PRESENCE; |
| 16442 | bits = present ? 0 : PIN_OUT; |
| 16443 | snd_hda_codec_write(codec, 0x14, 0, |
| 16444 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16445 | } |
| 16446 | |
| 16447 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16448 | { |
| 16449 | unsigned int present1, present2; |
| 16450 | |
| 16451 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16452 | AC_VERB_GET_PIN_SENSE, 0) |
| 16453 | & AC_PINSENSE_PRESENCE; |
| 16454 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16455 | AC_VERB_GET_PIN_SENSE, 0) |
| 16456 | & AC_PINSENSE_PRESENCE; |
| 16457 | |
| 16458 | if (present1 || present2) { |
| 16459 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16460 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16461 | } else { |
| 16462 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16463 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16464 | } |
| 16465 | } |
| 16466 | |
| 16467 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16468 | { |
| 16469 | unsigned int present1, present2; |
| 16470 | |
| 16471 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16472 | AC_VERB_GET_PIN_SENSE, 0) |
| 16473 | & AC_PINSENSE_PRESENCE; |
| 16474 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16475 | AC_VERB_GET_PIN_SENSE, 0) |
| 16476 | & AC_PINSENSE_PRESENCE; |
| 16477 | |
| 16478 | if (present1 || present2) { |
| 16479 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16480 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16481 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16482 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16483 | } else { |
| 16484 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16485 | AMP_IN_MUTE(0), 0); |
| 16486 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16487 | AMP_IN_MUTE(0), 0); |
| 16488 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16489 | } |
| 16490 | |
| 16491 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16492 | { |
| 16493 | unsigned int present; |
| 16494 | |
| 16495 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16496 | AC_VERB_GET_PIN_SENSE, 0) |
| 16497 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16498 | 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] | 16499 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16500 | 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] | 16501 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16502 | 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] | 16503 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16504 | 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] | 16505 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16506 | } |
| 16507 | |
| 16508 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16509 | unsigned int res) |
| 16510 | { |
| 16511 | switch (res >> 26) { |
| 16512 | case ALC880_HP_EVENT: |
| 16513 | alc663_m51va_speaker_automute(codec); |
| 16514 | break; |
| 16515 | case ALC880_MIC_EVENT: |
| 16516 | alc663_m51va_mic_automute(codec); |
| 16517 | break; |
| 16518 | } |
| 16519 | } |
| 16520 | |
| 16521 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16522 | { |
| 16523 | alc663_m51va_speaker_automute(codec); |
| 16524 | alc663_m51va_mic_automute(codec); |
| 16525 | } |
| 16526 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16527 | /* ***************** Mode1 ******************************/ |
| 16528 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16529 | unsigned int res) |
| 16530 | { |
| 16531 | switch (res >> 26) { |
| 16532 | case ALC880_HP_EVENT: |
| 16533 | alc663_m51va_speaker_automute(codec); |
| 16534 | break; |
| 16535 | case ALC880_MIC_EVENT: |
| 16536 | alc662_eeepc_mic_automute(codec); |
| 16537 | break; |
| 16538 | } |
| 16539 | } |
| 16540 | |
| 16541 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16542 | { |
| 16543 | alc663_m51va_speaker_automute(codec); |
| 16544 | alc662_eeepc_mic_automute(codec); |
| 16545 | } |
| 16546 | /* ***************** Mode2 ******************************/ |
| 16547 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16548 | unsigned int res) |
| 16549 | { |
| 16550 | switch (res >> 26) { |
| 16551 | case ALC880_HP_EVENT: |
| 16552 | alc662_f5z_speaker_automute(codec); |
| 16553 | break; |
| 16554 | case ALC880_MIC_EVENT: |
| 16555 | alc662_eeepc_mic_automute(codec); |
| 16556 | break; |
| 16557 | } |
| 16558 | } |
| 16559 | |
| 16560 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16561 | { |
| 16562 | alc662_f5z_speaker_automute(codec); |
| 16563 | alc662_eeepc_mic_automute(codec); |
| 16564 | } |
| 16565 | /* ***************** Mode3 ******************************/ |
| 16566 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16567 | unsigned int res) |
| 16568 | { |
| 16569 | switch (res >> 26) { |
| 16570 | case ALC880_HP_EVENT: |
| 16571 | alc663_two_hp_m1_speaker_automute(codec); |
| 16572 | break; |
| 16573 | case ALC880_MIC_EVENT: |
| 16574 | alc662_eeepc_mic_automute(codec); |
| 16575 | break; |
| 16576 | } |
| 16577 | } |
| 16578 | |
| 16579 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16580 | { |
| 16581 | alc663_two_hp_m1_speaker_automute(codec); |
| 16582 | alc662_eeepc_mic_automute(codec); |
| 16583 | } |
| 16584 | /* ***************** Mode4 ******************************/ |
| 16585 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16586 | unsigned int res) |
| 16587 | { |
| 16588 | switch (res >> 26) { |
| 16589 | case ALC880_HP_EVENT: |
| 16590 | alc663_21jd_two_speaker_automute(codec); |
| 16591 | break; |
| 16592 | case ALC880_MIC_EVENT: |
| 16593 | alc662_eeepc_mic_automute(codec); |
| 16594 | break; |
| 16595 | } |
| 16596 | } |
| 16597 | |
| 16598 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16599 | { |
| 16600 | alc663_21jd_two_speaker_automute(codec); |
| 16601 | alc662_eeepc_mic_automute(codec); |
| 16602 | } |
| 16603 | /* ***************** Mode5 ******************************/ |
| 16604 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16605 | unsigned int res) |
| 16606 | { |
| 16607 | switch (res >> 26) { |
| 16608 | case ALC880_HP_EVENT: |
| 16609 | alc663_15jd_two_speaker_automute(codec); |
| 16610 | break; |
| 16611 | case ALC880_MIC_EVENT: |
| 16612 | alc662_eeepc_mic_automute(codec); |
| 16613 | break; |
| 16614 | } |
| 16615 | } |
| 16616 | |
| 16617 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16618 | { |
| 16619 | alc663_15jd_two_speaker_automute(codec); |
| 16620 | alc662_eeepc_mic_automute(codec); |
| 16621 | } |
| 16622 | /* ***************** Mode6 ******************************/ |
| 16623 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16624 | unsigned int res) |
| 16625 | { |
| 16626 | switch (res >> 26) { |
| 16627 | case ALC880_HP_EVENT: |
| 16628 | alc663_two_hp_m2_speaker_automute(codec); |
| 16629 | break; |
| 16630 | case ALC880_MIC_EVENT: |
| 16631 | alc662_eeepc_mic_automute(codec); |
| 16632 | break; |
| 16633 | } |
| 16634 | } |
| 16635 | |
| 16636 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16637 | { |
| 16638 | alc663_two_hp_m2_speaker_automute(codec); |
| 16639 | alc662_eeepc_mic_automute(codec); |
| 16640 | } |
| 16641 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16642 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16643 | { |
| 16644 | unsigned int present; |
| 16645 | unsigned char bits; |
| 16646 | |
| 16647 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16648 | AC_VERB_GET_PIN_SENSE, 0) |
| 16649 | & AC_PINSENSE_PRESENCE; |
| 16650 | bits = present ? HDA_AMP_MUTE : 0; |
| 16651 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16652 | HDA_AMP_MUTE, bits); |
| 16653 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16654 | HDA_AMP_MUTE, bits); |
| 16655 | } |
| 16656 | |
| 16657 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16658 | { |
| 16659 | unsigned int present; |
| 16660 | unsigned char bits; |
| 16661 | |
| 16662 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16663 | AC_VERB_GET_PIN_SENSE, 0) |
| 16664 | & AC_PINSENSE_PRESENCE; |
| 16665 | bits = present ? HDA_AMP_MUTE : 0; |
| 16666 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16667 | HDA_AMP_MUTE, bits); |
| 16668 | } |
| 16669 | |
| 16670 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16671 | unsigned int res) |
| 16672 | { |
| 16673 | switch (res >> 26) { |
| 16674 | case ALC880_HP_EVENT: |
| 16675 | alc663_g71v_hp_automute(codec); |
| 16676 | break; |
| 16677 | case ALC880_FRONT_EVENT: |
| 16678 | alc663_g71v_front_automute(codec); |
| 16679 | break; |
| 16680 | case ALC880_MIC_EVENT: |
| 16681 | alc662_eeepc_mic_automute(codec); |
| 16682 | break; |
| 16683 | } |
| 16684 | } |
| 16685 | |
| 16686 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16687 | { |
| 16688 | alc663_g71v_front_automute(codec); |
| 16689 | alc663_g71v_hp_automute(codec); |
| 16690 | alc662_eeepc_mic_automute(codec); |
| 16691 | } |
| 16692 | |
| 16693 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16694 | unsigned int res) |
| 16695 | { |
| 16696 | switch (res >> 26) { |
| 16697 | case ALC880_HP_EVENT: |
| 16698 | alc663_m51va_speaker_automute(codec); |
| 16699 | break; |
| 16700 | case ALC880_MIC_EVENT: |
| 16701 | alc662_eeepc_mic_automute(codec); |
| 16702 | break; |
| 16703 | } |
| 16704 | } |
| 16705 | |
| 16706 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16707 | { |
| 16708 | alc663_m51va_speaker_automute(codec); |
| 16709 | alc662_eeepc_mic_automute(codec); |
| 16710 | } |
| 16711 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16712 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16713 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16714 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16715 | |
| 16716 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16717 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16718 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16719 | |
| 16720 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16721 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16722 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16723 | { } /* end */ |
| 16724 | }; |
| 16725 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16726 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16727 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16728 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16729 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16730 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16731 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16732 | |
| 16733 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16734 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16735 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16736 | |
| 16737 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16738 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16739 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16740 | { } /* end */ |
| 16741 | }; |
| 16742 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16743 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16744 | #define alc662_loopbacks alc880_loopbacks |
| 16745 | #endif |
| 16746 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16747 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16748 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16749 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16750 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16751 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16752 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16753 | |
| 16754 | /* |
| 16755 | * configuration and preset |
| 16756 | */ |
| 16757 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16758 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16759 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16760 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16761 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16762 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16763 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16764 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16765 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16766 | [ALC663_ASUS_M51VA] = "m51va", |
| 16767 | [ALC663_ASUS_G71V] = "g71v", |
| 16768 | [ALC663_ASUS_H13] = "h13", |
| 16769 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16770 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16771 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16772 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16773 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16774 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16775 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16776 | [ALC272_DELL] = "dell", |
| 16777 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16778 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16779 | [ALC662_AUTO] = "auto", |
| 16780 | }; |
| 16781 | |
| 16782 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16783 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16784 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16785 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16786 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16787 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16788 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16789 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16790 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16791 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16792 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16793 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16794 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16795 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16796 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16797 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16798 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16799 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16800 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16801 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16802 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16803 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16804 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16805 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16806 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16807 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16808 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16809 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16810 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16811 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16812 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16813 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16814 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16815 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16816 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16817 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16818 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16819 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16820 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16821 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16822 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16823 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16824 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16825 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16826 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16827 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16828 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16829 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16830 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16831 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16832 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16833 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16834 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16835 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16836 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16837 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16838 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16839 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16840 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16841 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16842 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16843 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16844 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16845 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16846 | {} |
| 16847 | }; |
| 16848 | |
| 16849 | static struct alc_config_preset alc662_presets[] = { |
| 16850 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16851 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16852 | .init_verbs = { alc662_init_verbs }, |
| 16853 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16854 | .dac_nids = alc662_dac_nids, |
| 16855 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16856 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16857 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16858 | .channel_mode = alc662_3ST_2ch_modes, |
| 16859 | .input_mux = &alc662_capture_source, |
| 16860 | }, |
| 16861 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16862 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16863 | .init_verbs = { alc662_init_verbs }, |
| 16864 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16865 | .dac_nids = alc662_dac_nids, |
| 16866 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16867 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16868 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16869 | .channel_mode = alc662_3ST_6ch_modes, |
| 16870 | .need_dac_fix = 1, |
| 16871 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16872 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16873 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16874 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16875 | .init_verbs = { alc662_init_verbs }, |
| 16876 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16877 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16878 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16879 | .channel_mode = alc662_3ST_6ch_modes, |
| 16880 | .need_dac_fix = 1, |
| 16881 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16882 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16883 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16884 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16885 | .init_verbs = { alc662_init_verbs }, |
| 16886 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16887 | .dac_nids = alc662_dac_nids, |
| 16888 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16889 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16890 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16891 | .channel_mode = alc662_5stack_modes, |
| 16892 | .input_mux = &alc662_capture_source, |
| 16893 | }, |
| 16894 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16895 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16896 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16897 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16898 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16899 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16900 | .channel_mode = alc662_3ST_2ch_modes, |
| 16901 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16902 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16903 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16904 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16905 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16906 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16907 | .init_verbs = { alc662_init_verbs, |
| 16908 | alc662_eeepc_sue_init_verbs }, |
| 16909 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16910 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16911 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16912 | .channel_mode = alc662_3ST_2ch_modes, |
| 16913 | .input_mux = &alc662_eeepc_capture_source, |
| 16914 | .unsol_event = alc662_eeepc_unsol_event, |
| 16915 | .init_hook = alc662_eeepc_inithook, |
| 16916 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16917 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16918 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16919 | alc662_chmode_mixer }, |
| 16920 | .init_verbs = { alc662_init_verbs, |
| 16921 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16922 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16923 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16924 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16925 | .channel_mode = alc662_3ST_6ch_modes, |
| 16926 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16927 | .unsol_event = alc662_eeepc_unsol_event, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16928 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16929 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16930 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16931 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16932 | .init_verbs = { alc662_init_verbs, |
| 16933 | alc662_ecs_init_verbs }, |
| 16934 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16935 | .dac_nids = alc662_dac_nids, |
| 16936 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16937 | .channel_mode = alc662_3ST_2ch_modes, |
| 16938 | .input_mux = &alc662_eeepc_capture_source, |
| 16939 | .unsol_event = alc662_eeepc_unsol_event, |
| 16940 | .init_hook = alc662_eeepc_inithook, |
| 16941 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16942 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16943 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16944 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16945 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16946 | .dac_nids = alc662_dac_nids, |
| 16947 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16948 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16949 | .channel_mode = alc662_3ST_2ch_modes, |
| 16950 | .input_mux = &alc663_m51va_capture_source, |
| 16951 | .unsol_event = alc663_m51va_unsol_event, |
| 16952 | .init_hook = alc663_m51va_inithook, |
| 16953 | }, |
| 16954 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16955 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16956 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16957 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16958 | .dac_nids = alc662_dac_nids, |
| 16959 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16960 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16961 | .channel_mode = alc662_3ST_2ch_modes, |
| 16962 | .input_mux = &alc662_eeepc_capture_source, |
| 16963 | .unsol_event = alc663_g71v_unsol_event, |
| 16964 | .init_hook = alc663_g71v_inithook, |
| 16965 | }, |
| 16966 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16967 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16968 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16969 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16970 | .dac_nids = alc662_dac_nids, |
| 16971 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16972 | .channel_mode = alc662_3ST_2ch_modes, |
| 16973 | .input_mux = &alc663_m51va_capture_source, |
| 16974 | .unsol_event = alc663_m51va_unsol_event, |
| 16975 | .init_hook = alc663_m51va_inithook, |
| 16976 | }, |
| 16977 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16978 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16979 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16980 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16981 | .dac_nids = alc662_dac_nids, |
| 16982 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16983 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16984 | .channel_mode = alc662_3ST_6ch_modes, |
| 16985 | .input_mux = &alc663_capture_source, |
| 16986 | .unsol_event = alc663_g50v_unsol_event, |
| 16987 | .init_hook = alc663_g50v_inithook, |
| 16988 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16989 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16990 | .mixers = { alc663_m51va_mixer }, |
| 16991 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16992 | .init_verbs = { alc662_init_verbs, |
| 16993 | alc663_21jd_amic_init_verbs }, |
| 16994 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16995 | .hp_nid = 0x03, |
| 16996 | .dac_nids = alc662_dac_nids, |
| 16997 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16998 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16999 | .channel_mode = alc662_3ST_2ch_modes, |
| 17000 | .input_mux = &alc662_eeepc_capture_source, |
| 17001 | .unsol_event = alc663_mode1_unsol_event, |
| 17002 | .init_hook = alc663_mode1_inithook, |
| 17003 | }, |
| 17004 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17005 | .mixers = { alc662_1bjd_mixer }, |
| 17006 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17007 | .init_verbs = { alc662_init_verbs, |
| 17008 | alc662_1bjd_amic_init_verbs }, |
| 17009 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17010 | .dac_nids = alc662_dac_nids, |
| 17011 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17012 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17013 | .channel_mode = alc662_3ST_2ch_modes, |
| 17014 | .input_mux = &alc662_eeepc_capture_source, |
| 17015 | .unsol_event = alc662_mode2_unsol_event, |
| 17016 | .init_hook = alc662_mode2_inithook, |
| 17017 | }, |
| 17018 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17019 | .mixers = { alc663_two_hp_m1_mixer }, |
| 17020 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17021 | .init_verbs = { alc662_init_verbs, |
| 17022 | alc663_two_hp_amic_m1_init_verbs }, |
| 17023 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17024 | .hp_nid = 0x03, |
| 17025 | .dac_nids = alc662_dac_nids, |
| 17026 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17027 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17028 | .channel_mode = alc662_3ST_2ch_modes, |
| 17029 | .input_mux = &alc662_eeepc_capture_source, |
| 17030 | .unsol_event = alc663_mode3_unsol_event, |
| 17031 | .init_hook = alc663_mode3_inithook, |
| 17032 | }, |
| 17033 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17034 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 17035 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17036 | .init_verbs = { alc662_init_verbs, |
| 17037 | alc663_21jd_amic_init_verbs}, |
| 17038 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17039 | .hp_nid = 0x03, |
| 17040 | .dac_nids = alc662_dac_nids, |
| 17041 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17042 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17043 | .channel_mode = alc662_3ST_2ch_modes, |
| 17044 | .input_mux = &alc662_eeepc_capture_source, |
| 17045 | .unsol_event = alc663_mode4_unsol_event, |
| 17046 | .init_hook = alc663_mode4_inithook, |
| 17047 | }, |
| 17048 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17049 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 17050 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17051 | .init_verbs = { alc662_init_verbs, |
| 17052 | alc663_15jd_amic_init_verbs }, |
| 17053 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17054 | .hp_nid = 0x03, |
| 17055 | .dac_nids = alc662_dac_nids, |
| 17056 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17057 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17058 | .channel_mode = alc662_3ST_2ch_modes, |
| 17059 | .input_mux = &alc662_eeepc_capture_source, |
| 17060 | .unsol_event = alc663_mode5_unsol_event, |
| 17061 | .init_hook = alc663_mode5_inithook, |
| 17062 | }, |
| 17063 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17064 | .mixers = { alc663_two_hp_m2_mixer }, |
| 17065 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17066 | .init_verbs = { alc662_init_verbs, |
| 17067 | alc663_two_hp_amic_m2_init_verbs }, |
| 17068 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17069 | .hp_nid = 0x03, |
| 17070 | .dac_nids = alc662_dac_nids, |
| 17071 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17072 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17073 | .channel_mode = alc662_3ST_2ch_modes, |
| 17074 | .input_mux = &alc662_eeepc_capture_source, |
| 17075 | .unsol_event = alc663_mode6_unsol_event, |
| 17076 | .init_hook = alc663_mode6_inithook, |
| 17077 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17078 | [ALC272_DELL] = { |
| 17079 | .mixers = { alc663_m51va_mixer }, |
| 17080 | .cap_mixer = alc272_auto_capture_mixer, |
| 17081 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 17082 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17083 | .dac_nids = alc662_dac_nids, |
| 17084 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17085 | .adc_nids = alc272_adc_nids, |
| 17086 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 17087 | .capsrc_nids = alc272_capsrc_nids, |
| 17088 | .channel_mode = alc662_3ST_2ch_modes, |
| 17089 | .input_mux = &alc663_m51va_capture_source, |
| 17090 | .unsol_event = alc663_m51va_unsol_event, |
| 17091 | .init_hook = alc663_m51va_inithook, |
| 17092 | }, |
| 17093 | [ALC272_DELL_ZM1] = { |
| 17094 | .mixers = { alc663_m51va_mixer }, |
| 17095 | .cap_mixer = alc662_auto_capture_mixer, |
| 17096 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 17097 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17098 | .dac_nids = alc662_dac_nids, |
| 17099 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17100 | .adc_nids = alc662_adc_nids, |
| 17101 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 17102 | .capsrc_nids = alc662_capsrc_nids, |
| 17103 | .channel_mode = alc662_3ST_2ch_modes, |
| 17104 | .input_mux = &alc663_m51va_capture_source, |
| 17105 | .unsol_event = alc663_m51va_unsol_event, |
| 17106 | .init_hook = alc663_m51va_inithook, |
| 17107 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17108 | [ALC272_SAMSUNG_NC10] = { |
| 17109 | .mixers = { alc272_nc10_mixer }, |
| 17110 | .init_verbs = { alc662_init_verbs, |
| 17111 | alc663_21jd_amic_init_verbs }, |
| 17112 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17113 | .dac_nids = alc272_dac_nids, |
| 17114 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17115 | .channel_mode = alc662_3ST_2ch_modes, |
| 17116 | .input_mux = &alc272_nc10_capture_source, |
| 17117 | .unsol_event = alc663_mode4_unsol_event, |
| 17118 | .init_hook = alc663_mode4_inithook, |
| 17119 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17120 | }; |
| 17121 | |
| 17122 | |
| 17123 | /* |
| 17124 | * BIOS auto configuration |
| 17125 | */ |
| 17126 | |
| 17127 | /* add playback controls from the parsed DAC table */ |
| 17128 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17129 | const struct auto_pin_cfg *cfg) |
| 17130 | { |
| 17131 | char name[32]; |
| 17132 | static const char *chname[4] = { |
| 17133 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17134 | }; |
| 17135 | hda_nid_t nid; |
| 17136 | int i, err; |
| 17137 | |
| 17138 | for (i = 0; i < cfg->line_outs; i++) { |
| 17139 | if (!spec->multiout.dac_nids[i]) |
| 17140 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17141 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17142 | if (i == 2) { |
| 17143 | /* Center/LFE */ |
| 17144 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17145 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17146 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 17147 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17148 | if (err < 0) |
| 17149 | return err; |
| 17150 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17151 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17152 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 17153 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17154 | if (err < 0) |
| 17155 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17156 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17157 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17158 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17159 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17160 | if (err < 0) |
| 17161 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17162 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17163 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17164 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17165 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17166 | if (err < 0) |
| 17167 | return err; |
| 17168 | } else { |
| 17169 | sprintf(name, "%s Playback Volume", chname[i]); |
| 17170 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17171 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 17172 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17173 | if (err < 0) |
| 17174 | return err; |
| 17175 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17176 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17177 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 17178 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17179 | if (err < 0) |
| 17180 | return err; |
| 17181 | } |
| 17182 | } |
| 17183 | return 0; |
| 17184 | } |
| 17185 | |
| 17186 | /* add playback controls for speaker and HP outputs */ |
| 17187 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 17188 | const char *pfx) |
| 17189 | { |
| 17190 | hda_nid_t nid; |
| 17191 | int err; |
| 17192 | char name[32]; |
| 17193 | |
| 17194 | if (!pin) |
| 17195 | return 0; |
| 17196 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17197 | if (pin == 0x17) { |
| 17198 | /* ALC663 has a mono output pin on 0x17 */ |
| 17199 | sprintf(name, "%s Playback Switch", pfx); |
| 17200 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17201 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 17202 | return err; |
| 17203 | } |
| 17204 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17205 | if (alc880_is_fixed_pin(pin)) { |
| 17206 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 17207 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17208 | /* specify the DAC as the extra output */ |
| 17209 | if (!spec->multiout.hp_nid) |
| 17210 | spec->multiout.hp_nid = nid; |
| 17211 | else |
| 17212 | spec->multiout.extra_out_nid[0] = nid; |
| 17213 | /* control HP volume/switch on the output mixer amp */ |
| 17214 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17215 | sprintf(name, "%s Playback Volume", pfx); |
| 17216 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 17217 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 17218 | if (err < 0) |
| 17219 | return err; |
| 17220 | sprintf(name, "%s Playback Switch", pfx); |
| 17221 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 17222 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 17223 | if (err < 0) |
| 17224 | return err; |
| 17225 | } else if (alc880_is_multi_pin(pin)) { |
| 17226 | /* set manual connection */ |
| 17227 | /* we have only a switch on HP-out PIN */ |
| 17228 | sprintf(name, "%s Playback Switch", pfx); |
| 17229 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17230 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17231 | if (err < 0) |
| 17232 | return err; |
| 17233 | } |
| 17234 | return 0; |
| 17235 | } |
| 17236 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17237 | /* return the index of the src widget from the connection list of the nid. |
| 17238 | * return -1 if not found |
| 17239 | */ |
| 17240 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 17241 | hda_nid_t src) |
| 17242 | { |
| 17243 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 17244 | int i, conns; |
| 17245 | |
| 17246 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 17247 | ARRAY_SIZE(conn_list)); |
| 17248 | if (conns < 0) |
| 17249 | return -1; |
| 17250 | for (i = 0; i < conns; i++) |
| 17251 | if (conn_list[i] == src) |
| 17252 | return i; |
| 17253 | return -1; |
| 17254 | } |
| 17255 | |
| 17256 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 17257 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 17258 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17259 | return (pincap & AC_PINCAP_IN) != 0; |
| 17260 | } |
| 17261 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17262 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17263 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17264 | const struct auto_pin_cfg *cfg) |
| 17265 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17266 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17267 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17268 | int i, err, idx; |
| 17269 | |
| 17270 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17271 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 17272 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 17273 | cfg->input_pins[i]); |
| 17274 | if (idx >= 0) { |
| 17275 | err = new_analog_input(spec, cfg->input_pins[i], |
| 17276 | auto_pin_cfg_labels[i], |
| 17277 | idx, 0x0b); |
| 17278 | if (err < 0) |
| 17279 | return err; |
| 17280 | } |
| 17281 | idx = alc662_input_pin_idx(codec, 0x22, |
| 17282 | cfg->input_pins[i]); |
| 17283 | if (idx >= 0) { |
| 17284 | imux->items[imux->num_items].label = |
| 17285 | auto_pin_cfg_labels[i]; |
| 17286 | imux->items[imux->num_items].index = idx; |
| 17287 | imux->num_items++; |
| 17288 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17289 | } |
| 17290 | } |
| 17291 | return 0; |
| 17292 | } |
| 17293 | |
| 17294 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17295 | hda_nid_t nid, int pin_type, |
| 17296 | int dac_idx) |
| 17297 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17298 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17299 | /* need the manual connection? */ |
| 17300 | if (alc880_is_multi_pin(nid)) { |
| 17301 | struct alc_spec *spec = codec->spec; |
| 17302 | int idx = alc880_multi_pin_idx(nid); |
| 17303 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 17304 | AC_VERB_SET_CONNECT_SEL, |
| 17305 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 17306 | } |
| 17307 | } |
| 17308 | |
| 17309 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17310 | { |
| 17311 | struct alc_spec *spec = codec->spec; |
| 17312 | int i; |
| 17313 | |
| 17314 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17315 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17316 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17317 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17318 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17319 | i); |
| 17320 | } |
| 17321 | } |
| 17322 | |
| 17323 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17324 | { |
| 17325 | struct alc_spec *spec = codec->spec; |
| 17326 | hda_nid_t pin; |
| 17327 | |
| 17328 | pin = spec->autocfg.hp_pins[0]; |
| 17329 | if (pin) /* connect to front */ |
| 17330 | /* use dac 0 */ |
| 17331 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17332 | pin = spec->autocfg.speaker_pins[0]; |
| 17333 | if (pin) |
| 17334 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17335 | } |
| 17336 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17337 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17338 | |
| 17339 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17340 | { |
| 17341 | struct alc_spec *spec = codec->spec; |
| 17342 | int i; |
| 17343 | |
| 17344 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17345 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17346 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17347 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17348 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17349 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17350 | snd_hda_codec_write(codec, nid, 0, |
| 17351 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17352 | AMP_OUT_MUTE); |
| 17353 | } |
| 17354 | } |
| 17355 | } |
| 17356 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17357 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17358 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17359 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17360 | { |
| 17361 | struct alc_spec *spec = codec->spec; |
| 17362 | int err; |
| 17363 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17364 | |
| 17365 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17366 | alc662_ignore); |
| 17367 | if (err < 0) |
| 17368 | return err; |
| 17369 | if (!spec->autocfg.line_outs) |
| 17370 | return 0; /* can't find valid BIOS pin config */ |
| 17371 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17372 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17373 | if (err < 0) |
| 17374 | return err; |
| 17375 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17376 | if (err < 0) |
| 17377 | return err; |
| 17378 | err = alc662_auto_create_extra_out(spec, |
| 17379 | spec->autocfg.speaker_pins[0], |
| 17380 | "Speaker"); |
| 17381 | if (err < 0) |
| 17382 | return err; |
| 17383 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17384 | "Headphone"); |
| 17385 | if (err < 0) |
| 17386 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17387 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17388 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17389 | return err; |
| 17390 | |
| 17391 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17392 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17393 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17394 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17395 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17396 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17397 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17398 | |
| 17399 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17400 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17401 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17402 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17403 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17404 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17405 | |
| 17406 | err = alc_auto_add_mic_boost(codec); |
| 17407 | if (err < 0) |
| 17408 | return err; |
| 17409 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17410 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17411 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17412 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17413 | } |
| 17414 | |
| 17415 | /* additional initialization for auto-configuration model */ |
| 17416 | static void alc662_auto_init(struct hda_codec *codec) |
| 17417 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17418 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17419 | alc662_auto_init_multi_out(codec); |
| 17420 | alc662_auto_init_hp_out(codec); |
| 17421 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17422 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17423 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17424 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17425 | } |
| 17426 | |
| 17427 | static int patch_alc662(struct hda_codec *codec) |
| 17428 | { |
| 17429 | struct alc_spec *spec; |
| 17430 | int err, board_config; |
| 17431 | |
| 17432 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17433 | if (!spec) |
| 17434 | return -ENOMEM; |
| 17435 | |
| 17436 | codec->spec = spec; |
| 17437 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17438 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17439 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17440 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17441 | alc662_models, |
| 17442 | alc662_cfg_tbl); |
| 17443 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 17444 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 17445 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17446 | board_config = ALC662_AUTO; |
| 17447 | } |
| 17448 | |
| 17449 | if (board_config == ALC662_AUTO) { |
| 17450 | /* automatic parse from the BIOS config */ |
| 17451 | err = alc662_parse_auto_config(codec); |
| 17452 | if (err < 0) { |
| 17453 | alc_free(codec); |
| 17454 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17455 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17456 | printk(KERN_INFO |
| 17457 | "hda_codec: Cannot set up configuration " |
| 17458 | "from BIOS. Using base mode...\n"); |
| 17459 | board_config = ALC662_3ST_2ch_DIG; |
| 17460 | } |
| 17461 | } |
| 17462 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17463 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17464 | if (err < 0) { |
| 17465 | alc_free(codec); |
| 17466 | return err; |
| 17467 | } |
| 17468 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17469 | if (board_config != ALC662_AUTO) |
| 17470 | setup_preset(spec, &alc662_presets[board_config]); |
| 17471 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17472 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17473 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17474 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17475 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17476 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17477 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17478 | spec->adc_nids = alc662_adc_nids; |
| 17479 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17480 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17481 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17482 | if (!spec->cap_mixer) |
| 17483 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17484 | if (codec->vendor_id == 0x10ec0662) |
| 17485 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17486 | else |
| 17487 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17488 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17489 | spec->vmaster_nid = 0x02; |
| 17490 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17491 | codec->patch_ops = alc_patch_ops; |
| 17492 | if (board_config == ALC662_AUTO) |
| 17493 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17494 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17495 | if (!spec->loopback.amplist) |
| 17496 | spec->loopback.amplist = alc662_loopbacks; |
| 17497 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17498 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17499 | |
| 17500 | return 0; |
| 17501 | } |
| 17502 | |
| 17503 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17504 | * patch entries |
| 17505 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17506 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17507 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17508 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17509 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17510 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17511 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17512 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17513 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17514 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17515 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17516 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17517 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17518 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 17519 | .patch = patch_alc883 }, |
| 17520 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17521 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17522 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17523 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17524 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 17525 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17526 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 17527 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17528 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 17529 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17530 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 17531 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17532 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 17533 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 17534 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17535 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17536 | {} /* terminator */ |
| 17537 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17538 | |
| 17539 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17540 | |
| 17541 | MODULE_LICENSE("GPL"); |
| 17542 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17543 | |
| 17544 | static struct hda_codec_preset_list realtek_list = { |
| 17545 | .preset = snd_hda_preset_realtek, |
| 17546 | .owner = THIS_MODULE, |
| 17547 | }; |
| 17548 | |
| 17549 | static int __init patch_realtek_init(void) |
| 17550 | { |
| 17551 | return snd_hda_add_codec_preset(&realtek_list); |
| 17552 | } |
| 17553 | |
| 17554 | static void __exit patch_realtek_exit(void) |
| 17555 | { |
| 17556 | snd_hda_delete_codec_preset(&realtek_list); |
| 17557 | } |
| 17558 | |
| 17559 | module_init(patch_realtek_init) |
| 17560 | module_exit(patch_realtek_exit) |