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 | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 224 | ALC883_ACER, |
Tobin Davis | 2880a867 | 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 | 3e1647c | 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 | 2880a867 | 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 | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8178 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a867 | 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 | 2880a867 | 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 | 2880a867 | 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 | 3e1647c | 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 | 3e1647c | 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 | 3e1647c | 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 | 2880a867 | 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 | 3e1647c | 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 | 3e1647c | 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 | bab282b | 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 | bab282b | 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 | bab282b | 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 | 2880a867 | 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 | 2880a867 | 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 | 2880a867 | 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 | 3e1647c | 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 | |
| 10904 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10905 | #define alc262_auto_create_analog_input_ctls \ |
| 10906 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10907 | |
| 10908 | /* |
| 10909 | * generic initialization of ADC, input mixers and output mixers |
| 10910 | */ |
| 10911 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10912 | /* |
| 10913 | * Unmute ADC0-2 and set the default input to mic-in |
| 10914 | */ |
| 10915 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10916 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10917 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10918 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10919 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10920 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10921 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10922 | /* 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] | 10923 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10924 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10925 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10926 | */ |
| 10927 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10928 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10929 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10930 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10932 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10933 | |
| 10934 | /* |
| 10935 | * Set up output mixers (0x0c - 0x0f) |
| 10936 | */ |
| 10937 | /* set vol=0 to output mixers */ |
| 10938 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10939 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10940 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10941 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10942 | /* set up input amps for analog loopback */ |
| 10943 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10944 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10945 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10946 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10947 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10948 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10949 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10950 | |
| 10951 | /* FIXME: use matrix-type input source selection */ |
| 10952 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10953 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10954 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10955 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10956 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10957 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10958 | /* Input mixer2 */ |
| 10959 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10960 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10961 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10962 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10963 | /* Input mixer3 */ |
| 10964 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10965 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10966 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10967 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10968 | |
| 10969 | { } |
| 10970 | }; |
| 10971 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10972 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10973 | /* |
| 10974 | * Unmute ADC0-2 and set the default input to mic-in |
| 10975 | */ |
| 10976 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10977 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10978 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10979 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10980 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10981 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10982 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10983 | /* 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] | 10984 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10985 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10986 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10987 | */ |
| 10988 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10989 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10990 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10991 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10992 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10993 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10994 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10995 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10996 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10997 | /* |
| 10998 | * Set up output mixers (0x0c - 0x0e) |
| 10999 | */ |
| 11000 | /* set vol=0 to output mixers */ |
| 11001 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11002 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11003 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11004 | |
| 11005 | /* set up input amps for analog loopback */ |
| 11006 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11007 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11008 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11009 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11010 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11011 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11012 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11013 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11014 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11015 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11016 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11017 | |
| 11018 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11019 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11020 | |
| 11021 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11022 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11023 | |
| 11024 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11025 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11026 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11027 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11028 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11029 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11030 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11031 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11032 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11033 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11034 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11035 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11036 | |
| 11037 | |
| 11038 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11039 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11040 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11041 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11042 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11043 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11044 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11045 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11046 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11047 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11048 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11049 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11050 | /* Input mixer2 */ |
| 11051 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11052 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11053 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11054 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11055 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11056 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11057 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11058 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11059 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11060 | /* Input mixer3 */ |
| 11061 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11063 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11064 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11065 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11066 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11067 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11068 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11069 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11070 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11071 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11072 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11073 | { } |
| 11074 | }; |
| 11075 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11076 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11077 | /* |
| 11078 | * Unmute ADC0-2 and set the default input to mic-in |
| 11079 | */ |
| 11080 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11081 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11082 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11083 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11084 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11085 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11086 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11087 | /* 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] | 11088 | * mixer widget |
| 11089 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11090 | * panel mic (mic 2) |
| 11091 | */ |
| 11092 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11093 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11094 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11095 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11096 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11101 | /* |
| 11102 | * Set up output mixers (0x0c - 0x0e) |
| 11103 | */ |
| 11104 | /* set vol=0 to output mixers */ |
| 11105 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11106 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11107 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11108 | |
| 11109 | /* set up input amps for analog loopback */ |
| 11110 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11111 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11112 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11113 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11114 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11115 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11116 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11117 | |
| 11118 | |
| 11119 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11120 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11121 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11122 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11123 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11124 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11125 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11126 | |
| 11127 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11128 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11129 | |
| 11130 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11131 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11132 | |
| 11133 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11134 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11135 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11136 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11137 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11138 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11139 | |
| 11140 | /* FIXME: use matrix-type input source selection */ |
| 11141 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11142 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11143 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11144 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11145 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11146 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11147 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11148 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11149 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11150 | /* Input mixer2 */ |
| 11151 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11152 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11153 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11154 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11155 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11156 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11157 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11158 | /* Input mixer3 */ |
| 11159 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11160 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11161 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11162 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11163 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11164 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11165 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11166 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11167 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11168 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11169 | { } |
| 11170 | }; |
| 11171 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11172 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11173 | |
| 11174 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11175 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11176 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11177 | |
| 11178 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11179 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11180 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11181 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11182 | |
| 11183 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11184 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11185 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11186 | {} |
| 11187 | }; |
| 11188 | |
| 11189 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11190 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11191 | #define alc262_loopbacks alc880_loopbacks |
| 11192 | #endif |
| 11193 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11194 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11195 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11196 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11197 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11198 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11199 | |
| 11200 | /* |
| 11201 | * BIOS auto configuration |
| 11202 | */ |
| 11203 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11204 | { |
| 11205 | struct alc_spec *spec = codec->spec; |
| 11206 | int err; |
| 11207 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11208 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11209 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11210 | alc262_ignore); |
| 11211 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11212 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11213 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11214 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11215 | spec->multiout.max_channels = 2; |
| 11216 | spec->no_analog = 1; |
| 11217 | goto dig_only; |
| 11218 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11219 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11220 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11221 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11222 | if (err < 0) |
| 11223 | return err; |
| 11224 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11225 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11226 | return err; |
| 11227 | |
| 11228 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11229 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11230 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11231 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11232 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11233 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11234 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11235 | if (spec->autocfg.dig_in_pin) |
| 11236 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11237 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11238 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11239 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11240 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11241 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11242 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11243 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11244 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11245 | err = alc_auto_add_mic_boost(codec); |
| 11246 | if (err < 0) |
| 11247 | return err; |
| 11248 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11249 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11250 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11251 | return 1; |
| 11252 | } |
| 11253 | |
| 11254 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11255 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11256 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11257 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11258 | |
| 11259 | |
| 11260 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11261 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11262 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11263 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11264 | alc262_auto_init_multi_out(codec); |
| 11265 | alc262_auto_init_hp_out(codec); |
| 11266 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11267 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11268 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11269 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11270 | } |
| 11271 | |
| 11272 | /* |
| 11273 | * configuration and preset |
| 11274 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11275 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11276 | [ALC262_BASIC] = "basic", |
| 11277 | [ALC262_HIPPO] = "hippo", |
| 11278 | [ALC262_HIPPO_1] = "hippo_1", |
| 11279 | [ALC262_FUJITSU] = "fujitsu", |
| 11280 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11281 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11282 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11283 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11284 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11285 | [ALC262_BENQ_T31] = "benq-t31", |
| 11286 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11287 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11288 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11289 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11290 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11291 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11292 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11293 | [ALC262_AUTO] = "auto", |
| 11294 | }; |
| 11295 | |
| 11296 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11297 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11298 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11299 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11300 | ALC262_HP_BPC), |
| 11301 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11302 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11303 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11304 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11305 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11306 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11307 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11308 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11309 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11310 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11311 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11312 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11313 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11314 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11315 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11316 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11317 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11318 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11319 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11320 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11321 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11322 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11323 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11324 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11325 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11326 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11327 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11328 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11329 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11330 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11331 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11332 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11333 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11334 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11335 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11336 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11337 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11338 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11339 | {} |
| 11340 | }; |
| 11341 | |
| 11342 | static struct alc_config_preset alc262_presets[] = { |
| 11343 | [ALC262_BASIC] = { |
| 11344 | .mixers = { alc262_base_mixer }, |
| 11345 | .init_verbs = { alc262_init_verbs }, |
| 11346 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11347 | .dac_nids = alc262_dac_nids, |
| 11348 | .hp_nid = 0x03, |
| 11349 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11350 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11351 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11352 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11353 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11354 | .mixers = { alc262_hippo_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11355 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 11356 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11357 | .dac_nids = alc262_dac_nids, |
| 11358 | .hp_nid = 0x03, |
| 11359 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11360 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11361 | .channel_mode = alc262_modes, |
| 11362 | .input_mux = &alc262_capture_source, |
| 11363 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11364 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11365 | }, |
| 11366 | [ALC262_HIPPO_1] = { |
| 11367 | .mixers = { alc262_hippo1_mixer }, |
| 11368 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11369 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11370 | .dac_nids = alc262_dac_nids, |
| 11371 | .hp_nid = 0x02, |
| 11372 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11373 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11374 | .channel_mode = alc262_modes, |
| 11375 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11376 | .unsol_event = alc262_hippo_unsol_event, |
| 11377 | .init_hook = alc262_hippo1_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11378 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11379 | [ALC262_FUJITSU] = { |
| 11380 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11381 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11382 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11383 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11384 | .dac_nids = alc262_dac_nids, |
| 11385 | .hp_nid = 0x03, |
| 11386 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11387 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11388 | .channel_mode = alc262_modes, |
| 11389 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11390 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11391 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11392 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11393 | [ALC262_HP_BPC] = { |
| 11394 | .mixers = { alc262_HP_BPC_mixer }, |
| 11395 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11396 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11397 | .dac_nids = alc262_dac_nids, |
| 11398 | .hp_nid = 0x03, |
| 11399 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11400 | .channel_mode = alc262_modes, |
| 11401 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11402 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11403 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11404 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11405 | [ALC262_HP_BPC_D7000_WF] = { |
| 11406 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11407 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11408 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11409 | .dac_nids = alc262_dac_nids, |
| 11410 | .hp_nid = 0x03, |
| 11411 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11412 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11413 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11414 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11415 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11416 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11417 | [ALC262_HP_BPC_D7000_WL] = { |
| 11418 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11419 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11420 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11421 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11422 | .dac_nids = alc262_dac_nids, |
| 11423 | .hp_nid = 0x03, |
| 11424 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11425 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11426 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11427 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11428 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11429 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11430 | [ALC262_HP_TC_T5735] = { |
| 11431 | .mixers = { alc262_hp_t5735_mixer }, |
| 11432 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11433 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11434 | .dac_nids = alc262_dac_nids, |
| 11435 | .hp_nid = 0x03, |
| 11436 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11437 | .channel_mode = alc262_modes, |
| 11438 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11439 | .unsol_event = alc_automute_amp_unsol_event, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11440 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11441 | }, |
| 11442 | [ALC262_HP_RP5700] = { |
| 11443 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11444 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11445 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11446 | .dac_nids = alc262_dac_nids, |
| 11447 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11448 | .channel_mode = alc262_modes, |
| 11449 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11450 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11451 | [ALC262_BENQ_ED8] = { |
| 11452 | .mixers = { alc262_base_mixer }, |
| 11453 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11454 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11455 | .dac_nids = alc262_dac_nids, |
| 11456 | .hp_nid = 0x03, |
| 11457 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11458 | .channel_mode = alc262_modes, |
| 11459 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11460 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11461 | [ALC262_SONY_ASSAMD] = { |
| 11462 | .mixers = { alc262_sony_mixer }, |
| 11463 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11464 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11465 | .dac_nids = alc262_dac_nids, |
| 11466 | .hp_nid = 0x02, |
| 11467 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11468 | .channel_mode = alc262_modes, |
| 11469 | .input_mux = &alc262_capture_source, |
| 11470 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11471 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11472 | }, |
| 11473 | [ALC262_BENQ_T31] = { |
| 11474 | .mixers = { alc262_benq_t31_mixer }, |
| 11475 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 11476 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11477 | .dac_nids = alc262_dac_nids, |
| 11478 | .hp_nid = 0x03, |
| 11479 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11480 | .channel_mode = alc262_modes, |
| 11481 | .input_mux = &alc262_capture_source, |
| 11482 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11483 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11484 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11485 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11486 | .mixers = { alc262_ultra_mixer }, |
| 11487 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11488 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11489 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11490 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11491 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11492 | .channel_mode = alc262_modes, |
| 11493 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11494 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11495 | .capsrc_nids = alc262_capsrc_nids, |
| 11496 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11497 | .unsol_event = alc262_ultra_unsol_event, |
| 11498 | .init_hook = alc262_ultra_automute, |
| 11499 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11500 | [ALC262_LENOVO_3000] = { |
| 11501 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11502 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11503 | alc262_lenovo_3000_unsol_verbs }, |
| 11504 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11505 | .dac_nids = alc262_dac_nids, |
| 11506 | .hp_nid = 0x03, |
| 11507 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11508 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11509 | .channel_mode = alc262_modes, |
| 11510 | .input_mux = &alc262_fujitsu_capture_source, |
| 11511 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11512 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11513 | [ALC262_NEC] = { |
| 11514 | .mixers = { alc262_nec_mixer }, |
| 11515 | .init_verbs = { alc262_nec_verbs }, |
| 11516 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11517 | .dac_nids = alc262_dac_nids, |
| 11518 | .hp_nid = 0x03, |
| 11519 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11520 | .channel_mode = alc262_modes, |
| 11521 | .input_mux = &alc262_capture_source, |
| 11522 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11523 | [ALC262_TOSHIBA_S06] = { |
| 11524 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11525 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11526 | alc262_eapd_verbs }, |
| 11527 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11528 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11529 | .dac_nids = alc262_dac_nids, |
| 11530 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11531 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11532 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11533 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11534 | .channel_mode = alc262_modes, |
| 11535 | .input_mux = &alc262_dmic_capture_source, |
| 11536 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11537 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11538 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11539 | [ALC262_TOSHIBA_RX1] = { |
| 11540 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11541 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11542 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11543 | .dac_nids = alc262_dac_nids, |
| 11544 | .hp_nid = 0x03, |
| 11545 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11546 | .channel_mode = alc262_modes, |
| 11547 | .input_mux = &alc262_capture_source, |
| 11548 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11549 | .init_hook = alc262_hippo_init_hook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11550 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11551 | [ALC262_TYAN] = { |
| 11552 | .mixers = { alc262_tyan_mixer }, |
| 11553 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11554 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11555 | .dac_nids = alc262_dac_nids, |
| 11556 | .hp_nid = 0x02, |
| 11557 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11558 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11559 | .channel_mode = alc262_modes, |
| 11560 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11561 | .unsol_event = alc_automute_amp_unsol_event, |
| 11562 | .init_hook = alc262_tyan_init_hook, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11563 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11564 | }; |
| 11565 | |
| 11566 | static int patch_alc262(struct hda_codec *codec) |
| 11567 | { |
| 11568 | struct alc_spec *spec; |
| 11569 | int board_config; |
| 11570 | int err; |
| 11571 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11572 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11573 | if (spec == NULL) |
| 11574 | return -ENOMEM; |
| 11575 | |
| 11576 | codec->spec = spec; |
| 11577 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11578 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11579 | * under-run |
| 11580 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11581 | { |
| 11582 | int tmp; |
| 11583 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11584 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11585 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11586 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11587 | } |
| 11588 | #endif |
| 11589 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11590 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11591 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11592 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11593 | alc262_models, |
| 11594 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11595 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11596 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 11597 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 11598 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11599 | board_config = ALC262_AUTO; |
| 11600 | } |
| 11601 | |
| 11602 | if (board_config == ALC262_AUTO) { |
| 11603 | /* automatic parse from the BIOS config */ |
| 11604 | err = alc262_parse_auto_config(codec); |
| 11605 | if (err < 0) { |
| 11606 | alc_free(codec); |
| 11607 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11608 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11609 | printk(KERN_INFO |
| 11610 | "hda_codec: Cannot set up configuration " |
| 11611 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11612 | board_config = ALC262_BASIC; |
| 11613 | } |
| 11614 | } |
| 11615 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11616 | if (!spec->no_analog) { |
| 11617 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11618 | if (err < 0) { |
| 11619 | alc_free(codec); |
| 11620 | return err; |
| 11621 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11622 | } |
| 11623 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11624 | if (board_config != ALC262_AUTO) |
| 11625 | setup_preset(spec, &alc262_presets[board_config]); |
| 11626 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11627 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11628 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11629 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11630 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11631 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11632 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11633 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11634 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11635 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11636 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11637 | /* get type */ |
| 11638 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11639 | if (wcap != AC_WID_AUD_IN) { |
| 11640 | spec->adc_nids = alc262_adc_nids_alt; |
| 11641 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11642 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11643 | } else { |
| 11644 | spec->adc_nids = alc262_adc_nids; |
| 11645 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11646 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11647 | } |
| 11648 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11649 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11650 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11651 | if (!spec->no_analog) |
| 11652 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11653 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11654 | spec->vmaster_nid = 0x0c; |
| 11655 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11656 | codec->patch_ops = alc_patch_ops; |
| 11657 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11658 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11659 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11660 | if (!spec->loopback.amplist) |
| 11661 | spec->loopback.amplist = alc262_loopbacks; |
| 11662 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11663 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11664 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11665 | return 0; |
| 11666 | } |
| 11667 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11668 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11669 | * ALC268 channel source setting (2 channel) |
| 11670 | */ |
| 11671 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11672 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11673 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11674 | static hda_nid_t alc268_dac_nids[2] = { |
| 11675 | /* front, hp */ |
| 11676 | 0x02, 0x03 |
| 11677 | }; |
| 11678 | |
| 11679 | static hda_nid_t alc268_adc_nids[2] = { |
| 11680 | /* ADC0-1 */ |
| 11681 | 0x08, 0x07 |
| 11682 | }; |
| 11683 | |
| 11684 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11685 | /* ADC0 */ |
| 11686 | 0x08 |
| 11687 | }; |
| 11688 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11689 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11690 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11691 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11692 | /* output mixer control */ |
| 11693 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11694 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11695 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11696 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11697 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11698 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11699 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11700 | { } |
| 11701 | }; |
| 11702 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11703 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11704 | /* output mixer control */ |
| 11705 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11706 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11707 | ALC262_HIPPO_MASTER_SWITCH, |
| 11708 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11709 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11710 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11711 | { } |
| 11712 | }; |
| 11713 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11714 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11715 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11716 | .ops = &snd_hda_bind_sw, |
| 11717 | .values = { |
| 11718 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11719 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11720 | 0 |
| 11721 | }, |
| 11722 | }; |
| 11723 | |
| 11724 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11725 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11726 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11727 | { } |
| 11728 | }; |
| 11729 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11730 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11731 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11732 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11733 | { } |
| 11734 | }; |
| 11735 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11736 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11737 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11738 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11739 | { } /* end */ |
| 11740 | }; |
| 11741 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11742 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11743 | .num_items = 2, |
| 11744 | .items = { |
| 11745 | { "i-Mic", 0x6 }, |
| 11746 | { "E-Mic", 0x0 }, |
| 11747 | }, |
| 11748 | }; |
| 11749 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11750 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11751 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11752 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11753 | .ops = &snd_hda_bind_vol, |
| 11754 | .values = { |
| 11755 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11756 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11757 | 0 |
| 11758 | }, |
| 11759 | }; |
| 11760 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11761 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11762 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11763 | { |
| 11764 | struct alc_spec *spec = codec->spec; |
| 11765 | unsigned int mute; |
| 11766 | |
| 11767 | if (force || !spec->sense_updated) { |
| 11768 | unsigned int present; |
| 11769 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11770 | AC_VERB_GET_PIN_SENSE, 0); |
| 11771 | spec->jack_present = (present & 0x80000000) != 0; |
| 11772 | spec->sense_updated = 1; |
| 11773 | } |
| 11774 | if (spec->jack_present) |
| 11775 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11776 | else /* unmute internal speaker if necessary */ |
| 11777 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11778 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11779 | HDA_AMP_MUTE, mute); |
| 11780 | } |
| 11781 | |
| 11782 | |
| 11783 | /* bind hp and internal speaker mute (with plug check) */ |
| 11784 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11785 | struct snd_ctl_elem_value *ucontrol) |
| 11786 | { |
| 11787 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11788 | long *valp = ucontrol->value.integer.value; |
| 11789 | int change; |
| 11790 | |
| 11791 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11792 | HDA_AMP_MUTE, |
| 11793 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11794 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11795 | HDA_AMP_MUTE, |
| 11796 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11797 | if (change) |
| 11798 | alc268_acer_automute(codec, 0); |
| 11799 | return change; |
| 11800 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11801 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11802 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11803 | /* output mixer control */ |
| 11804 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11805 | { |
| 11806 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11807 | .name = "Master Playback Switch", |
| 11808 | .info = snd_hda_mixer_amp_switch_info, |
| 11809 | .get = snd_hda_mixer_amp_switch_get, |
| 11810 | .put = alc268_acer_master_sw_put, |
| 11811 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11812 | }, |
| 11813 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11814 | { } |
| 11815 | }; |
| 11816 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11817 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11818 | /* output mixer control */ |
| 11819 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11820 | { |
| 11821 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11822 | .name = "Master Playback Switch", |
| 11823 | .info = snd_hda_mixer_amp_switch_info, |
| 11824 | .get = snd_hda_mixer_amp_switch_get, |
| 11825 | .put = alc268_acer_master_sw_put, |
| 11826 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11827 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11828 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11829 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11830 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11831 | { } |
| 11832 | }; |
| 11833 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11834 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11835 | /* output mixer control */ |
| 11836 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11837 | { |
| 11838 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11839 | .name = "Master Playback Switch", |
| 11840 | .info = snd_hda_mixer_amp_switch_info, |
| 11841 | .get = snd_hda_mixer_amp_switch_get, |
| 11842 | .put = alc268_acer_master_sw_put, |
| 11843 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11844 | }, |
| 11845 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11846 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11847 | { } |
| 11848 | }; |
| 11849 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11850 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11851 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11852 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11853 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11854 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11855 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11856 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11857 | { } |
| 11858 | }; |
| 11859 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11860 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11861 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11862 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11863 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11864 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11865 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11866 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11867 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11868 | { } |
| 11869 | }; |
| 11870 | |
| 11871 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11872 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
| 11873 | #define alc268_toshiba_init_hook alc262_hippo_init_hook |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11874 | |
| 11875 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11876 | unsigned int res) |
| 11877 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11878 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11879 | return; |
| 11880 | alc268_acer_automute(codec, 1); |
| 11881 | } |
| 11882 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11883 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11884 | { |
| 11885 | alc268_acer_automute(codec, 1); |
| 11886 | } |
| 11887 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11888 | /* toggle speaker-output according to the hp-jack state */ |
| 11889 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11890 | { |
| 11891 | unsigned int present; |
| 11892 | unsigned char bits; |
| 11893 | |
| 11894 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11895 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11896 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11897 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11898 | AMP_IN_MUTE(0), bits); |
| 11899 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11900 | AMP_IN_MUTE(0), bits); |
| 11901 | } |
| 11902 | |
| 11903 | |
| 11904 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11905 | { |
| 11906 | unsigned int present; |
| 11907 | |
| 11908 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11909 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11910 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11911 | present ? 0x0 : 0x6); |
| 11912 | } |
| 11913 | |
| 11914 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11915 | unsigned int res) |
| 11916 | { |
| 11917 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11918 | alc268_aspire_one_speaker_automute(codec); |
| 11919 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11920 | alc268_acer_mic_automute(codec); |
| 11921 | } |
| 11922 | |
| 11923 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11924 | { |
| 11925 | alc268_aspire_one_speaker_automute(codec); |
| 11926 | alc268_acer_mic_automute(codec); |
| 11927 | } |
| 11928 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11929 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11930 | /* output mixer control */ |
| 11931 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11932 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11933 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11934 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11935 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11936 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11937 | { } |
| 11938 | }; |
| 11939 | |
| 11940 | static struct hda_verb alc268_dell_verbs[] = { |
| 11941 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11942 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11943 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11944 | { } |
| 11945 | }; |
| 11946 | |
| 11947 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11948 | static void alc268_dell_init_hook(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11949 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11950 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11951 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11952 | spec->autocfg.hp_pins[0] = 0x15; |
| 11953 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11954 | alc_automute_pin(codec); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11955 | } |
| 11956 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11957 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11958 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11959 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11960 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11961 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11962 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11963 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11964 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11965 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11966 | { } |
| 11967 | }; |
| 11968 | |
| 11969 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11970 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11971 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11972 | { } |
| 11973 | }; |
| 11974 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11975 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11976 | { |
| 11977 | unsigned int present; |
| 11978 | |
| 11979 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11980 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11981 | snd_hda_codec_write(codec, 0x23, 0, |
| 11982 | AC_VERB_SET_CONNECT_SEL, |
| 11983 | present ? 0x00 : 0x01); |
| 11984 | } |
| 11985 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11986 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11987 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11988 | struct alc_spec *spec = codec->spec; |
| 11989 | |
| 11990 | spec->autocfg.hp_pins[0] = 0x15; |
| 11991 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11992 | alc_automute_pin(codec); |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11993 | alc267_quanta_il1_mic_automute(codec); |
| 11994 | } |
| 11995 | |
| 11996 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11997 | unsigned int res) |
| 11998 | { |
| 11999 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12000 | case ALC880_MIC_EVENT: |
| 12001 | alc267_quanta_il1_mic_automute(codec); |
| 12002 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12003 | default: |
| 12004 | alc_sku_unsol_event(codec, res); |
| 12005 | break; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12006 | } |
| 12007 | } |
| 12008 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12009 | /* |
| 12010 | * generic initialization of ADC, input mixers and output mixers |
| 12011 | */ |
| 12012 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12013 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12014 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12015 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12016 | |
| 12017 | /* |
| 12018 | * Set up output mixers (0x0c - 0x0e) |
| 12019 | */ |
| 12020 | /* set vol=0 to output mixers */ |
| 12021 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12022 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12023 | |
| 12024 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12025 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12026 | |
| 12027 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12028 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12029 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12030 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12031 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12032 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12033 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12034 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12035 | |
| 12036 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12037 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12038 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12039 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12040 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12041 | |
| 12042 | /* set PCBEEP vol = 0, mute connections */ |
| 12043 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12044 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12045 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12046 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12047 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12048 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12049 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12050 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12051 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12052 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12053 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12054 | { } |
| 12055 | }; |
| 12056 | |
| 12057 | /* |
| 12058 | * generic initialization of ADC, input mixers and output mixers |
| 12059 | */ |
| 12060 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12061 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12062 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12063 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12064 | |
| 12065 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12066 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12067 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12068 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12069 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12070 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12071 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12072 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12073 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12074 | |
| 12075 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12076 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12077 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12078 | /* set PCBEEP vol = 0, mute connections */ |
| 12079 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12080 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12081 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12082 | |
| 12083 | { } |
| 12084 | }; |
| 12085 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12086 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12087 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12088 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12089 | { |
| 12090 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12091 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12092 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12093 | */ |
| 12094 | /* .name = "Capture Source", */ |
| 12095 | .name = "Input Source", |
| 12096 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12097 | .info = alc_mux_enum_info, |
| 12098 | .get = alc_mux_enum_get, |
| 12099 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12100 | }, |
| 12101 | { } /* end */ |
| 12102 | }; |
| 12103 | |
| 12104 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12105 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12106 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12107 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12108 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12109 | { |
| 12110 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12111 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12112 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12113 | */ |
| 12114 | /* .name = "Capture Source", */ |
| 12115 | .name = "Input Source", |
| 12116 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12117 | .info = alc_mux_enum_info, |
| 12118 | .get = alc_mux_enum_get, |
| 12119 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12120 | }, |
| 12121 | { } /* end */ |
| 12122 | }; |
| 12123 | |
| 12124 | static struct hda_input_mux alc268_capture_source = { |
| 12125 | .num_items = 4, |
| 12126 | .items = { |
| 12127 | { "Mic", 0x0 }, |
| 12128 | { "Front Mic", 0x1 }, |
| 12129 | { "Line", 0x2 }, |
| 12130 | { "CD", 0x3 }, |
| 12131 | }, |
| 12132 | }; |
| 12133 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12134 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12135 | .num_items = 3, |
| 12136 | .items = { |
| 12137 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12138 | { "Internal Mic", 0x1 }, |
| 12139 | { "Line", 0x2 }, |
| 12140 | }, |
| 12141 | }; |
| 12142 | |
| 12143 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12144 | .num_items = 3, |
| 12145 | .items = { |
| 12146 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12147 | { "Internal Mic", 0x6 }, |
| 12148 | { "Line", 0x2 }, |
| 12149 | }, |
| 12150 | }; |
| 12151 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12152 | #ifdef CONFIG_SND_DEBUG |
| 12153 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12154 | /* Volume widgets */ |
| 12155 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12156 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12157 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12158 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12159 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12160 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12161 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12162 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12163 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12164 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12165 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12166 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12167 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12168 | /* The below appears problematic on some hardwares */ |
| 12169 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12170 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12171 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12172 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12173 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12174 | |
| 12175 | /* Modes for retasking pin widgets */ |
| 12176 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12177 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12178 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12179 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12180 | |
| 12181 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12182 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12183 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12184 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12185 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12186 | |
| 12187 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12188 | * The ALC268 does not have an SPDIF input. |
| 12189 | */ |
| 12190 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12191 | |
| 12192 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12193 | * this output to turn on an external amplifier. |
| 12194 | */ |
| 12195 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12196 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12197 | |
| 12198 | { } /* end */ |
| 12199 | }; |
| 12200 | #endif |
| 12201 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12202 | /* create input playback/capture controls for the given pin */ |
| 12203 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12204 | const char *ctlname, int idx) |
| 12205 | { |
| 12206 | char name[32]; |
| 12207 | int err; |
| 12208 | |
| 12209 | sprintf(name, "%s Playback Volume", ctlname); |
| 12210 | if (nid == 0x14) { |
| 12211 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12212 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 12213 | HDA_OUTPUT)); |
| 12214 | if (err < 0) |
| 12215 | return err; |
| 12216 | } else if (nid == 0x15) { |
| 12217 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12218 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 12219 | HDA_OUTPUT)); |
| 12220 | if (err < 0) |
| 12221 | return err; |
| 12222 | } else |
| 12223 | return -1; |
| 12224 | sprintf(name, "%s Playback Switch", ctlname); |
| 12225 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12226 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 12227 | if (err < 0) |
| 12228 | return err; |
| 12229 | return 0; |
| 12230 | } |
| 12231 | |
| 12232 | /* add playback controls from the parsed DAC table */ |
| 12233 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12234 | const struct auto_pin_cfg *cfg) |
| 12235 | { |
| 12236 | hda_nid_t nid; |
| 12237 | int err; |
| 12238 | |
| 12239 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 12240 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12241 | spec->multiout.dac_nids[0] = 2; |
| 12242 | spec->multiout.dac_nids[1] = 3; |
| 12243 | |
| 12244 | nid = cfg->line_out_pins[0]; |
| 12245 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12246 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12247 | |
| 12248 | nid = cfg->speaker_pins[0]; |
| 12249 | if (nid == 0x1d) { |
| 12250 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12251 | "Speaker Playback Volume", |
| 12252 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12253 | if (err < 0) |
| 12254 | return err; |
| 12255 | } |
| 12256 | nid = cfg->hp_pins[0]; |
| 12257 | if (nid) |
| 12258 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12259 | |
| 12260 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12261 | if (nid == 0x16) { |
| 12262 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12263 | "Mono Playback Switch", |
| 12264 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 12265 | if (err < 0) |
| 12266 | return err; |
| 12267 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12268 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12269 | } |
| 12270 | |
| 12271 | /* create playback/capture controls for input pins */ |
| 12272 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12273 | const struct auto_pin_cfg *cfg) |
| 12274 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12275 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12276 | int i, idx1; |
| 12277 | |
| 12278 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12279 | switch(cfg->input_pins[i]) { |
| 12280 | case 0x18: |
| 12281 | idx1 = 0; /* Mic 1 */ |
| 12282 | break; |
| 12283 | case 0x19: |
| 12284 | idx1 = 1; /* Mic 2 */ |
| 12285 | break; |
| 12286 | case 0x1a: |
| 12287 | idx1 = 2; /* Line In */ |
| 12288 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12289 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12290 | idx1 = 3; /* CD */ |
| 12291 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 12292 | case 0x12: |
| 12293 | case 0x13: |
| 12294 | idx1 = 6; /* digital mics */ |
| 12295 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12296 | default: |
| 12297 | continue; |
| 12298 | } |
| 12299 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 12300 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12301 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12302 | } |
| 12303 | return 0; |
| 12304 | } |
| 12305 | |
| 12306 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12307 | { |
| 12308 | struct alc_spec *spec = codec->spec; |
| 12309 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12310 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12311 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12312 | unsigned int dac_vol1, dac_vol2; |
| 12313 | |
| 12314 | if (speaker_nid) { |
| 12315 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12316 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 12317 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12318 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12319 | AMP_IN_UNMUTE(1)); |
| 12320 | snd_hda_codec_write(codec, 0x10, 0, |
| 12321 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12322 | AMP_IN_UNMUTE(1)); |
| 12323 | } else { |
| 12324 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12325 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12326 | snd_hda_codec_write(codec, 0x10, 0, |
| 12327 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12328 | } |
| 12329 | |
| 12330 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12331 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12332 | dac_vol2 = AMP_OUT_ZERO; |
| 12333 | else if (line_nid == 0x15) |
| 12334 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12335 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12336 | dac_vol2 = AMP_OUT_ZERO; |
| 12337 | else if (hp_nid == 0x15) |
| 12338 | dac_vol1 = AMP_OUT_ZERO; |
| 12339 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12340 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12341 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12342 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12343 | |
| 12344 | snd_hda_codec_write(codec, 0x02, 0, |
| 12345 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12346 | snd_hda_codec_write(codec, 0x03, 0, |
| 12347 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12348 | } |
| 12349 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12350 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12351 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12352 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12353 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12354 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12355 | |
| 12356 | /* |
| 12357 | * BIOS auto configuration |
| 12358 | */ |
| 12359 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12360 | { |
| 12361 | struct alc_spec *spec = codec->spec; |
| 12362 | int err; |
| 12363 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12364 | |
| 12365 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12366 | alc268_ignore); |
| 12367 | if (err < 0) |
| 12368 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12369 | if (!spec->autocfg.line_outs) { |
| 12370 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12371 | spec->multiout.max_channels = 2; |
| 12372 | spec->no_analog = 1; |
| 12373 | goto dig_only; |
| 12374 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12375 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12376 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12377 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12378 | if (err < 0) |
| 12379 | return err; |
| 12380 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12381 | if (err < 0) |
| 12382 | return err; |
| 12383 | |
| 12384 | spec->multiout.max_channels = 2; |
| 12385 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12386 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12387 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12388 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12389 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12390 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12391 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12392 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12393 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12394 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12395 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12396 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12397 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12398 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12399 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12400 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12401 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12402 | err = alc_auto_add_mic_boost(codec); |
| 12403 | if (err < 0) |
| 12404 | return err; |
| 12405 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12406 | return 1; |
| 12407 | } |
| 12408 | |
| 12409 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12410 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12411 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12412 | |
| 12413 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12414 | static void alc268_auto_init(struct hda_codec *codec) |
| 12415 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12416 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12417 | alc268_auto_init_multi_out(codec); |
| 12418 | alc268_auto_init_hp_out(codec); |
| 12419 | alc268_auto_init_mono_speaker_out(codec); |
| 12420 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12421 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12422 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12423 | } |
| 12424 | |
| 12425 | /* |
| 12426 | * configuration and preset |
| 12427 | */ |
| 12428 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12429 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12430 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12431 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12432 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12433 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12434 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12435 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12436 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12437 | #ifdef CONFIG_SND_DEBUG |
| 12438 | [ALC268_TEST] = "test", |
| 12439 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12440 | [ALC268_AUTO] = "auto", |
| 12441 | }; |
| 12442 | |
| 12443 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12444 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12445 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12446 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12447 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12448 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12449 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12450 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12451 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12452 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12453 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
| 12454 | ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12455 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12456 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
| 12457 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12458 | ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12459 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12460 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12461 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12462 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12463 | {} |
| 12464 | }; |
| 12465 | |
| 12466 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12467 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12468 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12469 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12470 | alc267_quanta_il1_verbs }, |
| 12471 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12472 | .dac_nids = alc268_dac_nids, |
| 12473 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12474 | .adc_nids = alc268_adc_nids_alt, |
| 12475 | .hp_nid = 0x03, |
| 12476 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12477 | .channel_mode = alc268_modes, |
| 12478 | .input_mux = &alc268_capture_source, |
| 12479 | .unsol_event = alc267_quanta_il1_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12480 | .init_hook = alc267_quanta_il1_init_hook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12481 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12482 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12483 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12484 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12485 | .init_verbs = { alc268_base_init_verbs }, |
| 12486 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12487 | .dac_nids = alc268_dac_nids, |
| 12488 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12489 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12490 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12491 | .hp_nid = 0x03, |
| 12492 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12493 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12494 | .channel_mode = alc268_modes, |
| 12495 | .input_mux = &alc268_capture_source, |
| 12496 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12497 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12498 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12499 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12500 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12501 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12502 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12503 | .dac_nids = alc268_dac_nids, |
| 12504 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12505 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12506 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12507 | .hp_nid = 0x03, |
| 12508 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12509 | .channel_mode = alc268_modes, |
| 12510 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12511 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12512 | .init_hook = alc268_toshiba_init_hook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12513 | }, |
| 12514 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12515 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12516 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12517 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12518 | alc268_acer_verbs }, |
| 12519 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12520 | .dac_nids = alc268_dac_nids, |
| 12521 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12522 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12523 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12524 | .hp_nid = 0x02, |
| 12525 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12526 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12527 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12528 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12529 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12530 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12531 | [ALC268_ACER_DMIC] = { |
| 12532 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12533 | alc268_beep_mixer }, |
| 12534 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12535 | alc268_acer_verbs }, |
| 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, |
| 12540 | .capsrc_nids = alc268_capsrc_nids, |
| 12541 | .hp_nid = 0x02, |
| 12542 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12543 | .channel_mode = alc268_modes, |
| 12544 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12545 | .unsol_event = alc268_acer_unsol_event, |
| 12546 | .init_hook = alc268_acer_init_hook, |
| 12547 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12548 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12549 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12550 | alc268_beep_mixer, |
| 12551 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12552 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12553 | alc268_acer_aspire_one_verbs }, |
| 12554 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12555 | .dac_nids = alc268_dac_nids, |
| 12556 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12557 | .adc_nids = alc268_adc_nids_alt, |
| 12558 | .capsrc_nids = alc268_capsrc_nids, |
| 12559 | .hp_nid = 0x03, |
| 12560 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12561 | .channel_mode = alc268_modes, |
| 12562 | .input_mux = &alc268_acer_lc_capture_source, |
| 12563 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12564 | .init_hook = alc268_acer_lc_init_hook, |
| 12565 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12566 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12567 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12568 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12569 | alc268_dell_verbs }, |
| 12570 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12571 | .dac_nids = alc268_dac_nids, |
| 12572 | .hp_nid = 0x02, |
| 12573 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12574 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12575 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12576 | .init_hook = alc268_dell_init_hook, |
| 12577 | .input_mux = &alc268_capture_source, |
| 12578 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12579 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12580 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12581 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12582 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12583 | alc268_toshiba_verbs }, |
| 12584 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12585 | .dac_nids = alc268_dac_nids, |
| 12586 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12587 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12588 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12589 | .hp_nid = 0x03, |
| 12590 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12591 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12592 | .channel_mode = alc268_modes, |
| 12593 | .input_mux = &alc268_capture_source, |
| 12594 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12595 | .init_hook = alc268_toshiba_init_hook |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12596 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12597 | #ifdef CONFIG_SND_DEBUG |
| 12598 | [ALC268_TEST] = { |
| 12599 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12600 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12601 | alc268_volume_init_verbs }, |
| 12602 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12603 | .dac_nids = alc268_dac_nids, |
| 12604 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12605 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12606 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12607 | .hp_nid = 0x03, |
| 12608 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12609 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12610 | .channel_mode = alc268_modes, |
| 12611 | .input_mux = &alc268_capture_source, |
| 12612 | }, |
| 12613 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12614 | }; |
| 12615 | |
| 12616 | static int patch_alc268(struct hda_codec *codec) |
| 12617 | { |
| 12618 | struct alc_spec *spec; |
| 12619 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12620 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12621 | |
| 12622 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12623 | if (spec == NULL) |
| 12624 | return -ENOMEM; |
| 12625 | |
| 12626 | codec->spec = spec; |
| 12627 | |
| 12628 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12629 | alc268_models, |
| 12630 | alc268_cfg_tbl); |
| 12631 | |
| 12632 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 12633 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 12634 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12635 | board_config = ALC268_AUTO; |
| 12636 | } |
| 12637 | |
| 12638 | if (board_config == ALC268_AUTO) { |
| 12639 | /* automatic parse from the BIOS config */ |
| 12640 | err = alc268_parse_auto_config(codec); |
| 12641 | if (err < 0) { |
| 12642 | alc_free(codec); |
| 12643 | return err; |
| 12644 | } else if (!err) { |
| 12645 | printk(KERN_INFO |
| 12646 | "hda_codec: Cannot set up configuration " |
| 12647 | "from BIOS. Using base mode...\n"); |
| 12648 | board_config = ALC268_3ST; |
| 12649 | } |
| 12650 | } |
| 12651 | |
| 12652 | if (board_config != ALC268_AUTO) |
| 12653 | setup_preset(spec, &alc268_presets[board_config]); |
| 12654 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12655 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12656 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12657 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12658 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12659 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12660 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12661 | has_beep = 0; |
| 12662 | for (i = 0; i < spec->num_mixers; i++) { |
| 12663 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12664 | has_beep = 1; |
| 12665 | break; |
| 12666 | } |
| 12667 | } |
| 12668 | |
| 12669 | if (has_beep) { |
| 12670 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12671 | if (err < 0) { |
| 12672 | alc_free(codec); |
| 12673 | return err; |
| 12674 | } |
| 12675 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12676 | /* override the amp caps for beep generator */ |
| 12677 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12678 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12679 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12680 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12681 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12682 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12683 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12684 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12685 | /* check whether NID 0x07 is valid */ |
| 12686 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12687 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12688 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12689 | /* get type */ |
| 12690 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12691 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12692 | spec->adc_nids = alc268_adc_nids_alt; |
| 12693 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12694 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12695 | } else { |
| 12696 | spec->adc_nids = alc268_adc_nids; |
| 12697 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12698 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12699 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12700 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12701 | /* set default input source */ |
| 12702 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12703 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12704 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12705 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12706 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12707 | |
| 12708 | spec->vmaster_nid = 0x02; |
| 12709 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12710 | codec->patch_ops = alc_patch_ops; |
| 12711 | if (board_config == ALC268_AUTO) |
| 12712 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12713 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12714 | codec->proc_widget_hook = print_realtek_coef; |
| 12715 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12716 | return 0; |
| 12717 | } |
| 12718 | |
| 12719 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12720 | * ALC269 channel source setting (2 channel) |
| 12721 | */ |
| 12722 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12723 | |
| 12724 | #define alc269_dac_nids alc260_dac_nids |
| 12725 | |
| 12726 | static hda_nid_t alc269_adc_nids[1] = { |
| 12727 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12728 | 0x08, |
| 12729 | }; |
| 12730 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12731 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12732 | 0x23, |
| 12733 | }; |
| 12734 | |
| 12735 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12736 | * not a mux! |
| 12737 | */ |
| 12738 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12739 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12740 | .num_items = 2, |
| 12741 | .items = { |
| 12742 | { "i-Mic", 0x5 }, |
| 12743 | { "e-Mic", 0x0 }, |
| 12744 | }, |
| 12745 | }; |
| 12746 | |
| 12747 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12748 | .num_items = 2, |
| 12749 | .items = { |
| 12750 | { "i-Mic", 0x1 }, |
| 12751 | { "e-Mic", 0x0 }, |
| 12752 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12753 | }; |
| 12754 | |
| 12755 | #define alc269_modes alc260_modes |
| 12756 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12757 | |
| 12758 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12759 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12760 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12761 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12762 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12763 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12764 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12765 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12766 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12767 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12768 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12769 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12770 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12771 | { } /* end */ |
| 12772 | }; |
| 12773 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12774 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12775 | /* output mixer control */ |
| 12776 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12777 | { |
| 12778 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12779 | .name = "Master Playback Switch", |
| 12780 | .info = snd_hda_mixer_amp_switch_info, |
| 12781 | .get = snd_hda_mixer_amp_switch_get, |
| 12782 | .put = alc268_acer_master_sw_put, |
| 12783 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12784 | }, |
| 12785 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12786 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12787 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12788 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12789 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12790 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12791 | { } |
| 12792 | }; |
| 12793 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12794 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12795 | /* output mixer control */ |
| 12796 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12797 | { |
| 12798 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12799 | .name = "Master Playback Switch", |
| 12800 | .info = snd_hda_mixer_amp_switch_info, |
| 12801 | .get = snd_hda_mixer_amp_switch_get, |
| 12802 | .put = alc268_acer_master_sw_put, |
| 12803 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12804 | }, |
| 12805 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12806 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12807 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12808 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12809 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12810 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12811 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12812 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12813 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12814 | { } |
| 12815 | }; |
| 12816 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12817 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12818 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12819 | .ops = &snd_hda_bind_vol, |
| 12820 | .values = { |
| 12821 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12822 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12823 | 0 |
| 12824 | }, |
| 12825 | }; |
| 12826 | |
| 12827 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12828 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12829 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12830 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12831 | { } /* end */ |
| 12832 | }; |
| 12833 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12834 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12835 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12836 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12837 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12838 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12839 | { } /* end */ |
| 12840 | }; |
| 12841 | |
| 12842 | /* FSC amilo */ |
| 12843 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12844 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12845 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12846 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12847 | { } /* end */ |
| 12848 | }; |
| 12849 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12850 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12851 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12852 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12853 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12854 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12855 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12856 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12857 | { } |
| 12858 | }; |
| 12859 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12860 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12861 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12862 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12863 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12864 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12865 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12866 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12867 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12868 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12869 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12870 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12871 | { } |
| 12872 | }; |
| 12873 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12874 | /* toggle speaker-output according to the hp-jack state */ |
| 12875 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12876 | { |
| 12877 | unsigned int present; |
| 12878 | unsigned char bits; |
| 12879 | |
| 12880 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12881 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12882 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12883 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12884 | AMP_IN_MUTE(0), bits); |
| 12885 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12886 | AMP_IN_MUTE(0), bits); |
| 12887 | |
| 12888 | snd_hda_codec_write(codec, 0x20, 0, |
| 12889 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12890 | snd_hda_codec_write(codec, 0x20, 0, |
| 12891 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12892 | |
| 12893 | snd_hda_codec_write(codec, 0x20, 0, |
| 12894 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12895 | snd_hda_codec_write(codec, 0x20, 0, |
| 12896 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12897 | } |
| 12898 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12899 | /* toggle speaker-output according to the hp-jacks state */ |
| 12900 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12901 | { |
| 12902 | unsigned int present; |
| 12903 | unsigned char bits; |
| 12904 | |
| 12905 | /* Check laptop headphone socket */ |
| 12906 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12907 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12908 | |
| 12909 | /* Check port replicator headphone socket */ |
| 12910 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12911 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12912 | |
| 12913 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12914 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12915 | AMP_IN_MUTE(0), bits); |
| 12916 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12917 | AMP_IN_MUTE(0), bits); |
| 12918 | |
| 12919 | snd_hda_codec_write(codec, 0x20, 0, |
| 12920 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12921 | snd_hda_codec_write(codec, 0x20, 0, |
| 12922 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12923 | |
| 12924 | snd_hda_codec_write(codec, 0x20, 0, |
| 12925 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12926 | snd_hda_codec_write(codec, 0x20, 0, |
| 12927 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12928 | } |
| 12929 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12930 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12931 | { |
| 12932 | unsigned int present; |
| 12933 | |
| 12934 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12935 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12936 | snd_hda_codec_write(codec, 0x23, 0, |
| 12937 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12938 | } |
| 12939 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12940 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12941 | { |
| 12942 | unsigned int present_laptop; |
| 12943 | unsigned int present_dock; |
| 12944 | |
| 12945 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12946 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12947 | |
| 12948 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12949 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12950 | |
| 12951 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12952 | if (present_dock) |
| 12953 | snd_hda_codec_write(codec, 0x23, 0, |
| 12954 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12955 | if (present_laptop) |
| 12956 | snd_hda_codec_write(codec, 0x23, 0, |
| 12957 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12958 | if (!present_dock && !present_laptop) |
| 12959 | snd_hda_codec_write(codec, 0x23, 0, |
| 12960 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12961 | } |
| 12962 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12963 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12964 | unsigned int res) |
| 12965 | { |
| 12966 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12967 | alc269_quanta_fl1_speaker_automute(codec); |
| 12968 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12969 | alc269_quanta_fl1_mic_automute(codec); |
| 12970 | } |
| 12971 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12972 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12973 | unsigned int res) |
| 12974 | { |
| 12975 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12976 | alc269_lifebook_speaker_automute(codec); |
| 12977 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12978 | alc269_lifebook_mic_autoswitch(codec); |
| 12979 | } |
| 12980 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12981 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12982 | { |
| 12983 | alc269_quanta_fl1_speaker_automute(codec); |
| 12984 | alc269_quanta_fl1_mic_automute(codec); |
| 12985 | } |
| 12986 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12987 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12988 | { |
| 12989 | alc269_lifebook_speaker_automute(codec); |
| 12990 | alc269_lifebook_mic_autoswitch(codec); |
| 12991 | } |
| 12992 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12993 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12994 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12995 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12996 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12997 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12998 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12999 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13000 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13001 | {} |
| 13002 | }; |
| 13003 | |
| 13004 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 13005 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13006 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13007 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13008 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13009 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13010 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13011 | {} |
| 13012 | }; |
| 13013 | |
| 13014 | /* toggle speaker-output according to the hp-jack state */ |
| 13015 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13016 | { |
| 13017 | unsigned int present; |
| 13018 | unsigned char bits; |
| 13019 | |
| 13020 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13021 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13022 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13023 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13024 | AMP_IN_MUTE(0), bits); |
| 13025 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13026 | AMP_IN_MUTE(0), bits); |
| 13027 | } |
| 13028 | |
| 13029 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 13030 | { |
| 13031 | unsigned int present; |
| 13032 | |
| 13033 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13034 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13035 | snd_hda_codec_write(codec, 0x23, 0, |
| 13036 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 13037 | } |
| 13038 | |
| 13039 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 13040 | { |
| 13041 | unsigned int present; |
| 13042 | |
| 13043 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13044 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13045 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13046 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13047 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13048 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13049 | } |
| 13050 | |
| 13051 | /* unsolicited event for HP jack sensing */ |
| 13052 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 13053 | unsigned int res) |
| 13054 | { |
| 13055 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13056 | alc269_speaker_automute(codec); |
| 13057 | |
| 13058 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13059 | alc269_eeepc_dmic_automute(codec); |
| 13060 | } |
| 13061 | |
| 13062 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 13063 | { |
| 13064 | alc269_speaker_automute(codec); |
| 13065 | alc269_eeepc_dmic_automute(codec); |
| 13066 | } |
| 13067 | |
| 13068 | /* unsolicited event for HP jack sensing */ |
| 13069 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 13070 | unsigned int res) |
| 13071 | { |
| 13072 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13073 | alc269_speaker_automute(codec); |
| 13074 | |
| 13075 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13076 | alc269_eeepc_amic_automute(codec); |
| 13077 | } |
| 13078 | |
| 13079 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 13080 | { |
| 13081 | alc269_speaker_automute(codec); |
| 13082 | alc269_eeepc_amic_automute(codec); |
| 13083 | } |
| 13084 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13085 | /* |
| 13086 | * generic initialization of ADC, input mixers and output mixers |
| 13087 | */ |
| 13088 | static struct hda_verb alc269_init_verbs[] = { |
| 13089 | /* |
| 13090 | * Unmute ADC0 and set the default input to mic-in |
| 13091 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13092 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13093 | |
| 13094 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 13095 | * analog-loopback mixer widget |
| 13096 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 13097 | * front panel mic (mic 2) |
| 13098 | */ |
| 13099 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 13100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13103 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13104 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13105 | |
| 13106 | /* |
| 13107 | * Set up output mixers (0x0c - 0x0e) |
| 13108 | */ |
| 13109 | /* set vol=0 to output mixers */ |
| 13110 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13111 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13112 | |
| 13113 | /* set up input amps for analog loopback */ |
| 13114 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13117 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13118 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13119 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13120 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13121 | |
| 13122 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13123 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13124 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13125 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13126 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13127 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13128 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13129 | |
| 13130 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13131 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13132 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13133 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13134 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13135 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13136 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13137 | |
| 13138 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13139 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13140 | |
| 13141 | /* FIXME: use matrix-type input source selection */ |
| 13142 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13143 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13144 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13145 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13146 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13147 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13148 | |
| 13149 | /* set EAPD */ |
| 13150 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13151 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13152 | { } |
| 13153 | }; |
| 13154 | |
| 13155 | /* add playback controls from the parsed DAC table */ |
| 13156 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13157 | const struct auto_pin_cfg *cfg) |
| 13158 | { |
| 13159 | hda_nid_t nid; |
| 13160 | int err; |
| 13161 | |
| 13162 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 13163 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13164 | spec->multiout.dac_nids[0] = 2; |
| 13165 | |
| 13166 | nid = cfg->line_out_pins[0]; |
| 13167 | if (nid) { |
| 13168 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13169 | "Front Playback Volume", |
| 13170 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 13171 | if (err < 0) |
| 13172 | return err; |
| 13173 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13174 | "Front Playback Switch", |
| 13175 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13176 | if (err < 0) |
| 13177 | return err; |
| 13178 | } |
| 13179 | |
| 13180 | nid = cfg->speaker_pins[0]; |
| 13181 | if (nid) { |
| 13182 | if (!cfg->line_out_pins[0]) { |
| 13183 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13184 | "Speaker Playback Volume", |
| 13185 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13186 | HDA_OUTPUT)); |
| 13187 | if (err < 0) |
| 13188 | return err; |
| 13189 | } |
| 13190 | if (nid == 0x16) { |
| 13191 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13192 | "Speaker Playback Switch", |
| 13193 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13194 | HDA_OUTPUT)); |
| 13195 | if (err < 0) |
| 13196 | return err; |
| 13197 | } else { |
| 13198 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13199 | "Speaker Playback Switch", |
| 13200 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13201 | HDA_OUTPUT)); |
| 13202 | if (err < 0) |
| 13203 | return err; |
| 13204 | } |
| 13205 | } |
| 13206 | nid = cfg->hp_pins[0]; |
| 13207 | if (nid) { |
| 13208 | /* spec->multiout.hp_nid = 2; */ |
| 13209 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 13210 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13211 | "Headphone Playback Volume", |
| 13212 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13213 | HDA_OUTPUT)); |
| 13214 | if (err < 0) |
| 13215 | return err; |
| 13216 | } |
| 13217 | if (nid == 0x16) { |
| 13218 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13219 | "Headphone Playback Switch", |
| 13220 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13221 | HDA_OUTPUT)); |
| 13222 | if (err < 0) |
| 13223 | return err; |
| 13224 | } else { |
| 13225 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13226 | "Headphone Playback Switch", |
| 13227 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13228 | HDA_OUTPUT)); |
| 13229 | if (err < 0) |
| 13230 | return err; |
| 13231 | } |
| 13232 | } |
| 13233 | return 0; |
| 13234 | } |
| 13235 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 13236 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13237 | const struct auto_pin_cfg *cfg) |
| 13238 | { |
| 13239 | int err; |
| 13240 | |
| 13241 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 13242 | if (err < 0) |
| 13243 | return err; |
| 13244 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 13245 | * because it's under 0x18 |
| 13246 | */ |
| 13247 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 13248 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13249 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 13250 | imux->items[imux->num_items].label = "Int Mic"; |
| 13251 | imux->items[imux->num_items].index = 0x05; |
| 13252 | imux->num_items++; |
| 13253 | } |
| 13254 | return 0; |
| 13255 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13256 | |
| 13257 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13258 | #define alc269_loopbacks alc880_loopbacks |
| 13259 | #endif |
| 13260 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13261 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13262 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13263 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13264 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13265 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13266 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13267 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13268 | .substreams = 1, |
| 13269 | .channels_min = 2, |
| 13270 | .channels_max = 8, |
| 13271 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13272 | /* NID is set in alc_build_pcms */ |
| 13273 | .ops = { |
| 13274 | .open = alc880_playback_pcm_open, |
| 13275 | .prepare = alc880_playback_pcm_prepare, |
| 13276 | .cleanup = alc880_playback_pcm_cleanup |
| 13277 | }, |
| 13278 | }; |
| 13279 | |
| 13280 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13281 | .substreams = 1, |
| 13282 | .channels_min = 2, |
| 13283 | .channels_max = 2, |
| 13284 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13285 | /* NID is set in alc_build_pcms */ |
| 13286 | }; |
| 13287 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13288 | /* |
| 13289 | * BIOS auto configuration |
| 13290 | */ |
| 13291 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13292 | { |
| 13293 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13294 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13295 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13296 | |
| 13297 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13298 | alc269_ignore); |
| 13299 | if (err < 0) |
| 13300 | return err; |
| 13301 | |
| 13302 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13303 | if (err < 0) |
| 13304 | return err; |
| 13305 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13306 | if (err < 0) |
| 13307 | return err; |
| 13308 | |
| 13309 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13310 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13311 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13312 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13313 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13314 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13315 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13316 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13317 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13318 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13319 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13320 | /* set default input source */ |
| 13321 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13322 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13323 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13324 | |
| 13325 | err = alc_auto_add_mic_boost(codec); |
| 13326 | if (err < 0) |
| 13327 | return err; |
| 13328 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13329 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13330 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13331 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13332 | return 1; |
| 13333 | } |
| 13334 | |
| 13335 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 13336 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 13337 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13338 | |
| 13339 | |
| 13340 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13341 | static void alc269_auto_init(struct hda_codec *codec) |
| 13342 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13343 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13344 | alc269_auto_init_multi_out(codec); |
| 13345 | alc269_auto_init_hp_out(codec); |
| 13346 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13347 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13348 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13349 | } |
| 13350 | |
| 13351 | /* |
| 13352 | * configuration and preset |
| 13353 | */ |
| 13354 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13355 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13356 | [ALC269_QUANTA_FL1] = "quanta", |
| 13357 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13358 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13359 | [ALC269_FUJITSU] = "fujitsu", |
| 13360 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13361 | }; |
| 13362 | |
| 13363 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13364 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13365 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13366 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13367 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13368 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13369 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13370 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13371 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13372 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13373 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13374 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13375 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13376 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13377 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13378 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13379 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13380 | {} |
| 13381 | }; |
| 13382 | |
| 13383 | static struct alc_config_preset alc269_presets[] = { |
| 13384 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13385 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13386 | .init_verbs = { alc269_init_verbs }, |
| 13387 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13388 | .dac_nids = alc269_dac_nids, |
| 13389 | .hp_nid = 0x03, |
| 13390 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13391 | .channel_mode = alc269_modes, |
| 13392 | .input_mux = &alc269_capture_source, |
| 13393 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13394 | [ALC269_QUANTA_FL1] = { |
| 13395 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13396 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13397 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13398 | .dac_nids = alc269_dac_nids, |
| 13399 | .hp_nid = 0x03, |
| 13400 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13401 | .channel_mode = alc269_modes, |
| 13402 | .input_mux = &alc269_capture_source, |
| 13403 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 13404 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13405 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13406 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13407 | .mixers = { alc269_eeepc_mixer }, |
| 13408 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13409 | .init_verbs = { alc269_init_verbs, |
| 13410 | alc269_eeepc_amic_init_verbs }, |
| 13411 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13412 | .dac_nids = alc269_dac_nids, |
| 13413 | .hp_nid = 0x03, |
| 13414 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13415 | .channel_mode = alc269_modes, |
| 13416 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 13417 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 13418 | .init_hook = alc269_eeepc_amic_inithook, |
| 13419 | }, |
| 13420 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13421 | .mixers = { alc269_eeepc_mixer }, |
| 13422 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13423 | .init_verbs = { alc269_init_verbs, |
| 13424 | alc269_eeepc_dmic_init_verbs }, |
| 13425 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13426 | .dac_nids = alc269_dac_nids, |
| 13427 | .hp_nid = 0x03, |
| 13428 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13429 | .channel_mode = alc269_modes, |
| 13430 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13431 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13432 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13433 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13434 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13435 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13436 | .cap_mixer = alc269_epc_capture_mixer, |
| 13437 | .init_verbs = { alc269_init_verbs, |
| 13438 | alc269_eeepc_dmic_init_verbs }, |
| 13439 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13440 | .dac_nids = alc269_dac_nids, |
| 13441 | .hp_nid = 0x03, |
| 13442 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13443 | .channel_mode = alc269_modes, |
| 13444 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13445 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13446 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13447 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13448 | [ALC269_LIFEBOOK] = { |
| 13449 | .mixers = { alc269_lifebook_mixer }, |
| 13450 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13451 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13452 | .dac_nids = alc269_dac_nids, |
| 13453 | .hp_nid = 0x03, |
| 13454 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13455 | .channel_mode = alc269_modes, |
| 13456 | .input_mux = &alc269_capture_source, |
| 13457 | .unsol_event = alc269_lifebook_unsol_event, |
| 13458 | .init_hook = alc269_lifebook_init_hook, |
| 13459 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13460 | }; |
| 13461 | |
| 13462 | static int patch_alc269(struct hda_codec *codec) |
| 13463 | { |
| 13464 | struct alc_spec *spec; |
| 13465 | int board_config; |
| 13466 | int err; |
| 13467 | |
| 13468 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13469 | if (spec == NULL) |
| 13470 | return -ENOMEM; |
| 13471 | |
| 13472 | codec->spec = spec; |
| 13473 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13474 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13475 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13476 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13477 | alc269_models, |
| 13478 | alc269_cfg_tbl); |
| 13479 | |
| 13480 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 13481 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 13482 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13483 | board_config = ALC269_AUTO; |
| 13484 | } |
| 13485 | |
| 13486 | if (board_config == ALC269_AUTO) { |
| 13487 | /* automatic parse from the BIOS config */ |
| 13488 | err = alc269_parse_auto_config(codec); |
| 13489 | if (err < 0) { |
| 13490 | alc_free(codec); |
| 13491 | return err; |
| 13492 | } else if (!err) { |
| 13493 | printk(KERN_INFO |
| 13494 | "hda_codec: Cannot set up configuration " |
| 13495 | "from BIOS. Using base mode...\n"); |
| 13496 | board_config = ALC269_BASIC; |
| 13497 | } |
| 13498 | } |
| 13499 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13500 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13501 | if (err < 0) { |
| 13502 | alc_free(codec); |
| 13503 | return err; |
| 13504 | } |
| 13505 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13506 | if (board_config != ALC269_AUTO) |
| 13507 | setup_preset(spec, &alc269_presets[board_config]); |
| 13508 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13509 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13510 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13511 | * fix the sample rate of analog I/O to 44.1kHz |
| 13512 | */ |
| 13513 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13514 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13515 | } else { |
| 13516 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13517 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13518 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13519 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13520 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13521 | |
| 13522 | spec->adc_nids = alc269_adc_nids; |
| 13523 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13524 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13525 | if (!spec->cap_mixer) |
| 13526 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13527 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13528 | |
| 13529 | codec->patch_ops = alc_patch_ops; |
| 13530 | if (board_config == ALC269_AUTO) |
| 13531 | spec->init_hook = alc269_auto_init; |
| 13532 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13533 | if (!spec->loopback.amplist) |
| 13534 | spec->loopback.amplist = alc269_loopbacks; |
| 13535 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13536 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13537 | |
| 13538 | return 0; |
| 13539 | } |
| 13540 | |
| 13541 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13542 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13543 | */ |
| 13544 | |
| 13545 | /* |
| 13546 | * set the path ways for 2 channel output |
| 13547 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13548 | */ |
| 13549 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13550 | /* set pin widget 1Ah (line in) for input */ |
| 13551 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13552 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13553 | * the vref |
| 13554 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13555 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13556 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13557 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13558 | #if 0 |
| 13559 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13560 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13561 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13562 | { } /* end */ |
| 13563 | }; |
| 13564 | /* |
| 13565 | * 6ch mode |
| 13566 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13567 | */ |
| 13568 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13569 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13570 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13571 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13572 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13573 | |
| 13574 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13575 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13576 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13577 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13578 | #if 0 |
| 13579 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13580 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13581 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13582 | { } /* end */ |
| 13583 | }; |
| 13584 | |
| 13585 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13586 | { 2, alc861_threestack_ch2_init }, |
| 13587 | { 6, alc861_threestack_ch6_init }, |
| 13588 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13589 | /* Set mic1 as input and unmute the mixer */ |
| 13590 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13591 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13592 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13593 | { } /* end */ |
| 13594 | }; |
| 13595 | /* Set mic1 as output and mute mixer */ |
| 13596 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13597 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13598 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13599 | { } /* end */ |
| 13600 | }; |
| 13601 | |
| 13602 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13603 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13604 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13605 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13606 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13607 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13608 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13609 | /* set pin widget 1Ah (line in) for input */ |
| 13610 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13611 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13612 | * the vref |
| 13613 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13614 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13615 | |
| 13616 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13617 | #if 0 |
| 13618 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13619 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13620 | #endif |
| 13621 | { } /* end */ |
| 13622 | }; |
| 13623 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13624 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13625 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13626 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13627 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13628 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13629 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13630 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13631 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13632 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13633 | |
| 13634 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13635 | #if 0 |
| 13636 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13637 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13638 | #endif |
| 13639 | { } /* end */ |
| 13640 | }; |
| 13641 | |
| 13642 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13643 | { 2, alc861_asus_ch2_init }, |
| 13644 | { 6, alc861_asus_ch6_init }, |
| 13645 | }; |
| 13646 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13647 | /* patch-ALC861 */ |
| 13648 | |
| 13649 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13650 | /* output mixer control */ |
| 13651 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13652 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13653 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13654 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13655 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13656 | |
| 13657 | /*Input mixer control */ |
| 13658 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13659 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13660 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13661 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13662 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13663 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13664 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13665 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13666 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13667 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13668 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13669 | { } /* end */ |
| 13670 | }; |
| 13671 | |
| 13672 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13673 | /* output mixer control */ |
| 13674 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13675 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13676 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13677 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13678 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13679 | |
| 13680 | /* Input mixer control */ |
| 13681 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13682 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13683 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13684 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13685 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13686 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13687 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13688 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13689 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13690 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13691 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13692 | { |
| 13693 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13694 | .name = "Channel Mode", |
| 13695 | .info = alc_ch_mode_info, |
| 13696 | .get = alc_ch_mode_get, |
| 13697 | .put = alc_ch_mode_put, |
| 13698 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13699 | }, |
| 13700 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13701 | }; |
| 13702 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13703 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13704 | /* output mixer control */ |
| 13705 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13707 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13708 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13709 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13710 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13711 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13712 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13713 | /* output mixer control */ |
| 13714 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13715 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13716 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13717 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13718 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13719 | |
| 13720 | /* Input mixer control */ |
| 13721 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13722 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13723 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13724 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13725 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13726 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13727 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13728 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13729 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13730 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13731 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13732 | { |
| 13733 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13734 | .name = "Channel Mode", |
| 13735 | .info = alc_ch_mode_info, |
| 13736 | .get = alc_ch_mode_get, |
| 13737 | .put = alc_ch_mode_put, |
| 13738 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13739 | }, |
| 13740 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13741 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13742 | |
| 13743 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13744 | /* output mixer control */ |
| 13745 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13746 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13747 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13748 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13749 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13750 | |
| 13751 | /* Input mixer control */ |
| 13752 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13753 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13754 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13755 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13756 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13757 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13758 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13759 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13760 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13761 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13762 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13763 | { |
| 13764 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13765 | .name = "Channel Mode", |
| 13766 | .info = alc_ch_mode_info, |
| 13767 | .get = alc_ch_mode_get, |
| 13768 | .put = alc_ch_mode_put, |
| 13769 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13770 | }, |
| 13771 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13772 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13773 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13774 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13775 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13776 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13777 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13778 | { } |
| 13779 | }; |
| 13780 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13781 | /* |
| 13782 | * generic initialization of ADC, input mixers and output mixers |
| 13783 | */ |
| 13784 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13785 | /* |
| 13786 | * Unmute ADC0 and set the default input to mic-in |
| 13787 | */ |
| 13788 | /* port-A for surround (rear panel) */ |
| 13789 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13790 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13791 | /* port-B for mic-in (rear panel) with vref */ |
| 13792 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13793 | /* port-C for line-in (rear panel) */ |
| 13794 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13795 | /* port-D for Front */ |
| 13796 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13797 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13798 | /* port-E for HP out (front panel) */ |
| 13799 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13800 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13801 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13802 | /* port-F for mic-in (front panel) with vref */ |
| 13803 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13804 | /* port-G for CLFE (rear panel) */ |
| 13805 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13806 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13807 | /* port-H for side (rear panel) */ |
| 13808 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13809 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13810 | /* CD-in */ |
| 13811 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13812 | /* route front mic to ADC1*/ |
| 13813 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13814 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13815 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13816 | /* Unmute DAC0~3 & spdif out*/ |
| 13817 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13818 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13819 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13820 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13821 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13822 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13823 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13824 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13825 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13826 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13827 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13828 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13829 | /* Unmute Stereo Mixer 15 */ |
| 13830 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13831 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13832 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13833 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13834 | |
| 13835 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13836 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13837 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13838 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13839 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13840 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13841 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13842 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13843 | /* hp used DAC 3 (Front) */ |
| 13844 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13845 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13846 | |
| 13847 | { } |
| 13848 | }; |
| 13849 | |
| 13850 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13851 | /* |
| 13852 | * Unmute ADC0 and set the default input to mic-in |
| 13853 | */ |
| 13854 | /* port-A for surround (rear panel) */ |
| 13855 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13856 | /* port-B for mic-in (rear panel) with vref */ |
| 13857 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13858 | /* port-C for line-in (rear panel) */ |
| 13859 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13860 | /* port-D for Front */ |
| 13861 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13862 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13863 | /* port-E for HP out (front panel) */ |
| 13864 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13865 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13866 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13867 | /* port-F for mic-in (front panel) with vref */ |
| 13868 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13869 | /* port-G for CLFE (rear panel) */ |
| 13870 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13871 | /* port-H for side (rear panel) */ |
| 13872 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13873 | /* CD-in */ |
| 13874 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13875 | /* route front mic to ADC1*/ |
| 13876 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13877 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13878 | /* Unmute DAC0~3 & spdif out*/ |
| 13879 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13880 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13881 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13882 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13883 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13884 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13885 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13886 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13887 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13888 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13889 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13890 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13891 | /* Unmute Stereo Mixer 15 */ |
| 13892 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13893 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13894 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13895 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13896 | |
| 13897 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13898 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13899 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13900 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13901 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13902 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13903 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13904 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13905 | /* hp used DAC 3 (Front) */ |
| 13906 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13907 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13908 | { } |
| 13909 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13910 | |
| 13911 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13912 | /* |
| 13913 | * Unmute ADC0 and set the default input to mic-in |
| 13914 | */ |
| 13915 | /* port-A for surround (rear panel) */ |
| 13916 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13917 | /* port-B for mic-in (rear panel) with vref */ |
| 13918 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13919 | /* port-C for line-in (rear panel) */ |
| 13920 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13921 | /* port-D for Front */ |
| 13922 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13923 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13924 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13925 | /* this has to be set to VREF80 */ |
| 13926 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13927 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13928 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13929 | /* port-F for mic-in (front panel) with vref */ |
| 13930 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13931 | /* port-G for CLFE (rear panel) */ |
| 13932 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13933 | /* port-H for side (rear panel) */ |
| 13934 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13935 | /* CD-in */ |
| 13936 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13937 | /* route front mic to ADC1*/ |
| 13938 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13939 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13940 | /* Unmute DAC0~3 & spdif out*/ |
| 13941 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13942 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13943 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13944 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13945 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13946 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13947 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13948 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13949 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13950 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13951 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13952 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13953 | /* Unmute Stereo Mixer 15 */ |
| 13954 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13955 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13956 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13957 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13958 | |
| 13959 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13960 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13961 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13962 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13963 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13964 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13965 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13966 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13967 | /* hp used DAC 3 (Front) */ |
| 13968 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13969 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13970 | { } |
| 13971 | }; |
| 13972 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13973 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13974 | /* |
| 13975 | * Unmute ADC0 and set the default input to mic-in |
| 13976 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13977 | /* port-A for surround (rear panel) |
| 13978 | * according to codec#0 this is the HP jack |
| 13979 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13980 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13981 | /* route front PCM to HP */ |
| 13982 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13983 | /* port-B for mic-in (rear panel) with vref */ |
| 13984 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13985 | /* port-C for line-in (rear panel) */ |
| 13986 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13987 | /* port-D for Front */ |
| 13988 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13989 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13990 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13991 | /* this has to be set to VREF80 */ |
| 13992 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13993 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13994 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13995 | /* port-F for mic-in (front panel) with vref */ |
| 13996 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13997 | /* port-G for CLFE (rear panel) */ |
| 13998 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13999 | /* port-H for side (rear panel) */ |
| 14000 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14001 | /* CD-in */ |
| 14002 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14003 | /* route front mic to ADC1*/ |
| 14004 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14005 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14006 | /* Unmute DAC0~3 & spdif out*/ |
| 14007 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14008 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14009 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14010 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14011 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14012 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14013 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14014 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14015 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14016 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14017 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14018 | /* Unmute Stereo Mixer 15 */ |
| 14019 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14020 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14021 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14022 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14023 | |
| 14024 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14025 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14026 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14027 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14028 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14029 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14030 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14031 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14032 | /* hp used DAC 3 (Front) */ |
| 14033 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14034 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14035 | { } |
| 14036 | }; |
| 14037 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14038 | /* additional init verbs for ASUS laptops */ |
| 14039 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14040 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14041 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14042 | { } |
| 14043 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14044 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14045 | /* |
| 14046 | * generic initialization of ADC, input mixers and output mixers |
| 14047 | */ |
| 14048 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14049 | /* |
| 14050 | * Unmute ADC0 and set the default input to mic-in |
| 14051 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14052 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14053 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14054 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14055 | /* Unmute DAC0~3 & spdif out*/ |
| 14056 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14057 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14058 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14059 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14060 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14061 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14062 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14063 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14064 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14065 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14066 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14067 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14068 | /* Unmute Stereo Mixer 15 */ |
| 14069 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14070 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14071 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14072 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14073 | |
| 14074 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14075 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14076 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14077 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14078 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14079 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14080 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14081 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14082 | |
| 14083 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14084 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14085 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14086 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14087 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14088 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14089 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14090 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14091 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14092 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14093 | |
| 14094 | { } |
| 14095 | }; |
| 14096 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14097 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14098 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14099 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14100 | { } |
| 14101 | }; |
| 14102 | |
| 14103 | /* toggle speaker-output according to the hp-jack state */ |
| 14104 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14105 | { |
| 14106 | unsigned int present; |
| 14107 | |
| 14108 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 14109 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14110 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14111 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14112 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14113 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14114 | } |
| 14115 | |
| 14116 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14117 | unsigned int res) |
| 14118 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14119 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14120 | alc861_toshiba_automute(codec); |
| 14121 | } |
| 14122 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14123 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14124 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14125 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14126 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14127 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14128 | |
| 14129 | |
| 14130 | #define ALC861_DIGOUT_NID 0x07 |
| 14131 | |
| 14132 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14133 | { 8, NULL } |
| 14134 | }; |
| 14135 | |
| 14136 | static hda_nid_t alc861_dac_nids[4] = { |
| 14137 | /* front, surround, clfe, side */ |
| 14138 | 0x03, 0x06, 0x05, 0x04 |
| 14139 | }; |
| 14140 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14141 | static hda_nid_t alc660_dac_nids[3] = { |
| 14142 | /* front, clfe, surround */ |
| 14143 | 0x03, 0x05, 0x06 |
| 14144 | }; |
| 14145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14146 | static hda_nid_t alc861_adc_nids[1] = { |
| 14147 | /* ADC0-2 */ |
| 14148 | 0x08, |
| 14149 | }; |
| 14150 | |
| 14151 | static struct hda_input_mux alc861_capture_source = { |
| 14152 | .num_items = 5, |
| 14153 | .items = { |
| 14154 | { "Mic", 0x0 }, |
| 14155 | { "Front Mic", 0x3 }, |
| 14156 | { "Line", 0x1 }, |
| 14157 | { "CD", 0x4 }, |
| 14158 | { "Mixer", 0x5 }, |
| 14159 | }, |
| 14160 | }; |
| 14161 | |
| 14162 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14163 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 14164 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14165 | { |
| 14166 | int i; |
| 14167 | hda_nid_t nid; |
| 14168 | |
| 14169 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14170 | for (i = 0; i < cfg->line_outs; i++) { |
| 14171 | nid = cfg->line_out_pins[i]; |
| 14172 | if (nid) { |
| 14173 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 14174 | continue; |
| 14175 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 14176 | } |
| 14177 | } |
| 14178 | spec->multiout.num_dacs = cfg->line_outs; |
| 14179 | return 0; |
| 14180 | } |
| 14181 | |
| 14182 | /* add playback controls from the parsed DAC table */ |
| 14183 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14184 | const struct auto_pin_cfg *cfg) |
| 14185 | { |
| 14186 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14187 | static const char *chname[4] = { |
| 14188 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14189 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14190 | hda_nid_t nid; |
| 14191 | int i, idx, err; |
| 14192 | |
| 14193 | for (i = 0; i < cfg->line_outs; i++) { |
| 14194 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14195 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14196 | continue; |
| 14197 | if (nid == 0x05) { |
| 14198 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14199 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14200 | "Center Playback Switch", |
| 14201 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 14202 | HDA_OUTPUT)); |
| 14203 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14204 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14205 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14206 | "LFE Playback Switch", |
| 14207 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 14208 | HDA_OUTPUT)); |
| 14209 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14210 | return err; |
| 14211 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14212 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 14213 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14214 | if (nid == alc861_dac_nids[idx]) |
| 14215 | break; |
| 14216 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14217 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14218 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 14219 | HDA_OUTPUT)); |
| 14220 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14221 | return err; |
| 14222 | } |
| 14223 | } |
| 14224 | return 0; |
| 14225 | } |
| 14226 | |
| 14227 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 14228 | { |
| 14229 | int err; |
| 14230 | hda_nid_t nid; |
| 14231 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14232 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14233 | return 0; |
| 14234 | |
| 14235 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 14236 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14237 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 14238 | "Headphone Playback Switch", |
| 14239 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 14240 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14241 | return err; |
| 14242 | spec->multiout.hp_nid = nid; |
| 14243 | } |
| 14244 | return 0; |
| 14245 | } |
| 14246 | |
| 14247 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14248 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 14249 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14250 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14251 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14252 | int i, err, idx, idx1; |
| 14253 | |
| 14254 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14255 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14256 | case 0x0c: |
| 14257 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14258 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14259 | break; |
| 14260 | case 0x0f: |
| 14261 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14262 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14263 | break; |
| 14264 | case 0x0d: |
| 14265 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14266 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14267 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14268 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14269 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14270 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14271 | break; |
| 14272 | case 0x11: |
| 14273 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14274 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14275 | break; |
| 14276 | default: |
| 14277 | continue; |
| 14278 | } |
| 14279 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14280 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14281 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14282 | if (err < 0) |
| 14283 | return err; |
| 14284 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14285 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14286 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14287 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14288 | } |
| 14289 | return 0; |
| 14290 | } |
| 14291 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14292 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14293 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14294 | int pin_type, int dac_idx) |
| 14295 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14296 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14297 | pin_type); |
| 14298 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14299 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14300 | } |
| 14301 | |
| 14302 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14303 | { |
| 14304 | struct alc_spec *spec = codec->spec; |
| 14305 | int i; |
| 14306 | |
| 14307 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14308 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14309 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14310 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14311 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14312 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14313 | } |
| 14314 | } |
| 14315 | |
| 14316 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14317 | { |
| 14318 | struct alc_spec *spec = codec->spec; |
| 14319 | hda_nid_t pin; |
| 14320 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 14321 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14322 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14323 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 14324 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14325 | pin = spec->autocfg.speaker_pins[0]; |
| 14326 | if (pin) |
| 14327 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14328 | } |
| 14329 | |
| 14330 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14331 | { |
| 14332 | struct alc_spec *spec = codec->spec; |
| 14333 | int i; |
| 14334 | |
| 14335 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14336 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14337 | if (nid >= 0x0c && nid <= 0x11) |
| 14338 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14339 | } |
| 14340 | } |
| 14341 | |
| 14342 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14343 | /* return 1 if successful, 0 if the proper config is not found, |
| 14344 | * or a negative error code |
| 14345 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14346 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14347 | { |
| 14348 | struct alc_spec *spec = codec->spec; |
| 14349 | int err; |
| 14350 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14351 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14352 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14353 | alc861_ignore); |
| 14354 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14355 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14356 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14357 | return 0; /* can't find valid BIOS pin config */ |
| 14358 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14359 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14360 | if (err < 0) |
| 14361 | return err; |
| 14362 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14363 | if (err < 0) |
| 14364 | return err; |
| 14365 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 14366 | if (err < 0) |
| 14367 | return err; |
| 14368 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14369 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14370 | return err; |
| 14371 | |
| 14372 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14373 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14374 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14375 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14376 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14377 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14378 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14379 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14380 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14381 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14382 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14383 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14384 | |
| 14385 | spec->adc_nids = alc861_adc_nids; |
| 14386 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14387 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14388 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14389 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14390 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14391 | return 1; |
| 14392 | } |
| 14393 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14394 | /* additional initialization for auto-configuration model */ |
| 14395 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14396 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14397 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14398 | alc861_auto_init_multi_out(codec); |
| 14399 | alc861_auto_init_hp_out(codec); |
| 14400 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14401 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14402 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14403 | } |
| 14404 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14405 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14406 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14407 | { 0x15, HDA_INPUT, 0 }, |
| 14408 | { 0x15, HDA_INPUT, 1 }, |
| 14409 | { 0x15, HDA_INPUT, 2 }, |
| 14410 | { 0x15, HDA_INPUT, 3 }, |
| 14411 | { } /* end */ |
| 14412 | }; |
| 14413 | #endif |
| 14414 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14415 | |
| 14416 | /* |
| 14417 | * configuration and preset |
| 14418 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14419 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14420 | [ALC861_3ST] = "3stack", |
| 14421 | [ALC660_3ST] = "3stack-660", |
| 14422 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14423 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14424 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14425 | [ALC861_TOSHIBA] = "toshiba", |
| 14426 | [ALC861_ASUS] = "asus", |
| 14427 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14428 | [ALC861_AUTO] = "auto", |
| 14429 | }; |
| 14430 | |
| 14431 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14432 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14433 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14434 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14435 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14436 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14437 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14438 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14439 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14440 | * Any other models that need this preset? |
| 14441 | */ |
| 14442 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14443 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14444 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14445 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14446 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14447 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14448 | /* FIXME: the below seems conflict */ |
| 14449 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14450 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14451 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14452 | {} |
| 14453 | }; |
| 14454 | |
| 14455 | static struct alc_config_preset alc861_presets[] = { |
| 14456 | [ALC861_3ST] = { |
| 14457 | .mixers = { alc861_3ST_mixer }, |
| 14458 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14459 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14460 | .dac_nids = alc861_dac_nids, |
| 14461 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14462 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14463 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14464 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14465 | .adc_nids = alc861_adc_nids, |
| 14466 | .input_mux = &alc861_capture_source, |
| 14467 | }, |
| 14468 | [ALC861_3ST_DIG] = { |
| 14469 | .mixers = { alc861_base_mixer }, |
| 14470 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14471 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14472 | .dac_nids = alc861_dac_nids, |
| 14473 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14474 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14475 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14476 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14477 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14478 | .adc_nids = alc861_adc_nids, |
| 14479 | .input_mux = &alc861_capture_source, |
| 14480 | }, |
| 14481 | [ALC861_6ST_DIG] = { |
| 14482 | .mixers = { alc861_base_mixer }, |
| 14483 | .init_verbs = { alc861_base_init_verbs }, |
| 14484 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14485 | .dac_nids = alc861_dac_nids, |
| 14486 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14487 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14488 | .channel_mode = alc861_8ch_modes, |
| 14489 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14490 | .adc_nids = alc861_adc_nids, |
| 14491 | .input_mux = &alc861_capture_source, |
| 14492 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14493 | [ALC660_3ST] = { |
| 14494 | .mixers = { alc861_3ST_mixer }, |
| 14495 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14496 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14497 | .dac_nids = alc660_dac_nids, |
| 14498 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14499 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14500 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14501 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14502 | .adc_nids = alc861_adc_nids, |
| 14503 | .input_mux = &alc861_capture_source, |
| 14504 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14505 | [ALC861_UNIWILL_M31] = { |
| 14506 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14507 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14508 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14509 | .dac_nids = alc861_dac_nids, |
| 14510 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14511 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14512 | .channel_mode = alc861_uniwill_m31_modes, |
| 14513 | .need_dac_fix = 1, |
| 14514 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14515 | .adc_nids = alc861_adc_nids, |
| 14516 | .input_mux = &alc861_capture_source, |
| 14517 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14518 | [ALC861_TOSHIBA] = { |
| 14519 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14520 | .init_verbs = { alc861_base_init_verbs, |
| 14521 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14522 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14523 | .dac_nids = alc861_dac_nids, |
| 14524 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14525 | .channel_mode = alc883_3ST_2ch_modes, |
| 14526 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14527 | .adc_nids = alc861_adc_nids, |
| 14528 | .input_mux = &alc861_capture_source, |
| 14529 | .unsol_event = alc861_toshiba_unsol_event, |
| 14530 | .init_hook = alc861_toshiba_automute, |
| 14531 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14532 | [ALC861_ASUS] = { |
| 14533 | .mixers = { alc861_asus_mixer }, |
| 14534 | .init_verbs = { alc861_asus_init_verbs }, |
| 14535 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14536 | .dac_nids = alc861_dac_nids, |
| 14537 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14538 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14539 | .channel_mode = alc861_asus_modes, |
| 14540 | .need_dac_fix = 1, |
| 14541 | .hp_nid = 0x06, |
| 14542 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14543 | .adc_nids = alc861_adc_nids, |
| 14544 | .input_mux = &alc861_capture_source, |
| 14545 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14546 | [ALC861_ASUS_LAPTOP] = { |
| 14547 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14548 | .init_verbs = { alc861_asus_init_verbs, |
| 14549 | alc861_asus_laptop_init_verbs }, |
| 14550 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14551 | .dac_nids = alc861_dac_nids, |
| 14552 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14553 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14554 | .channel_mode = alc883_3ST_2ch_modes, |
| 14555 | .need_dac_fix = 1, |
| 14556 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14557 | .adc_nids = alc861_adc_nids, |
| 14558 | .input_mux = &alc861_capture_source, |
| 14559 | }, |
| 14560 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14561 | |
| 14562 | |
| 14563 | static int patch_alc861(struct hda_codec *codec) |
| 14564 | { |
| 14565 | struct alc_spec *spec; |
| 14566 | int board_config; |
| 14567 | int err; |
| 14568 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14569 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14570 | if (spec == NULL) |
| 14571 | return -ENOMEM; |
| 14572 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14573 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14574 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14575 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14576 | alc861_models, |
| 14577 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14578 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14579 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 14580 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 14581 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14582 | board_config = ALC861_AUTO; |
| 14583 | } |
| 14584 | |
| 14585 | if (board_config == ALC861_AUTO) { |
| 14586 | /* automatic parse from the BIOS config */ |
| 14587 | err = alc861_parse_auto_config(codec); |
| 14588 | if (err < 0) { |
| 14589 | alc_free(codec); |
| 14590 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14591 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14592 | printk(KERN_INFO |
| 14593 | "hda_codec: Cannot set up configuration " |
| 14594 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14595 | board_config = ALC861_3ST_DIG; |
| 14596 | } |
| 14597 | } |
| 14598 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14599 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14600 | if (err < 0) { |
| 14601 | alc_free(codec); |
| 14602 | return err; |
| 14603 | } |
| 14604 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14605 | if (board_config != ALC861_AUTO) |
| 14606 | setup_preset(spec, &alc861_presets[board_config]); |
| 14607 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14608 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14609 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14610 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14611 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14612 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14613 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14614 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14615 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14616 | spec->vmaster_nid = 0x03; |
| 14617 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14618 | codec->patch_ops = alc_patch_ops; |
| 14619 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14620 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14621 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14622 | if (!spec->loopback.amplist) |
| 14623 | spec->loopback.amplist = alc861_loopbacks; |
| 14624 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14625 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14626 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14627 | return 0; |
| 14628 | } |
| 14629 | |
| 14630 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14631 | * ALC861-VD support |
| 14632 | * |
| 14633 | * Based on ALC882 |
| 14634 | * |
| 14635 | * In addition, an independent DAC |
| 14636 | */ |
| 14637 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14638 | |
| 14639 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14640 | /* front, surr, clfe, side surr */ |
| 14641 | 0x02, 0x03, 0x04, 0x05 |
| 14642 | }; |
| 14643 | |
| 14644 | /* dac_nids for ALC660vd are in a different order - according to |
| 14645 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14646 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14647 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14648 | * - and it is the same as in 861vd. |
| 14649 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14650 | */ |
| 14651 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14652 | /* front, rear, clfe, rear_surr */ |
| 14653 | 0x02, 0x04, 0x03 |
| 14654 | }; |
| 14655 | |
| 14656 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14657 | /* ADC0 */ |
| 14658 | 0x09, |
| 14659 | }; |
| 14660 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14661 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14662 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14663 | /* input MUX */ |
| 14664 | /* FIXME: should be a matrix-type input source selection */ |
| 14665 | static struct hda_input_mux alc861vd_capture_source = { |
| 14666 | .num_items = 4, |
| 14667 | .items = { |
| 14668 | { "Mic", 0x0 }, |
| 14669 | { "Front Mic", 0x1 }, |
| 14670 | { "Line", 0x2 }, |
| 14671 | { "CD", 0x4 }, |
| 14672 | }, |
| 14673 | }; |
| 14674 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14675 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14676 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14677 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14678 | { "Ext Mic", 0x0 }, |
| 14679 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14680 | }, |
| 14681 | }; |
| 14682 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14683 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14684 | .num_items = 2, |
| 14685 | .items = { |
| 14686 | { "Front Mic", 0x0 }, |
| 14687 | { "ATAPI Mic", 0x1 }, |
| 14688 | }, |
| 14689 | }; |
| 14690 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14691 | /* |
| 14692 | * 2ch mode |
| 14693 | */ |
| 14694 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14695 | { 2, NULL } |
| 14696 | }; |
| 14697 | |
| 14698 | /* |
| 14699 | * 6ch mode |
| 14700 | */ |
| 14701 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14702 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14703 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14704 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14705 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14706 | { } /* end */ |
| 14707 | }; |
| 14708 | |
| 14709 | /* |
| 14710 | * 8ch mode |
| 14711 | */ |
| 14712 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14713 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14714 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14715 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14716 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14717 | { } /* end */ |
| 14718 | }; |
| 14719 | |
| 14720 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14721 | { 6, alc861vd_6stack_ch6_init }, |
| 14722 | { 8, alc861vd_6stack_ch8_init }, |
| 14723 | }; |
| 14724 | |
| 14725 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14726 | { |
| 14727 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14728 | .name = "Channel Mode", |
| 14729 | .info = alc_ch_mode_info, |
| 14730 | .get = alc_ch_mode_get, |
| 14731 | .put = alc_ch_mode_put, |
| 14732 | }, |
| 14733 | { } /* end */ |
| 14734 | }; |
| 14735 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14736 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14737 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14738 | */ |
| 14739 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14740 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14741 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14742 | |
| 14743 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14744 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14745 | |
| 14746 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14747 | HDA_OUTPUT), |
| 14748 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14749 | HDA_OUTPUT), |
| 14750 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14751 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14752 | |
| 14753 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14754 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14755 | |
| 14756 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14757 | |
| 14758 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14759 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14760 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14761 | |
| 14762 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14763 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14764 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14765 | |
| 14766 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14767 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14768 | |
| 14769 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14770 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14771 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14772 | { } /* end */ |
| 14773 | }; |
| 14774 | |
| 14775 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14776 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14777 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14778 | |
| 14779 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14780 | |
| 14781 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14782 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14783 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14784 | |
| 14785 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14786 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14787 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14788 | |
| 14789 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14790 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14791 | |
| 14792 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14793 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14794 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14795 | { } /* end */ |
| 14796 | }; |
| 14797 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14798 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14799 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14800 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14801 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14802 | |
| 14803 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14804 | |
| 14805 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14806 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14807 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14808 | |
| 14809 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14810 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14811 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14812 | |
| 14813 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14814 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14815 | |
| 14816 | { } /* end */ |
| 14817 | }; |
| 14818 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14819 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14820 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14821 | */ |
| 14822 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14823 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14824 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14825 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14826 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14827 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14828 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14829 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14830 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14831 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14832 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14833 | { } /* end */ |
| 14834 | }; |
| 14835 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14836 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14837 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14838 | */ |
| 14839 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14840 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14841 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14842 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14843 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14844 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14845 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14846 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14847 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14848 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14849 | { } /* end */ |
| 14850 | }; |
| 14851 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14852 | /* |
| 14853 | * generic initialization of ADC, input mixers and output mixers |
| 14854 | */ |
| 14855 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14856 | /* |
| 14857 | * Unmute ADC0 and set the default input to mic-in |
| 14858 | */ |
| 14859 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14860 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14861 | |
| 14862 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14863 | * the analog-loopback mixer widget |
| 14864 | */ |
| 14865 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14866 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14867 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14868 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14869 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14870 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14871 | |
| 14872 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14873 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14874 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14875 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14876 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14877 | |
| 14878 | /* |
| 14879 | * Set up output mixers (0x02 - 0x05) |
| 14880 | */ |
| 14881 | /* set vol=0 to output mixers */ |
| 14882 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14883 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14884 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14885 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14886 | |
| 14887 | /* set up input amps for analog loopback */ |
| 14888 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14889 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14890 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14891 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14892 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14893 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14894 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14895 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14896 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14897 | |
| 14898 | { } |
| 14899 | }; |
| 14900 | |
| 14901 | /* |
| 14902 | * 3-stack pin configuration: |
| 14903 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14904 | */ |
| 14905 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14906 | /* |
| 14907 | * Set pin mode and muting |
| 14908 | */ |
| 14909 | /* set front pin widgets 0x14 for output */ |
| 14910 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14911 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14912 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14913 | |
| 14914 | /* Mic (rear) pin: input vref at 80% */ |
| 14915 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14916 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14917 | /* Front Mic pin: input vref at 80% */ |
| 14918 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14919 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14920 | /* Line In pin: input */ |
| 14921 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14922 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14923 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14924 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14925 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14926 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14927 | /* CD pin widget for input */ |
| 14928 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14929 | |
| 14930 | { } |
| 14931 | }; |
| 14932 | |
| 14933 | /* |
| 14934 | * 6-stack pin configuration: |
| 14935 | */ |
| 14936 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14937 | /* |
| 14938 | * Set pin mode and muting |
| 14939 | */ |
| 14940 | /* set front pin widgets 0x14 for output */ |
| 14941 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14942 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14943 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14944 | |
| 14945 | /* Rear Pin: output 1 (0x0d) */ |
| 14946 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14947 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14948 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14949 | /* CLFE Pin: output 2 (0x0e) */ |
| 14950 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14951 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14952 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14953 | /* Side Pin: output 3 (0x0f) */ |
| 14954 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14955 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14956 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14957 | |
| 14958 | /* Mic (rear) pin: input vref at 80% */ |
| 14959 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14960 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14961 | /* Front Mic pin: input vref at 80% */ |
| 14962 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14963 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14964 | /* Line In pin: input */ |
| 14965 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14966 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14967 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14968 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14969 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14970 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14971 | /* CD pin widget for input */ |
| 14972 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14973 | |
| 14974 | { } |
| 14975 | }; |
| 14976 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14977 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14978 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14979 | { } |
| 14980 | }; |
| 14981 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14982 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14983 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14984 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14985 | { } |
| 14986 | }; |
| 14987 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14988 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14989 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14990 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14991 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14992 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14993 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14994 | {} |
| 14995 | }; |
| 14996 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14997 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14998 | { |
| 14999 | unsigned int present; |
| 15000 | unsigned char bits; |
| 15001 | |
| 15002 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15003 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15004 | bits = present ? HDA_AMP_MUTE : 0; |
| 15005 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15006 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15007 | } |
| 15008 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15009 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15010 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15011 | struct alc_spec *spec = codec->spec; |
| 15012 | |
| 15013 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15014 | spec->autocfg.speaker_pins[0] = 0x14; |
| 15015 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15016 | alc861vd_lenovo_mic_automute(codec); |
| 15017 | } |
| 15018 | |
| 15019 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15020 | unsigned int res) |
| 15021 | { |
| 15022 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15023 | case ALC880_MIC_EVENT: |
| 15024 | alc861vd_lenovo_mic_automute(codec); |
| 15025 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15026 | default: |
| 15027 | alc_automute_amp_unsol_event(codec, res); |
| 15028 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15029 | } |
| 15030 | } |
| 15031 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15032 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15033 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15034 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15035 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15036 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15037 | |
| 15038 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15039 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15040 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15041 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15042 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15043 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15044 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15045 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15046 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15047 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15048 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15049 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15050 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15051 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15052 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15053 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15054 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15055 | |
| 15056 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15057 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15058 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15059 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15060 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15061 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15062 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15063 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15064 | |
| 15065 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15066 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15067 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15068 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15069 | |
| 15070 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15071 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15072 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15073 | |
| 15074 | { } /* end */ |
| 15075 | }; |
| 15076 | |
| 15077 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15078 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15079 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15080 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15081 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15082 | spec->autocfg.hp_pins[0] = 0x15; |
| 15083 | spec->autocfg.speaker_pins[0] = 0x14; |
| 15084 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15085 | } |
| 15086 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15087 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15088 | #define alc861vd_loopbacks alc880_loopbacks |
| 15089 | #endif |
| 15090 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15091 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15092 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15093 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15094 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15095 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15096 | |
| 15097 | /* |
| 15098 | * configuration and preset |
| 15099 | */ |
| 15100 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15101 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15102 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15103 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15104 | [ALC861VD_3ST] = "3stack", |
| 15105 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15106 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15107 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15108 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15109 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15110 | [ALC861VD_AUTO] = "auto", |
| 15111 | }; |
| 15112 | |
| 15113 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15114 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15115 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15116 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15117 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15118 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15119 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15120 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15121 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15122 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15123 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15124 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15125 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15126 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15127 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15128 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15129 | {} |
| 15130 | }; |
| 15131 | |
| 15132 | static struct alc_config_preset alc861vd_presets[] = { |
| 15133 | [ALC660VD_3ST] = { |
| 15134 | .mixers = { alc861vd_3st_mixer }, |
| 15135 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15136 | alc861vd_3stack_init_verbs }, |
| 15137 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15138 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15139 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15140 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15141 | .input_mux = &alc861vd_capture_source, |
| 15142 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15143 | [ALC660VD_3ST_DIG] = { |
| 15144 | .mixers = { alc861vd_3st_mixer }, |
| 15145 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15146 | alc861vd_3stack_init_verbs }, |
| 15147 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15148 | .dac_nids = alc660vd_dac_nids, |
| 15149 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15150 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15151 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15152 | .input_mux = &alc861vd_capture_source, |
| 15153 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15154 | [ALC861VD_3ST] = { |
| 15155 | .mixers = { alc861vd_3st_mixer }, |
| 15156 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15157 | alc861vd_3stack_init_verbs }, |
| 15158 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15159 | .dac_nids = alc861vd_dac_nids, |
| 15160 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15161 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15162 | .input_mux = &alc861vd_capture_source, |
| 15163 | }, |
| 15164 | [ALC861VD_3ST_DIG] = { |
| 15165 | .mixers = { alc861vd_3st_mixer }, |
| 15166 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15167 | alc861vd_3stack_init_verbs }, |
| 15168 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15169 | .dac_nids = alc861vd_dac_nids, |
| 15170 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15171 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15172 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15173 | .input_mux = &alc861vd_capture_source, |
| 15174 | }, |
| 15175 | [ALC861VD_6ST_DIG] = { |
| 15176 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15177 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15178 | alc861vd_6stack_init_verbs }, |
| 15179 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15180 | .dac_nids = alc861vd_dac_nids, |
| 15181 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15182 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15183 | .channel_mode = alc861vd_6stack_modes, |
| 15184 | .input_mux = &alc861vd_capture_source, |
| 15185 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15186 | [ALC861VD_LENOVO] = { |
| 15187 | .mixers = { alc861vd_lenovo_mixer }, |
| 15188 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15189 | alc861vd_3stack_init_verbs, |
| 15190 | alc861vd_eapd_verbs, |
| 15191 | alc861vd_lenovo_unsol_verbs }, |
| 15192 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15193 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15194 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15195 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15196 | .input_mux = &alc861vd_capture_source, |
| 15197 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15198 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15199 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15200 | [ALC861VD_DALLAS] = { |
| 15201 | .mixers = { alc861vd_dallas_mixer }, |
| 15202 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15203 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15204 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15205 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15206 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15207 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15208 | .unsol_event = alc_automute_amp_unsol_event, |
| 15209 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15210 | }, |
| 15211 | [ALC861VD_HP] = { |
| 15212 | .mixers = { alc861vd_hp_mixer }, |
| 15213 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15214 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15215 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15216 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15217 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15218 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15219 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15220 | .unsol_event = alc_automute_amp_unsol_event, |
| 15221 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15222 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15223 | [ALC660VD_ASUS_V1S] = { |
| 15224 | .mixers = { alc861vd_lenovo_mixer }, |
| 15225 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15226 | alc861vd_3stack_init_verbs, |
| 15227 | alc861vd_eapd_verbs, |
| 15228 | alc861vd_lenovo_unsol_verbs }, |
| 15229 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15230 | .dac_nids = alc660vd_dac_nids, |
| 15231 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15232 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15233 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15234 | .input_mux = &alc861vd_capture_source, |
| 15235 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15236 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15237 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15238 | }; |
| 15239 | |
| 15240 | /* |
| 15241 | * BIOS auto configuration |
| 15242 | */ |
| 15243 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15244 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15245 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15246 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15247 | } |
| 15248 | |
| 15249 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15250 | { |
| 15251 | struct alc_spec *spec = codec->spec; |
| 15252 | int i; |
| 15253 | |
| 15254 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15255 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15256 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15257 | if (nid) |
| 15258 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15259 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15260 | } |
| 15261 | } |
| 15262 | |
| 15263 | |
| 15264 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15265 | { |
| 15266 | struct alc_spec *spec = codec->spec; |
| 15267 | hda_nid_t pin; |
| 15268 | |
| 15269 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15270 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15271 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15272 | pin = spec->autocfg.speaker_pins[0]; |
| 15273 | if (pin) |
| 15274 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15275 | } |
| 15276 | |
| 15277 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 15278 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15279 | |
| 15280 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15281 | { |
| 15282 | struct alc_spec *spec = codec->spec; |
| 15283 | int i; |
| 15284 | |
| 15285 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15286 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 15287 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15288 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15289 | if (nid != ALC861VD_PIN_CD_NID && |
| 15290 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15291 | snd_hda_codec_write(codec, nid, 0, |
| 15292 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15293 | AMP_OUT_MUTE); |
| 15294 | } |
| 15295 | } |
| 15296 | } |
| 15297 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15298 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15299 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15300 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15301 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15302 | |
| 15303 | /* add playback controls from the parsed DAC table */ |
| 15304 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15305 | * different NIDs for mute/unmute switch and volume control */ |
| 15306 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15307 | const struct auto_pin_cfg *cfg) |
| 15308 | { |
| 15309 | char name[32]; |
| 15310 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15311 | hda_nid_t nid_v, nid_s; |
| 15312 | int i, err; |
| 15313 | |
| 15314 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15315 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15316 | continue; |
| 15317 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15318 | alc880_dac_to_idx( |
| 15319 | spec->multiout.dac_nids[i])); |
| 15320 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15321 | alc880_dac_to_idx( |
| 15322 | spec->multiout.dac_nids[i])); |
| 15323 | |
| 15324 | if (i == 2) { |
| 15325 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15326 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15327 | "Center Playback Volume", |
| 15328 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15329 | HDA_OUTPUT)); |
| 15330 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15331 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15332 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15333 | "LFE Playback Volume", |
| 15334 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15335 | HDA_OUTPUT)); |
| 15336 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15337 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15338 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15339 | "Center Playback Switch", |
| 15340 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15341 | HDA_INPUT)); |
| 15342 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15343 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15344 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15345 | "LFE Playback Switch", |
| 15346 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15347 | HDA_INPUT)); |
| 15348 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15349 | return err; |
| 15350 | } else { |
| 15351 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15352 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15353 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15354 | HDA_OUTPUT)); |
| 15355 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15356 | return err; |
| 15357 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15358 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15359 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15360 | HDA_INPUT)); |
| 15361 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15362 | return err; |
| 15363 | } |
| 15364 | } |
| 15365 | return 0; |
| 15366 | } |
| 15367 | |
| 15368 | /* add playback controls for speaker and HP outputs */ |
| 15369 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15370 | * different NIDs for mute/unmute switch and volume control */ |
| 15371 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15372 | hda_nid_t pin, const char *pfx) |
| 15373 | { |
| 15374 | hda_nid_t nid_v, nid_s; |
| 15375 | int err; |
| 15376 | char name[32]; |
| 15377 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15378 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15379 | return 0; |
| 15380 | |
| 15381 | if (alc880_is_fixed_pin(pin)) { |
| 15382 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15383 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15384 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15385 | spec->multiout.hp_nid = nid_v; |
| 15386 | else |
| 15387 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15388 | /* control HP volume/switch on the output mixer amp */ |
| 15389 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15390 | alc880_fixed_pin_idx(pin)); |
| 15391 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15392 | alc880_fixed_pin_idx(pin)); |
| 15393 | |
| 15394 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15395 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15396 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15397 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15398 | return err; |
| 15399 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15400 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15401 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15402 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15403 | return err; |
| 15404 | } else if (alc880_is_multi_pin(pin)) { |
| 15405 | /* set manual connection */ |
| 15406 | /* we have only a switch on HP-out PIN */ |
| 15407 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15408 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15409 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15410 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15411 | return err; |
| 15412 | } |
| 15413 | return 0; |
| 15414 | } |
| 15415 | |
| 15416 | /* parse the BIOS configuration and set up the alc_spec |
| 15417 | * return 1 if successful, 0 if the proper config is not found, |
| 15418 | * or a negative error code |
| 15419 | * Based on ALC880 version - had to change it to override |
| 15420 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15421 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15422 | { |
| 15423 | struct alc_spec *spec = codec->spec; |
| 15424 | int err; |
| 15425 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15426 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15427 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15428 | alc861vd_ignore); |
| 15429 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15430 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15431 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15432 | return 0; /* can't find valid BIOS pin config */ |
| 15433 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15434 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15435 | if (err < 0) |
| 15436 | return err; |
| 15437 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15438 | if (err < 0) |
| 15439 | return err; |
| 15440 | err = alc861vd_auto_create_extra_out(spec, |
| 15441 | spec->autocfg.speaker_pins[0], |
| 15442 | "Speaker"); |
| 15443 | if (err < 0) |
| 15444 | return err; |
| 15445 | err = alc861vd_auto_create_extra_out(spec, |
| 15446 | spec->autocfg.hp_pins[0], |
| 15447 | "Headphone"); |
| 15448 | if (err < 0) |
| 15449 | return err; |
| 15450 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15451 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15452 | return err; |
| 15453 | |
| 15454 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15455 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15456 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15457 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15458 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15459 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15460 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15461 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15462 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15463 | |
| 15464 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15465 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15466 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15467 | err = alc_auto_add_mic_boost(codec); |
| 15468 | if (err < 0) |
| 15469 | return err; |
| 15470 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15471 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15472 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15473 | return 1; |
| 15474 | } |
| 15475 | |
| 15476 | /* additional initialization for auto-configuration model */ |
| 15477 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15478 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15479 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15480 | alc861vd_auto_init_multi_out(codec); |
| 15481 | alc861vd_auto_init_hp_out(codec); |
| 15482 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15483 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15484 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15485 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15486 | } |
| 15487 | |
| 15488 | static int patch_alc861vd(struct hda_codec *codec) |
| 15489 | { |
| 15490 | struct alc_spec *spec; |
| 15491 | int err, board_config; |
| 15492 | |
| 15493 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15494 | if (spec == NULL) |
| 15495 | return -ENOMEM; |
| 15496 | |
| 15497 | codec->spec = spec; |
| 15498 | |
| 15499 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15500 | alc861vd_models, |
| 15501 | alc861vd_cfg_tbl); |
| 15502 | |
| 15503 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 15504 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 15505 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15506 | board_config = ALC861VD_AUTO; |
| 15507 | } |
| 15508 | |
| 15509 | if (board_config == ALC861VD_AUTO) { |
| 15510 | /* automatic parse from the BIOS config */ |
| 15511 | err = alc861vd_parse_auto_config(codec); |
| 15512 | if (err < 0) { |
| 15513 | alc_free(codec); |
| 15514 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15515 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15516 | printk(KERN_INFO |
| 15517 | "hda_codec: Cannot set up configuration " |
| 15518 | "from BIOS. Using base mode...\n"); |
| 15519 | board_config = ALC861VD_3ST; |
| 15520 | } |
| 15521 | } |
| 15522 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15523 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15524 | if (err < 0) { |
| 15525 | alc_free(codec); |
| 15526 | return err; |
| 15527 | } |
| 15528 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15529 | if (board_config != ALC861VD_AUTO) |
| 15530 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15531 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15532 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15533 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15534 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15535 | } |
| 15536 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15537 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15538 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15539 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15540 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15541 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15542 | |
| 15543 | spec->adc_nids = alc861vd_adc_nids; |
| 15544 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15545 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15546 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15547 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15548 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15549 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15550 | spec->vmaster_nid = 0x02; |
| 15551 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15552 | codec->patch_ops = alc_patch_ops; |
| 15553 | |
| 15554 | if (board_config == ALC861VD_AUTO) |
| 15555 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15556 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15557 | if (!spec->loopback.amplist) |
| 15558 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15559 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15560 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15561 | |
| 15562 | return 0; |
| 15563 | } |
| 15564 | |
| 15565 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15566 | * ALC662 support |
| 15567 | * |
| 15568 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15569 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15570 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15571 | * 6-channel independent captures. |
| 15572 | * |
| 15573 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15574 | * driver yet). |
| 15575 | */ |
| 15576 | #define ALC662_DIGOUT_NID 0x06 |
| 15577 | #define ALC662_DIGIN_NID 0x0a |
| 15578 | |
| 15579 | static hda_nid_t alc662_dac_nids[4] = { |
| 15580 | /* front, rear, clfe, rear_surr */ |
| 15581 | 0x02, 0x03, 0x04 |
| 15582 | }; |
| 15583 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15584 | static hda_nid_t alc272_dac_nids[2] = { |
| 15585 | 0x02, 0x03 |
| 15586 | }; |
| 15587 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15588 | static hda_nid_t alc662_adc_nids[1] = { |
| 15589 | /* ADC1-2 */ |
| 15590 | 0x09, |
| 15591 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15592 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15593 | static hda_nid_t alc272_adc_nids[1] = { |
| 15594 | /* ADC1-2 */ |
| 15595 | 0x08, |
| 15596 | }; |
| 15597 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15598 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15599 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15600 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15601 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15602 | /* input MUX */ |
| 15603 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15604 | static struct hda_input_mux alc662_capture_source = { |
| 15605 | .num_items = 4, |
| 15606 | .items = { |
| 15607 | { "Mic", 0x0 }, |
| 15608 | { "Front Mic", 0x1 }, |
| 15609 | { "Line", 0x2 }, |
| 15610 | { "CD", 0x4 }, |
| 15611 | }, |
| 15612 | }; |
| 15613 | |
| 15614 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15615 | .num_items = 2, |
| 15616 | .items = { |
| 15617 | { "Mic", 0x1 }, |
| 15618 | { "Line", 0x2 }, |
| 15619 | }, |
| 15620 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15621 | |
| 15622 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15623 | .num_items = 2, |
| 15624 | .items = { |
| 15625 | { "i-Mic", 0x1 }, |
| 15626 | { "e-Mic", 0x0 }, |
| 15627 | }, |
| 15628 | }; |
| 15629 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15630 | static struct hda_input_mux alc663_capture_source = { |
| 15631 | .num_items = 3, |
| 15632 | .items = { |
| 15633 | { "Mic", 0x0 }, |
| 15634 | { "Front Mic", 0x1 }, |
| 15635 | { "Line", 0x2 }, |
| 15636 | }, |
| 15637 | }; |
| 15638 | |
| 15639 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15640 | .num_items = 2, |
| 15641 | .items = { |
| 15642 | { "Ext-Mic", 0x0 }, |
| 15643 | { "D-Mic", 0x9 }, |
| 15644 | }, |
| 15645 | }; |
| 15646 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15647 | #if 1 /* set to 0 for testing other input sources below */ |
| 15648 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15649 | .num_items = 2, |
| 15650 | .items = { |
| 15651 | { "Autoselect Mic", 0x0 }, |
| 15652 | { "Internal Mic", 0x1 }, |
| 15653 | }, |
| 15654 | }; |
| 15655 | #else |
| 15656 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15657 | .num_items = 16, |
| 15658 | .items = { |
| 15659 | { "Autoselect Mic", 0x0 }, |
| 15660 | { "Internal Mic", 0x1 }, |
| 15661 | { "In-0x02", 0x2 }, |
| 15662 | { "In-0x03", 0x3 }, |
| 15663 | { "In-0x04", 0x4 }, |
| 15664 | { "In-0x05", 0x5 }, |
| 15665 | { "In-0x06", 0x6 }, |
| 15666 | { "In-0x07", 0x7 }, |
| 15667 | { "In-0x08", 0x8 }, |
| 15668 | { "In-0x09", 0x9 }, |
| 15669 | { "In-0x0a", 0x0a }, |
| 15670 | { "In-0x0b", 0x0b }, |
| 15671 | { "In-0x0c", 0x0c }, |
| 15672 | { "In-0x0d", 0x0d }, |
| 15673 | { "In-0x0e", 0x0e }, |
| 15674 | { "In-0x0f", 0x0f }, |
| 15675 | }, |
| 15676 | }; |
| 15677 | #endif |
| 15678 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15679 | /* |
| 15680 | * 2ch mode |
| 15681 | */ |
| 15682 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15683 | { 2, NULL } |
| 15684 | }; |
| 15685 | |
| 15686 | /* |
| 15687 | * 2ch mode |
| 15688 | */ |
| 15689 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15690 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15691 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15692 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15693 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15694 | { } /* end */ |
| 15695 | }; |
| 15696 | |
| 15697 | /* |
| 15698 | * 6ch mode |
| 15699 | */ |
| 15700 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15701 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15702 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15703 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15704 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15705 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15706 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15707 | { } /* end */ |
| 15708 | }; |
| 15709 | |
| 15710 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15711 | { 2, alc662_3ST_ch2_init }, |
| 15712 | { 6, alc662_3ST_ch6_init }, |
| 15713 | }; |
| 15714 | |
| 15715 | /* |
| 15716 | * 2ch mode |
| 15717 | */ |
| 15718 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15719 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15720 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15721 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15722 | { } /* end */ |
| 15723 | }; |
| 15724 | |
| 15725 | /* |
| 15726 | * 6ch mode |
| 15727 | */ |
| 15728 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15729 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15730 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15731 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15732 | { } /* end */ |
| 15733 | }; |
| 15734 | |
| 15735 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15736 | { 2, alc662_sixstack_ch6_init }, |
| 15737 | { 6, alc662_sixstack_ch8_init }, |
| 15738 | }; |
| 15739 | |
| 15740 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15741 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15742 | */ |
| 15743 | |
| 15744 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15745 | /* output mixer control */ |
| 15746 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15747 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15748 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15749 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15750 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15751 | 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] | 15752 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15753 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15754 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15755 | |
| 15756 | /*Input mixer control */ |
| 15757 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15758 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15759 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15760 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15761 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15762 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15763 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15764 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15765 | { } /* end */ |
| 15766 | }; |
| 15767 | |
| 15768 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15769 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15770 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15771 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15772 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15773 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15774 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15775 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15776 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15777 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15778 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15779 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15780 | { } /* end */ |
| 15781 | }; |
| 15782 | |
| 15783 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15784 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15785 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15786 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15787 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15788 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15789 | 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] | 15790 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15791 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15792 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15793 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15794 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15795 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15796 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15797 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15798 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15799 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15800 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15801 | { } /* end */ |
| 15802 | }; |
| 15803 | |
| 15804 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15805 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15806 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15807 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15808 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15809 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15810 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15811 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15812 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15813 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15814 | { } /* end */ |
| 15815 | }; |
| 15816 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15817 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15818 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15819 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15820 | |
| 15821 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15822 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15823 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15824 | |
| 15825 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15826 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15827 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15828 | { } /* end */ |
| 15829 | }; |
| 15830 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15831 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15832 | ALC262_HIPPO_MASTER_SWITCH, |
| 15833 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15834 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15835 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15836 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15837 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15838 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15839 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15840 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15841 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15842 | { } /* end */ |
| 15843 | }; |
| 15844 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15845 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15846 | .ops = &snd_hda_bind_vol, |
| 15847 | .values = { |
| 15848 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15849 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15850 | 0 |
| 15851 | }, |
| 15852 | }; |
| 15853 | |
| 15854 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15855 | .ops = &snd_hda_bind_sw, |
| 15856 | .values = { |
| 15857 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15858 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15859 | 0 |
| 15860 | }, |
| 15861 | }; |
| 15862 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15863 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15864 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15865 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15866 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15867 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15868 | { } /* end */ |
| 15869 | }; |
| 15870 | |
| 15871 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15872 | .ops = &snd_hda_bind_sw, |
| 15873 | .values = { |
| 15874 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15875 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15876 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15877 | 0 |
| 15878 | }, |
| 15879 | }; |
| 15880 | |
| 15881 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15882 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15883 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15884 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15885 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15886 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15887 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15888 | |
| 15889 | { } /* end */ |
| 15890 | }; |
| 15891 | |
| 15892 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15893 | .ops = &snd_hda_bind_sw, |
| 15894 | .values = { |
| 15895 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15896 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15897 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15898 | 0 |
| 15899 | }, |
| 15900 | }; |
| 15901 | |
| 15902 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15903 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15904 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15905 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15906 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15907 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15908 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15909 | { } /* end */ |
| 15910 | }; |
| 15911 | |
| 15912 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15913 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15914 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15915 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15916 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15917 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15918 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15919 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15920 | { } /* end */ |
| 15921 | }; |
| 15922 | |
| 15923 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15924 | .ops = &snd_hda_bind_vol, |
| 15925 | .values = { |
| 15926 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15927 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15928 | 0 |
| 15929 | }, |
| 15930 | }; |
| 15931 | |
| 15932 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15933 | .ops = &snd_hda_bind_sw, |
| 15934 | .values = { |
| 15935 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15936 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15937 | 0 |
| 15938 | }, |
| 15939 | }; |
| 15940 | |
| 15941 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15942 | HDA_BIND_VOL("Master Playback Volume", |
| 15943 | &alc663_asus_two_bind_master_vol), |
| 15944 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15945 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15946 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15947 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15948 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15949 | { } /* end */ |
| 15950 | }; |
| 15951 | |
| 15952 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15953 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15954 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15955 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15956 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15957 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15958 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15959 | { } /* end */ |
| 15960 | }; |
| 15961 | |
| 15962 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15963 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15964 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15965 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15966 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15967 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15968 | |
| 15969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15971 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15972 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15973 | { } /* end */ |
| 15974 | }; |
| 15975 | |
| 15976 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15977 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15978 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15979 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15980 | |
| 15981 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15982 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15983 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15984 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15985 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15986 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15987 | { } /* end */ |
| 15988 | }; |
| 15989 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15990 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15991 | { |
| 15992 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15993 | .name = "Channel Mode", |
| 15994 | .info = alc_ch_mode_info, |
| 15995 | .get = alc_ch_mode_get, |
| 15996 | .put = alc_ch_mode_put, |
| 15997 | }, |
| 15998 | { } /* end */ |
| 15999 | }; |
| 16000 | |
| 16001 | static struct hda_verb alc662_init_verbs[] = { |
| 16002 | /* ADC: mute amp left and right */ |
| 16003 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16004 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16005 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 16006 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16007 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16008 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16009 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16010 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16011 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16012 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16013 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16014 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16015 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16016 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16017 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16018 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16019 | |
| 16020 | /* Front Pin: output 0 (0x0c) */ |
| 16021 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16022 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16023 | |
| 16024 | /* Rear Pin: output 1 (0x0d) */ |
| 16025 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16026 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16027 | |
| 16028 | /* CLFE Pin: output 2 (0x0e) */ |
| 16029 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16030 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16031 | |
| 16032 | /* Mic (rear) pin: input vref at 80% */ |
| 16033 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16034 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16035 | /* Front Mic pin: input vref at 80% */ |
| 16036 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16037 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16038 | /* Line In pin: input */ |
| 16039 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16040 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16041 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16042 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16043 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16044 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16045 | /* CD pin widget for input */ |
| 16046 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16047 | |
| 16048 | /* FIXME: use matrix-type input source selection */ |
| 16049 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16050 | /* Input mixer */ |
| 16051 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16052 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16053 | |
| 16054 | /* always trun on EAPD */ |
| 16055 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16056 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16057 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16058 | { } |
| 16059 | }; |
| 16060 | |
| 16061 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 16062 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16063 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16064 | {} |
| 16065 | }; |
| 16066 | |
| 16067 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 16068 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16069 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16070 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16071 | }; |
| 16072 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16073 | /* Set Unsolicited Event*/ |
| 16074 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 16075 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16076 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16077 | {} |
| 16078 | }; |
| 16079 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16080 | /* |
| 16081 | * generic initialization of ADC, input mixers and output mixers |
| 16082 | */ |
| 16083 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 16084 | /* |
| 16085 | * Unmute ADC and set the default input to mic-in |
| 16086 | */ |
| 16087 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16088 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16089 | |
| 16090 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 16091 | * mixer widget |
| 16092 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 16093 | * panel mic (mic 2) |
| 16094 | */ |
| 16095 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16096 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16101 | |
| 16102 | /* |
| 16103 | * Set up output mixers (0x0c - 0x0f) |
| 16104 | */ |
| 16105 | /* set vol=0 to output mixers */ |
| 16106 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16107 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16108 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16109 | |
| 16110 | /* set up input amps for analog loopback */ |
| 16111 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16112 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16113 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16114 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16115 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16116 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16117 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16118 | |
| 16119 | |
| 16120 | /* FIXME: use matrix-type input source selection */ |
| 16121 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16122 | /* Input mixer */ |
| 16123 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16124 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16125 | { } |
| 16126 | }; |
| 16127 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16128 | /* additional verbs for ALC663 */ |
| 16129 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16130 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16131 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16132 | { } |
| 16133 | }; |
| 16134 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16135 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16136 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16137 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16138 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16139 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16140 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16141 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16142 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16143 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16144 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16145 | {} |
| 16146 | }; |
| 16147 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16148 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16149 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16150 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16151 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16152 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16153 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16154 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16155 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16156 | {} |
| 16157 | }; |
| 16158 | |
| 16159 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16160 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16161 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16162 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16163 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16164 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16165 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16166 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16167 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16168 | {} |
| 16169 | }; |
| 16170 | |
| 16171 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16172 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16173 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16174 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16175 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16176 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16177 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16178 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16179 | {} |
| 16180 | }; |
| 16181 | |
| 16182 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16183 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16184 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16185 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16186 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16187 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16188 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16189 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16190 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16191 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16192 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16193 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_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_m2_init_verbs[] = { |
| 16199 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16200 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16201 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16202 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* 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, 0x01}, /* 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 | {0x1b, 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 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16214 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16215 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16216 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16217 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16218 | |
| 16219 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16220 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16221 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16222 | |
| 16223 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16224 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16225 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16226 | {} |
| 16227 | }; |
| 16228 | |
| 16229 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16230 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16231 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16232 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16233 | |
| 16234 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16235 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16236 | {} |
| 16237 | }; |
| 16238 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16239 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16240 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16241 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16242 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16243 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16244 | {} |
| 16245 | }; |
| 16246 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16247 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16248 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16249 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16250 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16251 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16252 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16253 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16254 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16255 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16256 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16257 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16258 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16259 | {} |
| 16260 | }; |
| 16261 | |
| 16262 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16263 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16264 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16265 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16266 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16267 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16268 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16269 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16270 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16271 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16272 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16273 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16274 | {} |
| 16275 | }; |
| 16276 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16277 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16278 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16279 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16280 | { } /* end */ |
| 16281 | }; |
| 16282 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16283 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16284 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16285 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16286 | { } /* end */ |
| 16287 | }; |
| 16288 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16289 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16290 | { |
| 16291 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16292 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16293 | |
| 16294 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16295 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16296 | bits = present ? HDA_AMP_MUTE : 0; |
| 16297 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16298 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16299 | } |
| 16300 | |
| 16301 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16302 | { |
| 16303 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16304 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16305 | |
| 16306 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16307 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16308 | bits = present ? HDA_AMP_MUTE : 0; |
| 16309 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16310 | HDA_AMP_MUTE, bits); |
| 16311 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16312 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16313 | } |
| 16314 | |
| 16315 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16316 | unsigned int res) |
| 16317 | { |
| 16318 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16319 | alc662_lenovo_101e_all_automute(codec); |
| 16320 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16321 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16322 | } |
| 16323 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16324 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 16325 | { |
| 16326 | unsigned int present; |
| 16327 | |
| 16328 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 16329 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 16330 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16331 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16332 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16333 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16334 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16335 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16336 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16337 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16338 | } |
| 16339 | |
| 16340 | /* unsolicited event for HP jack sensing */ |
| 16341 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16342 | unsigned int res) |
| 16343 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16344 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 16345 | alc662_eeepc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16346 | else |
| 16347 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16348 | } |
| 16349 | |
| 16350 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16351 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16352 | alc262_hippo1_init_hook(codec); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16353 | alc662_eeepc_mic_automute(codec); |
| 16354 | } |
| 16355 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16356 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 16357 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16358 | struct alc_spec *spec = codec->spec; |
| 16359 | |
| 16360 | spec->autocfg.hp_pins[0] = 0x14; |
| 16361 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 16362 | alc262_hippo_master_update(codec); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16363 | } |
| 16364 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16365 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16366 | { |
| 16367 | unsigned int present; |
| 16368 | unsigned char bits; |
| 16369 | |
| 16370 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16371 | AC_VERB_GET_PIN_SENSE, 0) |
| 16372 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16373 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16374 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16375 | AMP_IN_MUTE(0), bits); |
| 16376 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16377 | AMP_IN_MUTE(0), bits); |
| 16378 | } |
| 16379 | |
| 16380 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16381 | { |
| 16382 | unsigned int present; |
| 16383 | unsigned char bits; |
| 16384 | |
| 16385 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16386 | AC_VERB_GET_PIN_SENSE, 0) |
| 16387 | & AC_PINSENSE_PRESENCE; |
| 16388 | bits = present ? HDA_AMP_MUTE : 0; |
| 16389 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16390 | AMP_IN_MUTE(0), bits); |
| 16391 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16392 | AMP_IN_MUTE(0), bits); |
| 16393 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16394 | AMP_IN_MUTE(0), bits); |
| 16395 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16396 | AMP_IN_MUTE(0), bits); |
| 16397 | } |
| 16398 | |
| 16399 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16400 | { |
| 16401 | unsigned int present; |
| 16402 | unsigned char bits; |
| 16403 | |
| 16404 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16405 | AC_VERB_GET_PIN_SENSE, 0) |
| 16406 | & AC_PINSENSE_PRESENCE; |
| 16407 | bits = present ? HDA_AMP_MUTE : 0; |
| 16408 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16409 | AMP_IN_MUTE(0), bits); |
| 16410 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16411 | AMP_IN_MUTE(0), bits); |
| 16412 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16413 | AMP_IN_MUTE(0), bits); |
| 16414 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16415 | AMP_IN_MUTE(0), bits); |
| 16416 | } |
| 16417 | |
| 16418 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16419 | { |
| 16420 | unsigned int present; |
| 16421 | unsigned char bits; |
| 16422 | |
| 16423 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16424 | AC_VERB_GET_PIN_SENSE, 0) |
| 16425 | & AC_PINSENSE_PRESENCE; |
| 16426 | bits = present ? 0 : PIN_OUT; |
| 16427 | snd_hda_codec_write(codec, 0x14, 0, |
| 16428 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16429 | } |
| 16430 | |
| 16431 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16432 | { |
| 16433 | unsigned int present1, present2; |
| 16434 | |
| 16435 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16436 | AC_VERB_GET_PIN_SENSE, 0) |
| 16437 | & AC_PINSENSE_PRESENCE; |
| 16438 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16439 | AC_VERB_GET_PIN_SENSE, 0) |
| 16440 | & AC_PINSENSE_PRESENCE; |
| 16441 | |
| 16442 | if (present1 || present2) { |
| 16443 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16444 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16445 | } else { |
| 16446 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16447 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16448 | } |
| 16449 | } |
| 16450 | |
| 16451 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16452 | { |
| 16453 | unsigned int present1, present2; |
| 16454 | |
| 16455 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16456 | AC_VERB_GET_PIN_SENSE, 0) |
| 16457 | & AC_PINSENSE_PRESENCE; |
| 16458 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16459 | AC_VERB_GET_PIN_SENSE, 0) |
| 16460 | & AC_PINSENSE_PRESENCE; |
| 16461 | |
| 16462 | if (present1 || present2) { |
| 16463 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16464 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16465 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16466 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16467 | } else { |
| 16468 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16469 | AMP_IN_MUTE(0), 0); |
| 16470 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16471 | AMP_IN_MUTE(0), 0); |
| 16472 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16473 | } |
| 16474 | |
| 16475 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16476 | { |
| 16477 | unsigned int present; |
| 16478 | |
| 16479 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16480 | AC_VERB_GET_PIN_SENSE, 0) |
| 16481 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16482 | 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] | 16483 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16484 | 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] | 16485 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16486 | 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] | 16487 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16488 | 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] | 16489 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16490 | } |
| 16491 | |
| 16492 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16493 | unsigned int res) |
| 16494 | { |
| 16495 | switch (res >> 26) { |
| 16496 | case ALC880_HP_EVENT: |
| 16497 | alc663_m51va_speaker_automute(codec); |
| 16498 | break; |
| 16499 | case ALC880_MIC_EVENT: |
| 16500 | alc663_m51va_mic_automute(codec); |
| 16501 | break; |
| 16502 | } |
| 16503 | } |
| 16504 | |
| 16505 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16506 | { |
| 16507 | alc663_m51va_speaker_automute(codec); |
| 16508 | alc663_m51va_mic_automute(codec); |
| 16509 | } |
| 16510 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16511 | /* ***************** Mode1 ******************************/ |
| 16512 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16513 | unsigned int res) |
| 16514 | { |
| 16515 | switch (res >> 26) { |
| 16516 | case ALC880_HP_EVENT: |
| 16517 | alc663_m51va_speaker_automute(codec); |
| 16518 | break; |
| 16519 | case ALC880_MIC_EVENT: |
| 16520 | alc662_eeepc_mic_automute(codec); |
| 16521 | break; |
| 16522 | } |
| 16523 | } |
| 16524 | |
| 16525 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16526 | { |
| 16527 | alc663_m51va_speaker_automute(codec); |
| 16528 | alc662_eeepc_mic_automute(codec); |
| 16529 | } |
| 16530 | /* ***************** Mode2 ******************************/ |
| 16531 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16532 | unsigned int res) |
| 16533 | { |
| 16534 | switch (res >> 26) { |
| 16535 | case ALC880_HP_EVENT: |
| 16536 | alc662_f5z_speaker_automute(codec); |
| 16537 | break; |
| 16538 | case ALC880_MIC_EVENT: |
| 16539 | alc662_eeepc_mic_automute(codec); |
| 16540 | break; |
| 16541 | } |
| 16542 | } |
| 16543 | |
| 16544 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16545 | { |
| 16546 | alc662_f5z_speaker_automute(codec); |
| 16547 | alc662_eeepc_mic_automute(codec); |
| 16548 | } |
| 16549 | /* ***************** Mode3 ******************************/ |
| 16550 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16551 | unsigned int res) |
| 16552 | { |
| 16553 | switch (res >> 26) { |
| 16554 | case ALC880_HP_EVENT: |
| 16555 | alc663_two_hp_m1_speaker_automute(codec); |
| 16556 | break; |
| 16557 | case ALC880_MIC_EVENT: |
| 16558 | alc662_eeepc_mic_automute(codec); |
| 16559 | break; |
| 16560 | } |
| 16561 | } |
| 16562 | |
| 16563 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16564 | { |
| 16565 | alc663_two_hp_m1_speaker_automute(codec); |
| 16566 | alc662_eeepc_mic_automute(codec); |
| 16567 | } |
| 16568 | /* ***************** Mode4 ******************************/ |
| 16569 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16570 | unsigned int res) |
| 16571 | { |
| 16572 | switch (res >> 26) { |
| 16573 | case ALC880_HP_EVENT: |
| 16574 | alc663_21jd_two_speaker_automute(codec); |
| 16575 | break; |
| 16576 | case ALC880_MIC_EVENT: |
| 16577 | alc662_eeepc_mic_automute(codec); |
| 16578 | break; |
| 16579 | } |
| 16580 | } |
| 16581 | |
| 16582 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16583 | { |
| 16584 | alc663_21jd_two_speaker_automute(codec); |
| 16585 | alc662_eeepc_mic_automute(codec); |
| 16586 | } |
| 16587 | /* ***************** Mode5 ******************************/ |
| 16588 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16589 | unsigned int res) |
| 16590 | { |
| 16591 | switch (res >> 26) { |
| 16592 | case ALC880_HP_EVENT: |
| 16593 | alc663_15jd_two_speaker_automute(codec); |
| 16594 | break; |
| 16595 | case ALC880_MIC_EVENT: |
| 16596 | alc662_eeepc_mic_automute(codec); |
| 16597 | break; |
| 16598 | } |
| 16599 | } |
| 16600 | |
| 16601 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16602 | { |
| 16603 | alc663_15jd_two_speaker_automute(codec); |
| 16604 | alc662_eeepc_mic_automute(codec); |
| 16605 | } |
| 16606 | /* ***************** Mode6 ******************************/ |
| 16607 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16608 | unsigned int res) |
| 16609 | { |
| 16610 | switch (res >> 26) { |
| 16611 | case ALC880_HP_EVENT: |
| 16612 | alc663_two_hp_m2_speaker_automute(codec); |
| 16613 | break; |
| 16614 | case ALC880_MIC_EVENT: |
| 16615 | alc662_eeepc_mic_automute(codec); |
| 16616 | break; |
| 16617 | } |
| 16618 | } |
| 16619 | |
| 16620 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16621 | { |
| 16622 | alc663_two_hp_m2_speaker_automute(codec); |
| 16623 | alc662_eeepc_mic_automute(codec); |
| 16624 | } |
| 16625 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16626 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16627 | { |
| 16628 | unsigned int present; |
| 16629 | unsigned char bits; |
| 16630 | |
| 16631 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16632 | AC_VERB_GET_PIN_SENSE, 0) |
| 16633 | & AC_PINSENSE_PRESENCE; |
| 16634 | bits = present ? HDA_AMP_MUTE : 0; |
| 16635 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16636 | HDA_AMP_MUTE, bits); |
| 16637 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16638 | HDA_AMP_MUTE, bits); |
| 16639 | } |
| 16640 | |
| 16641 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16642 | { |
| 16643 | unsigned int present; |
| 16644 | unsigned char bits; |
| 16645 | |
| 16646 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16647 | AC_VERB_GET_PIN_SENSE, 0) |
| 16648 | & AC_PINSENSE_PRESENCE; |
| 16649 | bits = present ? HDA_AMP_MUTE : 0; |
| 16650 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16651 | HDA_AMP_MUTE, bits); |
| 16652 | } |
| 16653 | |
| 16654 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16655 | unsigned int res) |
| 16656 | { |
| 16657 | switch (res >> 26) { |
| 16658 | case ALC880_HP_EVENT: |
| 16659 | alc663_g71v_hp_automute(codec); |
| 16660 | break; |
| 16661 | case ALC880_FRONT_EVENT: |
| 16662 | alc663_g71v_front_automute(codec); |
| 16663 | break; |
| 16664 | case ALC880_MIC_EVENT: |
| 16665 | alc662_eeepc_mic_automute(codec); |
| 16666 | break; |
| 16667 | } |
| 16668 | } |
| 16669 | |
| 16670 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16671 | { |
| 16672 | alc663_g71v_front_automute(codec); |
| 16673 | alc663_g71v_hp_automute(codec); |
| 16674 | alc662_eeepc_mic_automute(codec); |
| 16675 | } |
| 16676 | |
| 16677 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16678 | unsigned int res) |
| 16679 | { |
| 16680 | switch (res >> 26) { |
| 16681 | case ALC880_HP_EVENT: |
| 16682 | alc663_m51va_speaker_automute(codec); |
| 16683 | break; |
| 16684 | case ALC880_MIC_EVENT: |
| 16685 | alc662_eeepc_mic_automute(codec); |
| 16686 | break; |
| 16687 | } |
| 16688 | } |
| 16689 | |
| 16690 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16691 | { |
| 16692 | alc663_m51va_speaker_automute(codec); |
| 16693 | alc662_eeepc_mic_automute(codec); |
| 16694 | } |
| 16695 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16696 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16697 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16698 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16699 | |
| 16700 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16701 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16702 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16703 | |
| 16704 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16705 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16706 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16707 | { } /* end */ |
| 16708 | }; |
| 16709 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16710 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16711 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16712 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16713 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16714 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16715 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16716 | |
| 16717 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16718 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16719 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16720 | |
| 16721 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16722 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16723 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16724 | { } /* end */ |
| 16725 | }; |
| 16726 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16727 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16728 | #define alc662_loopbacks alc880_loopbacks |
| 16729 | #endif |
| 16730 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16731 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16732 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16733 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16734 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16735 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16736 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16737 | |
| 16738 | /* |
| 16739 | * configuration and preset |
| 16740 | */ |
| 16741 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16742 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16743 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16744 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16745 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16746 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16747 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16748 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16749 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16750 | [ALC663_ASUS_M51VA] = "m51va", |
| 16751 | [ALC663_ASUS_G71V] = "g71v", |
| 16752 | [ALC663_ASUS_H13] = "h13", |
| 16753 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16754 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16755 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16756 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16757 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16758 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16759 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16760 | [ALC272_DELL] = "dell", |
| 16761 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16762 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16763 | [ALC662_AUTO] = "auto", |
| 16764 | }; |
| 16765 | |
| 16766 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16767 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16768 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16769 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16770 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16771 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16772 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16773 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16774 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16775 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16776 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16777 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16778 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16779 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16780 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16781 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16782 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16783 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16784 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16785 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16786 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16787 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16788 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16789 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16790 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16791 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16792 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16793 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16794 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16795 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16796 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16797 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16798 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16799 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16800 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16801 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16802 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16803 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16804 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16805 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16806 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16807 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16808 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16809 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16810 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16811 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16812 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16813 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16814 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16815 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16816 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16817 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16818 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16819 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16820 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16821 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16822 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16823 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16824 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16825 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16826 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16827 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16828 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16829 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16830 | {} |
| 16831 | }; |
| 16832 | |
| 16833 | static struct alc_config_preset alc662_presets[] = { |
| 16834 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16835 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16836 | .init_verbs = { alc662_init_verbs }, |
| 16837 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16838 | .dac_nids = alc662_dac_nids, |
| 16839 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16840 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16841 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16842 | .channel_mode = alc662_3ST_2ch_modes, |
| 16843 | .input_mux = &alc662_capture_source, |
| 16844 | }, |
| 16845 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16846 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16847 | .init_verbs = { alc662_init_verbs }, |
| 16848 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16849 | .dac_nids = alc662_dac_nids, |
| 16850 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16851 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16852 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16853 | .channel_mode = alc662_3ST_6ch_modes, |
| 16854 | .need_dac_fix = 1, |
| 16855 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16856 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16857 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16858 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16859 | .init_verbs = { alc662_init_verbs }, |
| 16860 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16861 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16862 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16863 | .channel_mode = alc662_3ST_6ch_modes, |
| 16864 | .need_dac_fix = 1, |
| 16865 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16866 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16867 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16868 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16869 | .init_verbs = { alc662_init_verbs }, |
| 16870 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16871 | .dac_nids = alc662_dac_nids, |
| 16872 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16873 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16874 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16875 | .channel_mode = alc662_5stack_modes, |
| 16876 | .input_mux = &alc662_capture_source, |
| 16877 | }, |
| 16878 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16879 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16880 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16881 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16882 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16883 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16884 | .channel_mode = alc662_3ST_2ch_modes, |
| 16885 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16886 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16887 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16888 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16889 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16890 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16891 | .init_verbs = { alc662_init_verbs, |
| 16892 | alc662_eeepc_sue_init_verbs }, |
| 16893 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16894 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16895 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16896 | .channel_mode = alc662_3ST_2ch_modes, |
| 16897 | .input_mux = &alc662_eeepc_capture_source, |
| 16898 | .unsol_event = alc662_eeepc_unsol_event, |
| 16899 | .init_hook = alc662_eeepc_inithook, |
| 16900 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16901 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16902 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16903 | alc662_chmode_mixer }, |
| 16904 | .init_verbs = { alc662_init_verbs, |
| 16905 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16906 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16907 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16908 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16909 | .channel_mode = alc662_3ST_6ch_modes, |
| 16910 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16911 | .unsol_event = alc662_eeepc_unsol_event, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16912 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16913 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16914 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16915 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16916 | .init_verbs = { alc662_init_verbs, |
| 16917 | alc662_ecs_init_verbs }, |
| 16918 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16919 | .dac_nids = alc662_dac_nids, |
| 16920 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16921 | .channel_mode = alc662_3ST_2ch_modes, |
| 16922 | .input_mux = &alc662_eeepc_capture_source, |
| 16923 | .unsol_event = alc662_eeepc_unsol_event, |
| 16924 | .init_hook = alc662_eeepc_inithook, |
| 16925 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16926 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16927 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16928 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16929 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16930 | .dac_nids = alc662_dac_nids, |
| 16931 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16932 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16933 | .channel_mode = alc662_3ST_2ch_modes, |
| 16934 | .input_mux = &alc663_m51va_capture_source, |
| 16935 | .unsol_event = alc663_m51va_unsol_event, |
| 16936 | .init_hook = alc663_m51va_inithook, |
| 16937 | }, |
| 16938 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16939 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16940 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16941 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16942 | .dac_nids = alc662_dac_nids, |
| 16943 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16944 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16945 | .channel_mode = alc662_3ST_2ch_modes, |
| 16946 | .input_mux = &alc662_eeepc_capture_source, |
| 16947 | .unsol_event = alc663_g71v_unsol_event, |
| 16948 | .init_hook = alc663_g71v_inithook, |
| 16949 | }, |
| 16950 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16951 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16952 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16953 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16954 | .dac_nids = alc662_dac_nids, |
| 16955 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16956 | .channel_mode = alc662_3ST_2ch_modes, |
| 16957 | .input_mux = &alc663_m51va_capture_source, |
| 16958 | .unsol_event = alc663_m51va_unsol_event, |
| 16959 | .init_hook = alc663_m51va_inithook, |
| 16960 | }, |
| 16961 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16962 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16963 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16964 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16965 | .dac_nids = alc662_dac_nids, |
| 16966 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16967 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16968 | .channel_mode = alc662_3ST_6ch_modes, |
| 16969 | .input_mux = &alc663_capture_source, |
| 16970 | .unsol_event = alc663_g50v_unsol_event, |
| 16971 | .init_hook = alc663_g50v_inithook, |
| 16972 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16973 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16974 | .mixers = { alc663_m51va_mixer }, |
| 16975 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16976 | .init_verbs = { alc662_init_verbs, |
| 16977 | alc663_21jd_amic_init_verbs }, |
| 16978 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16979 | .hp_nid = 0x03, |
| 16980 | .dac_nids = alc662_dac_nids, |
| 16981 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16982 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16983 | .channel_mode = alc662_3ST_2ch_modes, |
| 16984 | .input_mux = &alc662_eeepc_capture_source, |
| 16985 | .unsol_event = alc663_mode1_unsol_event, |
| 16986 | .init_hook = alc663_mode1_inithook, |
| 16987 | }, |
| 16988 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16989 | .mixers = { alc662_1bjd_mixer }, |
| 16990 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16991 | .init_verbs = { alc662_init_verbs, |
| 16992 | alc662_1bjd_amic_init_verbs }, |
| 16993 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16994 | .dac_nids = alc662_dac_nids, |
| 16995 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16996 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16997 | .channel_mode = alc662_3ST_2ch_modes, |
| 16998 | .input_mux = &alc662_eeepc_capture_source, |
| 16999 | .unsol_event = alc662_mode2_unsol_event, |
| 17000 | .init_hook = alc662_mode2_inithook, |
| 17001 | }, |
| 17002 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17003 | .mixers = { alc663_two_hp_m1_mixer }, |
| 17004 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17005 | .init_verbs = { alc662_init_verbs, |
| 17006 | alc663_two_hp_amic_m1_init_verbs }, |
| 17007 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17008 | .hp_nid = 0x03, |
| 17009 | .dac_nids = alc662_dac_nids, |
| 17010 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17011 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17012 | .channel_mode = alc662_3ST_2ch_modes, |
| 17013 | .input_mux = &alc662_eeepc_capture_source, |
| 17014 | .unsol_event = alc663_mode3_unsol_event, |
| 17015 | .init_hook = alc663_mode3_inithook, |
| 17016 | }, |
| 17017 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17018 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 17019 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17020 | .init_verbs = { alc662_init_verbs, |
| 17021 | alc663_21jd_amic_init_verbs}, |
| 17022 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17023 | .hp_nid = 0x03, |
| 17024 | .dac_nids = alc662_dac_nids, |
| 17025 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17026 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17027 | .channel_mode = alc662_3ST_2ch_modes, |
| 17028 | .input_mux = &alc662_eeepc_capture_source, |
| 17029 | .unsol_event = alc663_mode4_unsol_event, |
| 17030 | .init_hook = alc663_mode4_inithook, |
| 17031 | }, |
| 17032 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17033 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 17034 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17035 | .init_verbs = { alc662_init_verbs, |
| 17036 | alc663_15jd_amic_init_verbs }, |
| 17037 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17038 | .hp_nid = 0x03, |
| 17039 | .dac_nids = alc662_dac_nids, |
| 17040 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17041 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17042 | .channel_mode = alc662_3ST_2ch_modes, |
| 17043 | .input_mux = &alc662_eeepc_capture_source, |
| 17044 | .unsol_event = alc663_mode5_unsol_event, |
| 17045 | .init_hook = alc663_mode5_inithook, |
| 17046 | }, |
| 17047 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17048 | .mixers = { alc663_two_hp_m2_mixer }, |
| 17049 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17050 | .init_verbs = { alc662_init_verbs, |
| 17051 | alc663_two_hp_amic_m2_init_verbs }, |
| 17052 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17053 | .hp_nid = 0x03, |
| 17054 | .dac_nids = alc662_dac_nids, |
| 17055 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17056 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17057 | .channel_mode = alc662_3ST_2ch_modes, |
| 17058 | .input_mux = &alc662_eeepc_capture_source, |
| 17059 | .unsol_event = alc663_mode6_unsol_event, |
| 17060 | .init_hook = alc663_mode6_inithook, |
| 17061 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17062 | [ALC272_DELL] = { |
| 17063 | .mixers = { alc663_m51va_mixer }, |
| 17064 | .cap_mixer = alc272_auto_capture_mixer, |
| 17065 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 17066 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17067 | .dac_nids = alc662_dac_nids, |
| 17068 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17069 | .adc_nids = alc272_adc_nids, |
| 17070 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 17071 | .capsrc_nids = alc272_capsrc_nids, |
| 17072 | .channel_mode = alc662_3ST_2ch_modes, |
| 17073 | .input_mux = &alc663_m51va_capture_source, |
| 17074 | .unsol_event = alc663_m51va_unsol_event, |
| 17075 | .init_hook = alc663_m51va_inithook, |
| 17076 | }, |
| 17077 | [ALC272_DELL_ZM1] = { |
| 17078 | .mixers = { alc663_m51va_mixer }, |
| 17079 | .cap_mixer = alc662_auto_capture_mixer, |
| 17080 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 17081 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17082 | .dac_nids = alc662_dac_nids, |
| 17083 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17084 | .adc_nids = alc662_adc_nids, |
| 17085 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 17086 | .capsrc_nids = alc662_capsrc_nids, |
| 17087 | .channel_mode = alc662_3ST_2ch_modes, |
| 17088 | .input_mux = &alc663_m51va_capture_source, |
| 17089 | .unsol_event = alc663_m51va_unsol_event, |
| 17090 | .init_hook = alc663_m51va_inithook, |
| 17091 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17092 | [ALC272_SAMSUNG_NC10] = { |
| 17093 | .mixers = { alc272_nc10_mixer }, |
| 17094 | .init_verbs = { alc662_init_verbs, |
| 17095 | alc663_21jd_amic_init_verbs }, |
| 17096 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17097 | .dac_nids = alc272_dac_nids, |
| 17098 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17099 | .channel_mode = alc662_3ST_2ch_modes, |
| 17100 | .input_mux = &alc272_nc10_capture_source, |
| 17101 | .unsol_event = alc663_mode4_unsol_event, |
| 17102 | .init_hook = alc663_mode4_inithook, |
| 17103 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17104 | }; |
| 17105 | |
| 17106 | |
| 17107 | /* |
| 17108 | * BIOS auto configuration |
| 17109 | */ |
| 17110 | |
| 17111 | /* add playback controls from the parsed DAC table */ |
| 17112 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17113 | const struct auto_pin_cfg *cfg) |
| 17114 | { |
| 17115 | char name[32]; |
| 17116 | static const char *chname[4] = { |
| 17117 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17118 | }; |
| 17119 | hda_nid_t nid; |
| 17120 | int i, err; |
| 17121 | |
| 17122 | for (i = 0; i < cfg->line_outs; i++) { |
| 17123 | if (!spec->multiout.dac_nids[i]) |
| 17124 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17125 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17126 | if (i == 2) { |
| 17127 | /* Center/LFE */ |
| 17128 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17129 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17130 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 17131 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17132 | if (err < 0) |
| 17133 | return err; |
| 17134 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17135 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17136 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 17137 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17138 | if (err < 0) |
| 17139 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17140 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17141 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17142 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17143 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17144 | if (err < 0) |
| 17145 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17146 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17147 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17148 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17149 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17150 | if (err < 0) |
| 17151 | return err; |
| 17152 | } else { |
| 17153 | sprintf(name, "%s Playback Volume", chname[i]); |
| 17154 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17155 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 17156 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17157 | if (err < 0) |
| 17158 | return err; |
| 17159 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17160 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17161 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 17162 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17163 | if (err < 0) |
| 17164 | return err; |
| 17165 | } |
| 17166 | } |
| 17167 | return 0; |
| 17168 | } |
| 17169 | |
| 17170 | /* add playback controls for speaker and HP outputs */ |
| 17171 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 17172 | const char *pfx) |
| 17173 | { |
| 17174 | hda_nid_t nid; |
| 17175 | int err; |
| 17176 | char name[32]; |
| 17177 | |
| 17178 | if (!pin) |
| 17179 | return 0; |
| 17180 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17181 | if (pin == 0x17) { |
| 17182 | /* ALC663 has a mono output pin on 0x17 */ |
| 17183 | sprintf(name, "%s Playback Switch", pfx); |
| 17184 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17185 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 17186 | return err; |
| 17187 | } |
| 17188 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17189 | if (alc880_is_fixed_pin(pin)) { |
| 17190 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 17191 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17192 | /* specify the DAC as the extra output */ |
| 17193 | if (!spec->multiout.hp_nid) |
| 17194 | spec->multiout.hp_nid = nid; |
| 17195 | else |
| 17196 | spec->multiout.extra_out_nid[0] = nid; |
| 17197 | /* control HP volume/switch on the output mixer amp */ |
| 17198 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17199 | sprintf(name, "%s Playback Volume", pfx); |
| 17200 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 17201 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 17202 | if (err < 0) |
| 17203 | return err; |
| 17204 | sprintf(name, "%s Playback Switch", pfx); |
| 17205 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 17206 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 17207 | if (err < 0) |
| 17208 | return err; |
| 17209 | } else if (alc880_is_multi_pin(pin)) { |
| 17210 | /* set manual connection */ |
| 17211 | /* we have only a switch on HP-out PIN */ |
| 17212 | sprintf(name, "%s Playback Switch", pfx); |
| 17213 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17214 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17215 | if (err < 0) |
| 17216 | return err; |
| 17217 | } |
| 17218 | return 0; |
| 17219 | } |
| 17220 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17221 | /* return the index of the src widget from the connection list of the nid. |
| 17222 | * return -1 if not found |
| 17223 | */ |
| 17224 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 17225 | hda_nid_t src) |
| 17226 | { |
| 17227 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 17228 | int i, conns; |
| 17229 | |
| 17230 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 17231 | ARRAY_SIZE(conn_list)); |
| 17232 | if (conns < 0) |
| 17233 | return -1; |
| 17234 | for (i = 0; i < conns; i++) |
| 17235 | if (conn_list[i] == src) |
| 17236 | return i; |
| 17237 | return -1; |
| 17238 | } |
| 17239 | |
| 17240 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 17241 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 17242 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17243 | return (pincap & AC_PINCAP_IN) != 0; |
| 17244 | } |
| 17245 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17246 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17247 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17248 | const struct auto_pin_cfg *cfg) |
| 17249 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17250 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17251 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17252 | int i, err, idx; |
| 17253 | |
| 17254 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17255 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 17256 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 17257 | cfg->input_pins[i]); |
| 17258 | if (idx >= 0) { |
| 17259 | err = new_analog_input(spec, cfg->input_pins[i], |
| 17260 | auto_pin_cfg_labels[i], |
| 17261 | idx, 0x0b); |
| 17262 | if (err < 0) |
| 17263 | return err; |
| 17264 | } |
| 17265 | idx = alc662_input_pin_idx(codec, 0x22, |
| 17266 | cfg->input_pins[i]); |
| 17267 | if (idx >= 0) { |
| 17268 | imux->items[imux->num_items].label = |
| 17269 | auto_pin_cfg_labels[i]; |
| 17270 | imux->items[imux->num_items].index = idx; |
| 17271 | imux->num_items++; |
| 17272 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17273 | } |
| 17274 | } |
| 17275 | return 0; |
| 17276 | } |
| 17277 | |
| 17278 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17279 | hda_nid_t nid, int pin_type, |
| 17280 | int dac_idx) |
| 17281 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17282 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17283 | /* need the manual connection? */ |
| 17284 | if (alc880_is_multi_pin(nid)) { |
| 17285 | struct alc_spec *spec = codec->spec; |
| 17286 | int idx = alc880_multi_pin_idx(nid); |
| 17287 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 17288 | AC_VERB_SET_CONNECT_SEL, |
| 17289 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 17290 | } |
| 17291 | } |
| 17292 | |
| 17293 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17294 | { |
| 17295 | struct alc_spec *spec = codec->spec; |
| 17296 | int i; |
| 17297 | |
| 17298 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17299 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17300 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17301 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17302 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17303 | i); |
| 17304 | } |
| 17305 | } |
| 17306 | |
| 17307 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17308 | { |
| 17309 | struct alc_spec *spec = codec->spec; |
| 17310 | hda_nid_t pin; |
| 17311 | |
| 17312 | pin = spec->autocfg.hp_pins[0]; |
| 17313 | if (pin) /* connect to front */ |
| 17314 | /* use dac 0 */ |
| 17315 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17316 | pin = spec->autocfg.speaker_pins[0]; |
| 17317 | if (pin) |
| 17318 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17319 | } |
| 17320 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17321 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17322 | |
| 17323 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17324 | { |
| 17325 | struct alc_spec *spec = codec->spec; |
| 17326 | int i; |
| 17327 | |
| 17328 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17329 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17330 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17331 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17332 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17333 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17334 | snd_hda_codec_write(codec, nid, 0, |
| 17335 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17336 | AMP_OUT_MUTE); |
| 17337 | } |
| 17338 | } |
| 17339 | } |
| 17340 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17341 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17342 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17343 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17344 | { |
| 17345 | struct alc_spec *spec = codec->spec; |
| 17346 | int err; |
| 17347 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17348 | |
| 17349 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17350 | alc662_ignore); |
| 17351 | if (err < 0) |
| 17352 | return err; |
| 17353 | if (!spec->autocfg.line_outs) |
| 17354 | return 0; /* can't find valid BIOS pin config */ |
| 17355 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17356 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17357 | if (err < 0) |
| 17358 | return err; |
| 17359 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17360 | if (err < 0) |
| 17361 | return err; |
| 17362 | err = alc662_auto_create_extra_out(spec, |
| 17363 | spec->autocfg.speaker_pins[0], |
| 17364 | "Speaker"); |
| 17365 | if (err < 0) |
| 17366 | return err; |
| 17367 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17368 | "Headphone"); |
| 17369 | if (err < 0) |
| 17370 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17371 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17372 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17373 | return err; |
| 17374 | |
| 17375 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17376 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17377 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17378 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17379 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17380 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17381 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17382 | |
| 17383 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17384 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17385 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17386 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17387 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17388 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17389 | |
| 17390 | err = alc_auto_add_mic_boost(codec); |
| 17391 | if (err < 0) |
| 17392 | return err; |
| 17393 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17394 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17395 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17396 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17397 | } |
| 17398 | |
| 17399 | /* additional initialization for auto-configuration model */ |
| 17400 | static void alc662_auto_init(struct hda_codec *codec) |
| 17401 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17402 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17403 | alc662_auto_init_multi_out(codec); |
| 17404 | alc662_auto_init_hp_out(codec); |
| 17405 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17406 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17407 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17408 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17409 | } |
| 17410 | |
| 17411 | static int patch_alc662(struct hda_codec *codec) |
| 17412 | { |
| 17413 | struct alc_spec *spec; |
| 17414 | int err, board_config; |
| 17415 | |
| 17416 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17417 | if (!spec) |
| 17418 | return -ENOMEM; |
| 17419 | |
| 17420 | codec->spec = spec; |
| 17421 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17422 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17423 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17424 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17425 | alc662_models, |
| 17426 | alc662_cfg_tbl); |
| 17427 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 17428 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 17429 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17430 | board_config = ALC662_AUTO; |
| 17431 | } |
| 17432 | |
| 17433 | if (board_config == ALC662_AUTO) { |
| 17434 | /* automatic parse from the BIOS config */ |
| 17435 | err = alc662_parse_auto_config(codec); |
| 17436 | if (err < 0) { |
| 17437 | alc_free(codec); |
| 17438 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17439 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17440 | printk(KERN_INFO |
| 17441 | "hda_codec: Cannot set up configuration " |
| 17442 | "from BIOS. Using base mode...\n"); |
| 17443 | board_config = ALC662_3ST_2ch_DIG; |
| 17444 | } |
| 17445 | } |
| 17446 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17447 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17448 | if (err < 0) { |
| 17449 | alc_free(codec); |
| 17450 | return err; |
| 17451 | } |
| 17452 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17453 | if (board_config != ALC662_AUTO) |
| 17454 | setup_preset(spec, &alc662_presets[board_config]); |
| 17455 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17456 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17457 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17458 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17459 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17460 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17461 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17462 | spec->adc_nids = alc662_adc_nids; |
| 17463 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17464 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17465 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17466 | if (!spec->cap_mixer) |
| 17467 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17468 | if (codec->vendor_id == 0x10ec0662) |
| 17469 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17470 | else |
| 17471 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17472 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17473 | spec->vmaster_nid = 0x02; |
| 17474 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17475 | codec->patch_ops = alc_patch_ops; |
| 17476 | if (board_config == ALC662_AUTO) |
| 17477 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17478 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17479 | if (!spec->loopback.amplist) |
| 17480 | spec->loopback.amplist = alc662_loopbacks; |
| 17481 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17482 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17483 | |
| 17484 | return 0; |
| 17485 | } |
| 17486 | |
| 17487 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17488 | * patch entries |
| 17489 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17490 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17491 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17492 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17493 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17494 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17495 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17496 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17497 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17498 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17499 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17500 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17501 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17502 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 17503 | .patch = patch_alc883 }, |
| 17504 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17505 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17506 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17507 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17508 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 17509 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17510 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 17511 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17512 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 17513 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17514 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 17515 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17516 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 17517 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 17518 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17519 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17520 | {} /* terminator */ |
| 17521 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17522 | |
| 17523 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17524 | |
| 17525 | MODULE_LICENSE("GPL"); |
| 17526 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17527 | |
| 17528 | static struct hda_codec_preset_list realtek_list = { |
| 17529 | .preset = snd_hda_preset_realtek, |
| 17530 | .owner = THIS_MODULE, |
| 17531 | }; |
| 17532 | |
| 17533 | static int __init patch_realtek_init(void) |
| 17534 | { |
| 17535 | return snd_hda_add_codec_preset(&realtek_list); |
| 17536 | } |
| 17537 | |
| 17538 | static void __exit patch_realtek_exit(void) |
| 17539 | { |
| 17540 | snd_hda_delete_codec_preset(&realtek_list); |
| 17541 | } |
| 17542 | |
| 17543 | module_init(patch_realtek_init) |
| 17544 | module_exit(patch_realtek_exit) |