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 | 7cf51e4 | 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 | 7cf51e4 | 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, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 223 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 224 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 225 | ALC888_ACER_ASPIRE_4930G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 226 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 227 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 228 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 229 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 230 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 231 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 232 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 233 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 234 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 235 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 236 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 237 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 238 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 239 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 240 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 241 | ALC888_ASUS_M90V, |
| 242 | ALC888_ASUS_EEE1601, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 243 | ALC1200_ASUS_P5Q, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 244 | ALC883_AUTO, |
| 245 | ALC883_MODEL_LAST, |
| 246 | }; |
| 247 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 248 | /* styles of capture selection */ |
| 249 | enum { |
| 250 | CAPT_MUX = 0, /* only mux based */ |
| 251 | CAPT_MIX, /* only mixer based */ |
| 252 | CAPT_1MUX_MIX, /* first mux and other mixers */ |
| 253 | }; |
| 254 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 255 | /* for GPIO Poll */ |
| 256 | #define GPIO_MASK 0x03 |
| 257 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 258 | /* extra amp-initialization sequence types */ |
| 259 | enum { |
| 260 | ALC_INIT_NONE, |
| 261 | ALC_INIT_DEFAULT, |
| 262 | ALC_INIT_GPIO1, |
| 263 | ALC_INIT_GPIO2, |
| 264 | ALC_INIT_GPIO3, |
| 265 | }; |
| 266 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | struct alc_spec { |
| 268 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 269 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 271 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 272 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 274 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 275 | * don't forget NULL |
| 276 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 277 | */ |
| 278 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 280 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | struct hda_pcm_stream *stream_analog_playback; |
| 282 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 283 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 284 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 286 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | struct hda_pcm_stream *stream_digital_playback; |
| 288 | struct hda_pcm_stream *stream_digital_capture; |
| 289 | |
| 290 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 291 | struct hda_multi_out multiout; /* playback set-up |
| 292 | * max_channels, dacs must be set |
| 293 | * dig_out_nid and hp_nid are optional |
| 294 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 295 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 296 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 297 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | |
| 299 | /* capture */ |
| 300 | unsigned int num_adc_nids; |
| 301 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 302 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 303 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 304 | int capture_style; /* capture style (CAPT_*) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | |
| 306 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 307 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | const struct hda_input_mux *input_mux; |
| 309 | unsigned int cur_mux[3]; |
| 310 | |
| 311 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 312 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 314 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | |
| 316 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 317 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 318 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 319 | /* dynamic controls, init_verbs and input_mux */ |
| 320 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 321 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 322 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 323 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 324 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 325 | /* hooks */ |
| 326 | void (*init_hook)(struct hda_codec *codec); |
| 327 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 328 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 329 | /* for pin sensing */ |
| 330 | unsigned int sense_updated: 1; |
| 331 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 332 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 333 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 334 | /* other flags */ |
| 335 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 336 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 337 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 338 | /* for virtual master */ |
| 339 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 340 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 341 | struct hda_loopback_check loopback; |
| 342 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 343 | |
| 344 | /* for PLL fix */ |
| 345 | hda_nid_t pll_nid; |
| 346 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 347 | }; |
| 348 | |
| 349 | /* |
| 350 | * configuration template - to be copied to the spec instance |
| 351 | */ |
| 352 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 353 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 354 | * with spec |
| 355 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 356 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 357 | const struct hda_verb *init_verbs[5]; |
| 358 | unsigned int num_dacs; |
| 359 | hda_nid_t *dac_nids; |
| 360 | hda_nid_t dig_out_nid; /* optional */ |
| 361 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 362 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 363 | unsigned int num_adc_nids; |
| 364 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 365 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 366 | hda_nid_t dig_in_nid; |
| 367 | unsigned int num_channel_mode; |
| 368 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 369 | int need_dac_fix; |
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]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 416 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 417 | imux = &spec->input_mux[mux_idx]; |
| 418 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 419 | if (spec->capture_style && |
| 420 | !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 421 | /* Matrix-mixer style (e.g. ALC882) */ |
| 422 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 423 | unsigned int i, idx; |
| 424 | |
| 425 | idx = ucontrol->value.enumerated.item[0]; |
| 426 | if (idx >= imux->num_items) |
| 427 | idx = imux->num_items - 1; |
| 428 | if (*cur_val == idx) |
| 429 | return 0; |
| 430 | for (i = 0; i < imux->num_items; i++) { |
| 431 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 432 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 433 | imux->items[i].index, |
| 434 | HDA_AMP_MUTE, v); |
| 435 | } |
| 436 | *cur_val = idx; |
| 437 | return 1; |
| 438 | } else { |
| 439 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 440 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 441 | &spec->cur_mux[adc_idx]); |
| 442 | } |
| 443 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 444 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | /* |
| 446 | * channel mode setting |
| 447 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 448 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 449 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | { |
| 451 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 452 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 453 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 454 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | } |
| 456 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 457 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 458 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | { |
| 460 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 461 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 462 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 463 | spec->num_channel_mode, |
| 464 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | } |
| 466 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 467 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 468 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | { |
| 470 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 471 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 472 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 473 | spec->num_channel_mode, |
| 474 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 475 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 476 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 477 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | } |
| 479 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 481 | * 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] | 482 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 483 | * being part of a format specifier. Maximum allowed length of a value is |
| 484 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 485 | * |
| 486 | * Note: some retasking pin complexes seem to ignore requests for input |
| 487 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 488 | * are requested. Therefore order this list so that this behaviour will not |
| 489 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 490 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 491 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 492 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 493 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 494 | "Mic 50pc bias", "Mic 80pc bias", |
| 495 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 496 | }; |
| 497 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 498 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 499 | }; |
| 500 | /* 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] | 501 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 502 | * addition, "input" pins may or may not process the mic bias option |
| 503 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 504 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 505 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 506 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 507 | #define ALC_PIN_DIR_IN 0x00 |
| 508 | #define ALC_PIN_DIR_OUT 0x01 |
| 509 | #define ALC_PIN_DIR_INOUT 0x02 |
| 510 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 511 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 512 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 513 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 514 | * For each direction the minimum and maximum values are given. |
| 515 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 516 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 517 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 518 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 519 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 520 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 521 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 522 | }; |
| 523 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 524 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 525 | #define alc_pin_mode_n_items(_dir) \ |
| 526 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 527 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 528 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 529 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 530 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 531 | unsigned int item_num = uinfo->value.enumerated.item; |
| 532 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 533 | |
| 534 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 535 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 536 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 537 | |
| 538 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 539 | item_num = alc_pin_mode_min(dir); |
| 540 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 541 | return 0; |
| 542 | } |
| 543 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 544 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 545 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 546 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 547 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 548 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 549 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 550 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 551 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 552 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 553 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 554 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 555 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 556 | /* Find enumerated value for current pinctl setting */ |
| 557 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 558 | 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] | 559 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 560 | *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] | 561 | return 0; |
| 562 | } |
| 563 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 564 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 565 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 566 | { |
| 567 | signed int change; |
| 568 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 569 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 570 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 571 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 572 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 573 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 574 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 575 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 576 | 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] | 577 | val = alc_pin_mode_min(dir); |
| 578 | |
| 579 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 580 | if (change) { |
| 581 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 582 | snd_hda_codec_write_cache(codec, nid, 0, |
| 583 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 584 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 585 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 586 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 587 | * for the requested pin mode. Enum values of 2 or less are |
| 588 | * input modes. |
| 589 | * |
| 590 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 591 | * reduces noise slightly (particularly on input) so we'll |
| 592 | * do it. However, having both input and output buffers |
| 593 | * enabled simultaneously doesn't seem to be problematic if |
| 594 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 595 | */ |
| 596 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 597 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 598 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 599 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 600 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 601 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 602 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 603 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 604 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 605 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 606 | } |
| 607 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 608 | return change; |
| 609 | } |
| 610 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 611 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 612 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 613 | .info = alc_pin_mode_info, \ |
| 614 | .get = alc_pin_mode_get, \ |
| 615 | .put = alc_pin_mode_put, \ |
| 616 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 617 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 618 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 619 | * together using a mask with more than one bit set. This control is |
| 620 | * currently used only by the ALC260 test model. At this stage they are not |
| 621 | * needed for any "production" models. |
| 622 | */ |
| 623 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 624 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 625 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 626 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 627 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 628 | { |
| 629 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 630 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 631 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 632 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 633 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 634 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 635 | |
| 636 | *valp = (val & mask) != 0; |
| 637 | return 0; |
| 638 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 639 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 640 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 641 | { |
| 642 | signed int change; |
| 643 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 644 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 645 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 646 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 647 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 648 | AC_VERB_GET_GPIO_DATA, |
| 649 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 650 | |
| 651 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 652 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 653 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 654 | gpio_data &= ~mask; |
| 655 | else |
| 656 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 657 | snd_hda_codec_write_cache(codec, nid, 0, |
| 658 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 659 | |
| 660 | return change; |
| 661 | } |
| 662 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 663 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 664 | .info = alc_gpio_data_info, \ |
| 665 | .get = alc_gpio_data_get, \ |
| 666 | .put = alc_gpio_data_put, \ |
| 667 | .private_value = nid | (mask<<16) } |
| 668 | #endif /* CONFIG_SND_DEBUG */ |
| 669 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 670 | /* A switch control to allow the enabling of the digital IO pins on the |
| 671 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 672 | * to provide something in the test model allowing digital outputs to be |
| 673 | * identified if present. If models are found which can utilise these |
| 674 | * outputs a more complete mixer control can be devised for those models if |
| 675 | * necessary. |
| 676 | */ |
| 677 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 678 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 679 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 680 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 681 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 682 | { |
| 683 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 684 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 685 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 686 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 687 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 688 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 689 | |
| 690 | *valp = (val & mask) != 0; |
| 691 | return 0; |
| 692 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 693 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 694 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 695 | { |
| 696 | signed int change; |
| 697 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 698 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 699 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 700 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 701 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 702 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 703 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 704 | |
| 705 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 706 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 707 | if (val==0) |
| 708 | ctrl_data &= ~mask; |
| 709 | else |
| 710 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 711 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 712 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 713 | |
| 714 | return change; |
| 715 | } |
| 716 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 717 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 718 | .info = alc_spdif_ctrl_info, \ |
| 719 | .get = alc_spdif_ctrl_get, \ |
| 720 | .put = alc_spdif_ctrl_put, \ |
| 721 | .private_value = nid | (mask<<16) } |
| 722 | #endif /* CONFIG_SND_DEBUG */ |
| 723 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 724 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 725 | * Again, this is only used in the ALC26x test models to help identify when |
| 726 | * the EAPD line must be asserted for features to work. |
| 727 | */ |
| 728 | #ifdef CONFIG_SND_DEBUG |
| 729 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 730 | |
| 731 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 732 | struct snd_ctl_elem_value *ucontrol) |
| 733 | { |
| 734 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 735 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 736 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 737 | long *valp = ucontrol->value.integer.value; |
| 738 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 739 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 740 | |
| 741 | *valp = (val & mask) != 0; |
| 742 | return 0; |
| 743 | } |
| 744 | |
| 745 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 746 | struct snd_ctl_elem_value *ucontrol) |
| 747 | { |
| 748 | int change; |
| 749 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 750 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 751 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 752 | long val = *ucontrol->value.integer.value; |
| 753 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 754 | AC_VERB_GET_EAPD_BTLENABLE, |
| 755 | 0x00); |
| 756 | |
| 757 | /* Set/unset the masked control bit(s) as needed */ |
| 758 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 759 | if (!val) |
| 760 | ctrl_data &= ~mask; |
| 761 | else |
| 762 | ctrl_data |= mask; |
| 763 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 764 | ctrl_data); |
| 765 | |
| 766 | return change; |
| 767 | } |
| 768 | |
| 769 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 770 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 771 | .info = alc_eapd_ctrl_info, \ |
| 772 | .get = alc_eapd_ctrl_get, \ |
| 773 | .put = alc_eapd_ctrl_put, \ |
| 774 | .private_value = nid | (mask<<16) } |
| 775 | #endif /* CONFIG_SND_DEBUG */ |
| 776 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 777 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 778 | * set up the input pin config (depending on the given auto-pin type) |
| 779 | */ |
| 780 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 781 | int auto_pin_type) |
| 782 | { |
| 783 | unsigned int val = PIN_IN; |
| 784 | |
| 785 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 786 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 787 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 788 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 789 | if (pincap & AC_PINCAP_VREF_80) |
| 790 | val = PIN_VREF80; |
| 791 | } |
| 792 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 793 | } |
| 794 | |
| 795 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 796 | */ |
| 797 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 798 | { |
| 799 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 800 | return; |
| 801 | spec->mixers[spec->num_mixers++] = mix; |
| 802 | } |
| 803 | |
| 804 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 805 | { |
| 806 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 807 | return; |
| 808 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 809 | } |
| 810 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 811 | #ifdef CONFIG_PROC_FS |
| 812 | /* |
| 813 | * hook for proc |
| 814 | */ |
| 815 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 816 | struct hda_codec *codec, hda_nid_t nid) |
| 817 | { |
| 818 | int coeff; |
| 819 | |
| 820 | if (nid != 0x20) |
| 821 | return; |
| 822 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 823 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 824 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 825 | AC_VERB_GET_COEF_INDEX, 0); |
| 826 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 827 | } |
| 828 | #else |
| 829 | #define print_realtek_coef NULL |
| 830 | #endif |
| 831 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 832 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 833 | * set up from the preset table |
| 834 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 835 | static void setup_preset(struct alc_spec *spec, |
| 836 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 837 | { |
| 838 | int i; |
| 839 | |
| 840 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 841 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 842 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 843 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 844 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 845 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 846 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 847 | spec->channel_mode = preset->channel_mode; |
| 848 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 849 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 850 | |
| 851 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 852 | |
| 853 | spec->multiout.num_dacs = preset->num_dacs; |
| 854 | spec->multiout.dac_nids = preset->dac_nids; |
| 855 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 856 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 857 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 858 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 859 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 860 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 861 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 862 | spec->input_mux = preset->input_mux; |
| 863 | |
| 864 | spec->num_adc_nids = preset->num_adc_nids; |
| 865 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 866 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 867 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 868 | |
| 869 | spec->unsol_event = preset->unsol_event; |
| 870 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 871 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 872 | spec->loopback.amplist = preset->loopbacks; |
| 873 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 874 | } |
| 875 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 876 | /* Enable GPIO mask and set output */ |
| 877 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 878 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 879 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 880 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 881 | { } |
| 882 | }; |
| 883 | |
| 884 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 885 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 886 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 887 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 888 | { } |
| 889 | }; |
| 890 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 891 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 892 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 893 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 894 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 895 | { } |
| 896 | }; |
| 897 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 898 | /* |
| 899 | * Fix hardware PLL issue |
| 900 | * On some codecs, the analog PLL gating control must be off while |
| 901 | * the default value is 1. |
| 902 | */ |
| 903 | static void alc_fix_pll(struct hda_codec *codec) |
| 904 | { |
| 905 | struct alc_spec *spec = codec->spec; |
| 906 | unsigned int val; |
| 907 | |
| 908 | if (!spec->pll_nid) |
| 909 | return; |
| 910 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 911 | spec->pll_coef_idx); |
| 912 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 913 | AC_VERB_GET_PROC_COEF, 0); |
| 914 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 915 | spec->pll_coef_idx); |
| 916 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 917 | val & ~(1 << spec->pll_coef_bit)); |
| 918 | } |
| 919 | |
| 920 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 921 | unsigned int coef_idx, unsigned int coef_bit) |
| 922 | { |
| 923 | struct alc_spec *spec = codec->spec; |
| 924 | spec->pll_nid = nid; |
| 925 | spec->pll_coef_idx = coef_idx; |
| 926 | spec->pll_coef_bit = coef_bit; |
| 927 | alc_fix_pll(codec); |
| 928 | } |
| 929 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 930 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 931 | { |
| 932 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 933 | unsigned int present; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 934 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 935 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 936 | |
| 937 | /* need to execute and sync at first */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 938 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 939 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 940 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 941 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 942 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 943 | nid = spec->autocfg.speaker_pins[i]; |
| 944 | if (!nid) |
| 945 | break; |
| 946 | snd_hda_codec_write(codec, nid, 0, |
| 947 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 948 | spec->jack_present ? 0 : PIN_OUT); |
| 949 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 950 | } |
| 951 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 952 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 953 | static void alc_mic_automute(struct hda_codec *codec) |
| 954 | { |
| 955 | struct alc_spec *spec = codec->spec; |
| 956 | unsigned int present; |
| 957 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 958 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 959 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 960 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 961 | |
| 962 | capsrc_idx_mic = mic_nid - 0x18; |
| 963 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 964 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 965 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 966 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 967 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 968 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 969 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 970 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 971 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 972 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 973 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 974 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 975 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 976 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 977 | /* unsolicited event for HP jack sensing */ |
| 978 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 979 | { |
| 980 | if (codec->vendor_id == 0x10ec0880) |
| 981 | res >>= 28; |
| 982 | else |
| 983 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 984 | switch (res) { |
| 985 | case ALC880_HP_EVENT: |
| 986 | alc_automute_pin(codec); |
| 987 | break; |
| 988 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 989 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 990 | break; |
| 991 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 992 | } |
| 993 | |
| 994 | static void alc_inithook(struct hda_codec *codec) |
| 995 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 996 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 997 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 998 | } |
| 999 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1000 | /* additional initialization for ALC888 variants */ |
| 1001 | static void alc888_coef_init(struct hda_codec *codec) |
| 1002 | { |
| 1003 | unsigned int tmp; |
| 1004 | |
| 1005 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1006 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1007 | 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] | 1008 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1009 | /* alc888S-VC */ |
| 1010 | snd_hda_codec_read(codec, 0x20, 0, |
| 1011 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1012 | else |
| 1013 | /* alc888-VB */ |
| 1014 | snd_hda_codec_read(codec, 0x20, 0, |
| 1015 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1016 | } |
| 1017 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1018 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1019 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1020 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1021 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1022 | switch (type) { |
| 1023 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1024 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1025 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1026 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1027 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1028 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1029 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1030 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1031 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1032 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1033 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1034 | case 0x10ec0260: |
| 1035 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1036 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1037 | snd_hda_codec_write(codec, 0x10, 0, |
| 1038 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1039 | break; |
| 1040 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1041 | case 0x10ec0267: |
| 1042 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1043 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1044 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1045 | case 0x10ec0660: |
| 1046 | case 0x10ec0662: |
| 1047 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1048 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1049 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1050 | snd_hda_codec_write(codec, 0x14, 0, |
| 1051 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1052 | snd_hda_codec_write(codec, 0x15, 0, |
| 1053 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1054 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1055 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1056 | switch (codec->vendor_id) { |
| 1057 | case 0x10ec0260: |
| 1058 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1059 | AC_VERB_SET_COEF_INDEX, 7); |
| 1060 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1061 | AC_VERB_GET_PROC_COEF, 0); |
| 1062 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1063 | AC_VERB_SET_COEF_INDEX, 7); |
| 1064 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1065 | AC_VERB_SET_PROC_COEF, |
| 1066 | tmp | 0x2010); |
| 1067 | break; |
| 1068 | case 0x10ec0262: |
| 1069 | case 0x10ec0880: |
| 1070 | case 0x10ec0882: |
| 1071 | case 0x10ec0883: |
| 1072 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1073 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1074 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1075 | snd_hda_codec_write(codec, 0x20, 0, |
| 1076 | AC_VERB_SET_COEF_INDEX, 7); |
| 1077 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1078 | AC_VERB_GET_PROC_COEF, 0); |
| 1079 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1080 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1081 | snd_hda_codec_write(codec, 0x20, 0, |
| 1082 | AC_VERB_SET_PROC_COEF, |
| 1083 | tmp | 0x2010); |
| 1084 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1085 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1086 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1087 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1088 | case 0x10ec0267: |
| 1089 | case 0x10ec0268: |
| 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 | 0x3000); |
| 1099 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1100 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1101 | break; |
| 1102 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1103 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1104 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1105 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1106 | { |
| 1107 | struct alc_spec *spec = codec->spec; |
| 1108 | |
| 1109 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1110 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1111 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1112 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1113 | if (spec->autocfg.line_out_pins[0] && |
| 1114 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1115 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1116 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1117 | else |
| 1118 | return; |
| 1119 | } |
| 1120 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1121 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1122 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1123 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1124 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1125 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1126 | spec->unsol_event = alc_sku_unsol_event; |
| 1127 | } |
| 1128 | |
| 1129 | /* check subsystem ID and set up device-specific initialization; |
| 1130 | * return 1 if initialized, 0 if invalid SSID |
| 1131 | */ |
| 1132 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1133 | * 31 ~ 16 : Manufacture ID |
| 1134 | * 15 ~ 8 : SKU ID |
| 1135 | * 7 ~ 0 : Assembly ID |
| 1136 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1137 | */ |
| 1138 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1139 | hda_nid_t porta, hda_nid_t porte, |
| 1140 | hda_nid_t portd) |
| 1141 | { |
| 1142 | unsigned int ass, tmp, i; |
| 1143 | unsigned nid; |
| 1144 | struct alc_spec *spec = codec->spec; |
| 1145 | |
| 1146 | ass = codec->subsystem_id & 0xffff; |
| 1147 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1148 | goto do_sku; |
| 1149 | |
| 1150 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1151 | /* |
| 1152 | * 31~30 : port conetcivity |
| 1153 | * 29~21 : reserve |
| 1154 | * 20 : PCBEEP input |
| 1155 | * 19~16 : Check sum (15:1) |
| 1156 | * 15~1 : Custom |
| 1157 | * 0 : override |
| 1158 | */ |
| 1159 | nid = 0x1d; |
| 1160 | if (codec->vendor_id == 0x10ec0260) |
| 1161 | nid = 0x17; |
| 1162 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1163 | snd_printd("realtek: No valid SSID, " |
| 1164 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1165 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1166 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1167 | return 0; |
| 1168 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1169 | return 0; |
| 1170 | |
| 1171 | /* check sum */ |
| 1172 | tmp = 0; |
| 1173 | for (i = 1; i < 16; i++) { |
| 1174 | if ((ass >> i) & 1) |
| 1175 | tmp++; |
| 1176 | } |
| 1177 | if (((ass >> 16) & 0xf) != tmp) |
| 1178 | return 0; |
| 1179 | do_sku: |
| 1180 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1181 | ass & 0xffff, codec->vendor_id); |
| 1182 | /* |
| 1183 | * 0 : override |
| 1184 | * 1 : Swap Jack |
| 1185 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1186 | * 3~5 : External Amplifier control |
| 1187 | * 7~6 : Reserved |
| 1188 | */ |
| 1189 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1190 | switch (tmp) { |
| 1191 | case 1: |
| 1192 | spec->init_amp = ALC_INIT_GPIO1; |
| 1193 | break; |
| 1194 | case 3: |
| 1195 | spec->init_amp = ALC_INIT_GPIO2; |
| 1196 | break; |
| 1197 | case 7: |
| 1198 | spec->init_amp = ALC_INIT_GPIO3; |
| 1199 | break; |
| 1200 | case 5: |
| 1201 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1202 | break; |
| 1203 | } |
| 1204 | |
| 1205 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1206 | * when the external headphone out jack is plugged" |
| 1207 | */ |
| 1208 | if (!(ass & 0x8000)) |
| 1209 | return 1; |
| 1210 | /* |
| 1211 | * 10~8 : Jack location |
| 1212 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1213 | * 14~13: Resvered |
| 1214 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1215 | * when the external headphone out jack is plugged" |
| 1216 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1217 | if (!spec->autocfg.hp_pins[0]) { |
| 1218 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1219 | if (tmp == 0) |
| 1220 | spec->autocfg.hp_pins[0] = porta; |
| 1221 | else if (tmp == 1) |
| 1222 | spec->autocfg.hp_pins[0] = porte; |
| 1223 | else if (tmp == 2) |
| 1224 | spec->autocfg.hp_pins[0] = portd; |
| 1225 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1226 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1227 | } |
| 1228 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1229 | alc_init_auto_hp(codec); |
| 1230 | return 1; |
| 1231 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1232 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1233 | static void alc_ssid_check(struct hda_codec *codec, |
| 1234 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1235 | { |
| 1236 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1237 | struct alc_spec *spec = codec->spec; |
| 1238 | snd_printd("realtek: " |
| 1239 | "Enable default setup for auto mode as fallback\n"); |
| 1240 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1241 | alc_init_auto_hp(codec); |
| 1242 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1243 | } |
| 1244 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1245 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1246 | * Fix-up pin default configurations |
| 1247 | */ |
| 1248 | |
| 1249 | struct alc_pincfg { |
| 1250 | hda_nid_t nid; |
| 1251 | u32 val; |
| 1252 | }; |
| 1253 | |
| 1254 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1255 | const struct snd_pci_quirk *quirk, |
| 1256 | const struct alc_pincfg **pinfix) |
| 1257 | { |
| 1258 | const struct alc_pincfg *cfg; |
| 1259 | |
| 1260 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1261 | if (!quirk) |
| 1262 | return; |
| 1263 | |
| 1264 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1265 | for (; cfg->nid; cfg++) |
| 1266 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1267 | } |
| 1268 | |
| 1269 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1270 | * ALC888 |
| 1271 | */ |
| 1272 | |
| 1273 | /* |
| 1274 | * 2ch mode |
| 1275 | */ |
| 1276 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1277 | /* Mic-in jack as mic in */ |
| 1278 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1279 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1280 | /* Line-in jack as Line in */ |
| 1281 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1282 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1283 | /* Line-Out as Front */ |
| 1284 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1285 | { } /* end */ |
| 1286 | }; |
| 1287 | |
| 1288 | /* |
| 1289 | * 4ch mode |
| 1290 | */ |
| 1291 | static struct hda_verb alc888_4ST_ch4_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 Surround */ |
| 1296 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1297 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1298 | /* Line-Out as Front */ |
| 1299 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1300 | { } /* end */ |
| 1301 | }; |
| 1302 | |
| 1303 | /* |
| 1304 | * 6ch mode |
| 1305 | */ |
| 1306 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1307 | /* Mic-in jack as CLFE */ |
| 1308 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1309 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 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 CLFE (workaround because Mic-in is not loud enough) */ |
| 1314 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1315 | { } /* end */ |
| 1316 | }; |
| 1317 | |
| 1318 | /* |
| 1319 | * 8ch mode |
| 1320 | */ |
| 1321 | static struct hda_verb alc888_4ST_ch8_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 Side */ |
| 1329 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1330 | { } /* end */ |
| 1331 | }; |
| 1332 | |
| 1333 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1334 | { 2, alc888_4ST_ch2_intel_init }, |
| 1335 | { 4, alc888_4ST_ch4_intel_init }, |
| 1336 | { 6, alc888_4ST_ch6_intel_init }, |
| 1337 | { 8, alc888_4ST_ch8_intel_init }, |
| 1338 | }; |
| 1339 | |
| 1340 | /* |
| 1341 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1342 | */ |
| 1343 | |
| 1344 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1345 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1346 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1347 | /* Connect Internal HP to Front */ |
| 1348 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1349 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1350 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1351 | /* Connect Bass HP to Front */ |
| 1352 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1353 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1354 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1355 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1356 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1357 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1358 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1359 | /* Connect Mic jack to CLFE */ |
| 1360 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1361 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1362 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1363 | /* Connect Line-in jack to Surround */ |
| 1364 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1365 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1366 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1367 | /* Connect HP out jack to Front */ |
| 1368 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1369 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1370 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1371 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1372 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1373 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1374 | {} |
| 1375 | }; |
| 1376 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1377 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1378 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1379 | struct alc_spec *spec = codec->spec; |
| 1380 | unsigned int val, mute; |
| 1381 | hda_nid_t nid; |
| 1382 | int i; |
| 1383 | |
| 1384 | spec->jack_present = 0; |
| 1385 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1386 | nid = spec->autocfg.hp_pins[i]; |
| 1387 | if (!nid) |
| 1388 | break; |
| 1389 | val = snd_hda_codec_read(codec, nid, 0, |
| 1390 | AC_VERB_GET_PIN_SENSE, 0); |
| 1391 | if (val & AC_PINSENSE_PRESENCE) { |
| 1392 | spec->jack_present = 1; |
| 1393 | break; |
| 1394 | } |
| 1395 | } |
| 1396 | |
| 1397 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1398 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1399 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1400 | nid = spec->autocfg.speaker_pins[i]; |
| 1401 | if (!nid) |
| 1402 | break; |
| 1403 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1404 | HDA_AMP_MUTE, mute); |
| 1405 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1406 | } |
| 1407 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1408 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1409 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1410 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1411 | if (codec->vendor_id == 0x10ec0880) |
| 1412 | res >>= 28; |
| 1413 | else |
| 1414 | res >>= 26; |
| 1415 | if (res == ALC880_HP_EVENT) |
| 1416 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1417 | } |
| 1418 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1419 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) |
| 1420 | { |
| 1421 | struct alc_spec *spec = codec->spec; |
| 1422 | |
| 1423 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1424 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1425 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1426 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
| 1427 | alc_automute_amp(codec); |
| 1428 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1429 | |
| 1430 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1431 | * ALC888 Acer Aspire 4930G model |
| 1432 | */ |
| 1433 | |
| 1434 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1435 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1436 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1437 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1438 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1439 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1440 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1441 | /* Connect Internal HP to front */ |
| 1442 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1443 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1444 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1445 | /* Connect HP out to front */ |
| 1446 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1447 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1448 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1449 | { } |
| 1450 | }; |
| 1451 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1452 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1453 | /* Front mic only available on one ADC */ |
| 1454 | { |
| 1455 | .num_items = 4, |
| 1456 | .items = { |
| 1457 | { "Mic", 0x0 }, |
| 1458 | { "Line", 0x2 }, |
| 1459 | { "CD", 0x4 }, |
| 1460 | { "Front Mic", 0xb }, |
| 1461 | }, |
| 1462 | }, |
| 1463 | { |
| 1464 | .num_items = 3, |
| 1465 | .items = { |
| 1466 | { "Mic", 0x0 }, |
| 1467 | { "Line", 0x2 }, |
| 1468 | { "CD", 0x4 }, |
| 1469 | }, |
| 1470 | } |
| 1471 | }; |
| 1472 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1473 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1474 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1475 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1476 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1477 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1478 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1479 | HDA_OUTPUT), |
| 1480 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1481 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1482 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1483 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1484 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1485 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1486 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1487 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1488 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1489 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1490 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1491 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1492 | { } /* end */ |
| 1493 | }; |
| 1494 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1495 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1496 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1497 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1498 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1499 | spec->autocfg.hp_pins[0] = 0x15; |
| 1500 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1501 | alc_automute_amp(codec); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1502 | } |
| 1503 | |
| 1504 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1505 | * ALC880 3-stack model |
| 1506 | * |
| 1507 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1508 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1509 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1510 | */ |
| 1511 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1512 | static hda_nid_t alc880_dac_nids[4] = { |
| 1513 | /* front, rear, clfe, rear_surr */ |
| 1514 | 0x02, 0x05, 0x04, 0x03 |
| 1515 | }; |
| 1516 | |
| 1517 | static hda_nid_t alc880_adc_nids[3] = { |
| 1518 | /* ADC0-2 */ |
| 1519 | 0x07, 0x08, 0x09, |
| 1520 | }; |
| 1521 | |
| 1522 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1523 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1524 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1525 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1526 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1527 | /* ADC1-2 */ |
| 1528 | 0x08, 0x09, |
| 1529 | }; |
| 1530 | |
| 1531 | #define ALC880_DIGOUT_NID 0x06 |
| 1532 | #define ALC880_DIGIN_NID 0x0a |
| 1533 | |
| 1534 | static struct hda_input_mux alc880_capture_source = { |
| 1535 | .num_items = 4, |
| 1536 | .items = { |
| 1537 | { "Mic", 0x0 }, |
| 1538 | { "Front Mic", 0x3 }, |
| 1539 | { "Line", 0x2 }, |
| 1540 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1541 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1542 | }; |
| 1543 | |
| 1544 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1545 | /* 2ch mode */ |
| 1546 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1547 | /* set line-in to input, mute it */ |
| 1548 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1549 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1550 | /* set mic-in to input vref 80%, mute it */ |
| 1551 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1552 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1553 | { } /* end */ |
| 1554 | }; |
| 1555 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1556 | /* 6ch mode */ |
| 1557 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1558 | /* set line-in to output, unmute it */ |
| 1559 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1560 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1561 | /* set mic-in to output, unmute it */ |
| 1562 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1563 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1564 | { } /* end */ |
| 1565 | }; |
| 1566 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1567 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1568 | { 2, alc880_threestack_ch2_init }, |
| 1569 | { 6, alc880_threestack_ch6_init }, |
| 1570 | }; |
| 1571 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1572 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1573 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1574 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1575 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1576 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1577 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1578 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1579 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1580 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1581 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1582 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1583 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1584 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1585 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1586 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1587 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1588 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1589 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1590 | { |
| 1591 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1592 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1593 | .info = alc_ch_mode_info, |
| 1594 | .get = alc_ch_mode_get, |
| 1595 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1596 | }, |
| 1597 | { } /* end */ |
| 1598 | }; |
| 1599 | |
| 1600 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1601 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1602 | struct snd_ctl_elem_info *uinfo) |
| 1603 | { |
| 1604 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1605 | struct alc_spec *spec = codec->spec; |
| 1606 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1607 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1608 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1609 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1610 | HDA_INPUT); |
| 1611 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1612 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1613 | return err; |
| 1614 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1615 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1616 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1617 | unsigned int size, unsigned int __user *tlv) |
| 1618 | { |
| 1619 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1620 | struct alc_spec *spec = codec->spec; |
| 1621 | int err; |
| 1622 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1623 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1624 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1625 | HDA_INPUT); |
| 1626 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1627 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1628 | return err; |
| 1629 | } |
| 1630 | |
| 1631 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1632 | struct snd_ctl_elem_value *ucontrol); |
| 1633 | |
| 1634 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1635 | struct snd_ctl_elem_value *ucontrol, |
| 1636 | getput_call_t func) |
| 1637 | { |
| 1638 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1639 | struct alc_spec *spec = codec->spec; |
| 1640 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1641 | int err; |
| 1642 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1643 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1644 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1645 | 3, 0, HDA_INPUT); |
| 1646 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1647 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1648 | return err; |
| 1649 | } |
| 1650 | |
| 1651 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1652 | struct snd_ctl_elem_value *ucontrol) |
| 1653 | { |
| 1654 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1655 | snd_hda_mixer_amp_volume_get); |
| 1656 | } |
| 1657 | |
| 1658 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1659 | struct snd_ctl_elem_value *ucontrol) |
| 1660 | { |
| 1661 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1662 | snd_hda_mixer_amp_volume_put); |
| 1663 | } |
| 1664 | |
| 1665 | /* capture mixer elements */ |
| 1666 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1667 | |
| 1668 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1669 | struct snd_ctl_elem_value *ucontrol) |
| 1670 | { |
| 1671 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1672 | snd_hda_mixer_amp_switch_get); |
| 1673 | } |
| 1674 | |
| 1675 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1676 | struct snd_ctl_elem_value *ucontrol) |
| 1677 | { |
| 1678 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1679 | snd_hda_mixer_amp_switch_put); |
| 1680 | } |
| 1681 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1682 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1683 | { \ |
| 1684 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1685 | .name = "Capture Switch", \ |
| 1686 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1687 | .count = num, \ |
| 1688 | .info = alc_cap_sw_info, \ |
| 1689 | .get = alc_cap_sw_get, \ |
| 1690 | .put = alc_cap_sw_put, \ |
| 1691 | }, \ |
| 1692 | { \ |
| 1693 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1694 | .name = "Capture Volume", \ |
| 1695 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1696 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1697 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1698 | .count = num, \ |
| 1699 | .info = alc_cap_vol_info, \ |
| 1700 | .get = alc_cap_vol_get, \ |
| 1701 | .put = alc_cap_vol_put, \ |
| 1702 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1703 | } |
| 1704 | |
| 1705 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1706 | { \ |
| 1707 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1708 | /* .name = "Capture Source", */ \ |
| 1709 | .name = "Input Source", \ |
| 1710 | .count = num, \ |
| 1711 | .info = alc_mux_enum_info, \ |
| 1712 | .get = alc_mux_enum_get, \ |
| 1713 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1714 | } |
| 1715 | |
| 1716 | #define DEFINE_CAPMIX(num) \ |
| 1717 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1718 | _DEFINE_CAPMIX(num), \ |
| 1719 | _DEFINE_CAPSRC(num), \ |
| 1720 | { } /* end */ \ |
| 1721 | } |
| 1722 | |
| 1723 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 1724 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 1725 | _DEFINE_CAPMIX(num), \ |
| 1726 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1727 | } |
| 1728 | |
| 1729 | /* up to three ADCs */ |
| 1730 | DEFINE_CAPMIX(1); |
| 1731 | DEFINE_CAPMIX(2); |
| 1732 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1733 | DEFINE_CAPMIX_NOSRC(1); |
| 1734 | DEFINE_CAPMIX_NOSRC(2); |
| 1735 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1736 | |
| 1737 | /* |
| 1738 | * ALC880 5-stack model |
| 1739 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1740 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1741 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1742 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1743 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1744 | */ |
| 1745 | |
| 1746 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1747 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1748 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1749 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1750 | { } /* end */ |
| 1751 | }; |
| 1752 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1753 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1754 | /* 6ch mode */ |
| 1755 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1756 | /* set line-in to input, mute it */ |
| 1757 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1758 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1759 | { } /* end */ |
| 1760 | }; |
| 1761 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1762 | /* 8ch mode */ |
| 1763 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1764 | /* set line-in to output, unmute it */ |
| 1765 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1766 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1767 | { } /* end */ |
| 1768 | }; |
| 1769 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1770 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1771 | { 6, alc880_fivestack_ch6_init }, |
| 1772 | { 8, alc880_fivestack_ch8_init }, |
| 1773 | }; |
| 1774 | |
| 1775 | |
| 1776 | /* |
| 1777 | * ALC880 6-stack model |
| 1778 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1779 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1780 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1781 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1782 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1783 | */ |
| 1784 | |
| 1785 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1786 | /* front, rear, clfe, rear_surr */ |
| 1787 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1788 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1789 | |
| 1790 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1791 | .num_items = 4, |
| 1792 | .items = { |
| 1793 | { "Mic", 0x0 }, |
| 1794 | { "Front Mic", 0x1 }, |
| 1795 | { "Line", 0x2 }, |
| 1796 | { "CD", 0x4 }, |
| 1797 | }, |
| 1798 | }; |
| 1799 | |
| 1800 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1801 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1802 | { 8, NULL }, |
| 1803 | }; |
| 1804 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1805 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1806 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1807 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1808 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1809 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1810 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1811 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1812 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1813 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1814 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1815 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1816 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1817 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1818 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1819 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1820 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1821 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1822 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1823 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1824 | { |
| 1825 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1826 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1827 | .info = alc_ch_mode_info, |
| 1828 | .get = alc_ch_mode_get, |
| 1829 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1830 | }, |
| 1831 | { } /* end */ |
| 1832 | }; |
| 1833 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1834 | |
| 1835 | /* |
| 1836 | * ALC880 W810 model |
| 1837 | * |
| 1838 | * W810 has rear IO for: |
| 1839 | * Front (DAC 02) |
| 1840 | * Surround (DAC 03) |
| 1841 | * Center/LFE (DAC 04) |
| 1842 | * Digital out (06) |
| 1843 | * |
| 1844 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1845 | * 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] | 1846 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1847 | * There is a variable resistor to control the speaker or headphone |
| 1848 | * volume. This is a hardware-only device without a software API. |
| 1849 | * |
| 1850 | * Plugging headphones in will disable the internal speakers. This is |
| 1851 | * implemented in hardware, not via the driver using jack sense. In |
| 1852 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1853 | * disable both the speakers and headphones. |
| 1854 | * |
| 1855 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1856 | * These may not do anything useful with this driver yet, because I |
| 1857 | * haven't setup any initialization verbs for these yet... |
| 1858 | */ |
| 1859 | |
| 1860 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1861 | /* front, rear/surround, clfe */ |
| 1862 | 0x02, 0x03, 0x04 |
| 1863 | }; |
| 1864 | |
| 1865 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1866 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1867 | { 6, NULL } |
| 1868 | }; |
| 1869 | |
| 1870 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1871 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1872 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1873 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1874 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1875 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1876 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1877 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1878 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1879 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1880 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1881 | { } /* end */ |
| 1882 | }; |
| 1883 | |
| 1884 | |
| 1885 | /* |
| 1886 | * Z710V model |
| 1887 | * |
| 1888 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1889 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1890 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1891 | */ |
| 1892 | |
| 1893 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1894 | 0x02 |
| 1895 | }; |
| 1896 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1897 | |
| 1898 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1899 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1900 | { 2, NULL } |
| 1901 | }; |
| 1902 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1903 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1904 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1905 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1906 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1907 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1908 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1909 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1910 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1911 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1912 | { } /* end */ |
| 1913 | }; |
| 1914 | |
| 1915 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1916 | /* |
| 1917 | * ALC880 F1734 model |
| 1918 | * |
| 1919 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1920 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1921 | */ |
| 1922 | |
| 1923 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1924 | 0x03 |
| 1925 | }; |
| 1926 | #define ALC880_F1734_HP_DAC 0x02 |
| 1927 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1928 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1929 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1930 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1931 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1932 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1933 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1934 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1935 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1936 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1937 | { } /* end */ |
| 1938 | }; |
| 1939 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1940 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1941 | .num_items = 2, |
| 1942 | .items = { |
| 1943 | { "Mic", 0x1 }, |
| 1944 | { "CD", 0x4 }, |
| 1945 | }, |
| 1946 | }; |
| 1947 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1948 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1949 | /* |
| 1950 | * ALC880 ASUS model |
| 1951 | * |
| 1952 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1953 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1954 | * Mic = 0x18, Line = 0x1a |
| 1955 | */ |
| 1956 | |
| 1957 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1958 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1959 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1960 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1961 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1962 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1963 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1964 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1965 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1966 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1967 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1968 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1969 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1970 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1971 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1972 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1973 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1974 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1975 | { |
| 1976 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1977 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1978 | .info = alc_ch_mode_info, |
| 1979 | .get = alc_ch_mode_get, |
| 1980 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1981 | }, |
| 1982 | { } /* end */ |
| 1983 | }; |
| 1984 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1985 | /* |
| 1986 | * ALC880 ASUS W1V model |
| 1987 | * |
| 1988 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1989 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1990 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1991 | */ |
| 1992 | |
| 1993 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1994 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1995 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1996 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1997 | { } /* end */ |
| 1998 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1999 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2000 | /* TCL S700 */ |
| 2001 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2002 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2003 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2004 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2005 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2006 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2007 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2008 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2009 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2010 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2011 | { } /* end */ |
| 2012 | }; |
| 2013 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2014 | /* Uniwill */ |
| 2015 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2016 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2017 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2018 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2019 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2020 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2021 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2022 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2023 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2024 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2025 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2026 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2027 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2028 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2029 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2030 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2031 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2032 | { |
| 2033 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2034 | .name = "Channel Mode", |
| 2035 | .info = alc_ch_mode_info, |
| 2036 | .get = alc_ch_mode_get, |
| 2037 | .put = alc_ch_mode_put, |
| 2038 | }, |
| 2039 | { } /* end */ |
| 2040 | }; |
| 2041 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2042 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2043 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2044 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2045 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2046 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2047 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2048 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2049 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2050 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2051 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2052 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2053 | { } /* end */ |
| 2054 | }; |
| 2055 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2056 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2057 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2058 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2059 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2060 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2061 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2062 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2063 | { } /* end */ |
| 2064 | }; |
| 2065 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2066 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2067 | * virtual master controls |
| 2068 | */ |
| 2069 | |
| 2070 | /* |
| 2071 | * slave controls for virtual master |
| 2072 | */ |
| 2073 | static const char *alc_slave_vols[] = { |
| 2074 | "Front Playback Volume", |
| 2075 | "Surround Playback Volume", |
| 2076 | "Center Playback Volume", |
| 2077 | "LFE Playback Volume", |
| 2078 | "Side Playback Volume", |
| 2079 | "Headphone Playback Volume", |
| 2080 | "Speaker Playback Volume", |
| 2081 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2082 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2083 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2084 | NULL, |
| 2085 | }; |
| 2086 | |
| 2087 | static const char *alc_slave_sws[] = { |
| 2088 | "Front Playback Switch", |
| 2089 | "Surround Playback Switch", |
| 2090 | "Center Playback Switch", |
| 2091 | "LFE Playback Switch", |
| 2092 | "Side Playback Switch", |
| 2093 | "Headphone Playback Switch", |
| 2094 | "Speaker Playback Switch", |
| 2095 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2096 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2097 | NULL, |
| 2098 | }; |
| 2099 | |
| 2100 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2101 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2102 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2103 | |
| 2104 | static void alc_free_kctls(struct hda_codec *codec); |
| 2105 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2106 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2107 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2108 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2109 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2110 | { } /* end */ |
| 2111 | }; |
| 2112 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2113 | static int alc_build_controls(struct hda_codec *codec) |
| 2114 | { |
| 2115 | struct alc_spec *spec = codec->spec; |
| 2116 | int err; |
| 2117 | int i; |
| 2118 | |
| 2119 | for (i = 0; i < spec->num_mixers; i++) { |
| 2120 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2121 | if (err < 0) |
| 2122 | return err; |
| 2123 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2124 | if (spec->cap_mixer) { |
| 2125 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2126 | if (err < 0) |
| 2127 | return err; |
| 2128 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2129 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2130 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2131 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2132 | if (err < 0) |
| 2133 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2134 | if (!spec->no_analog) { |
| 2135 | err = snd_hda_create_spdif_share_sw(codec, |
| 2136 | &spec->multiout); |
| 2137 | if (err < 0) |
| 2138 | return err; |
| 2139 | spec->multiout.share_spdif = 1; |
| 2140 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2141 | } |
| 2142 | if (spec->dig_in_nid) { |
| 2143 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2144 | if (err < 0) |
| 2145 | return err; |
| 2146 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2147 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2148 | /* create beep controls if needed */ |
| 2149 | if (spec->beep_amp) { |
| 2150 | struct snd_kcontrol_new *knew; |
| 2151 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2152 | struct snd_kcontrol *kctl; |
| 2153 | kctl = snd_ctl_new1(knew, codec); |
| 2154 | if (!kctl) |
| 2155 | return -ENOMEM; |
| 2156 | kctl->private_value = spec->beep_amp; |
| 2157 | err = snd_hda_ctl_add(codec, kctl); |
| 2158 | if (err < 0) |
| 2159 | return err; |
| 2160 | } |
| 2161 | } |
| 2162 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2163 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2164 | if (!spec->no_analog && |
| 2165 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2166 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2167 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2168 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2169 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2170 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2171 | if (err < 0) |
| 2172 | return err; |
| 2173 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2174 | if (!spec->no_analog && |
| 2175 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2176 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2177 | NULL, alc_slave_sws); |
| 2178 | if (err < 0) |
| 2179 | return err; |
| 2180 | } |
| 2181 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2182 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2183 | return 0; |
| 2184 | } |
| 2185 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2186 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2187 | /* |
| 2188 | * initialize the codec volumes, etc |
| 2189 | */ |
| 2190 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2191 | /* |
| 2192 | * generic initialization of ADC, input mixers and output mixers |
| 2193 | */ |
| 2194 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2195 | /* |
| 2196 | * Unmute ADC0-2 and set the default input to mic-in |
| 2197 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2198 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2199 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2200 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2201 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2202 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2203 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2204 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2205 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2206 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2207 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2208 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2209 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2210 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2211 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2212 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2213 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2214 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2215 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2216 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2217 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2218 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2219 | /* |
| 2220 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2221 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2222 | /* set vol=0 to output mixers */ |
| 2223 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2224 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2225 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2226 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2227 | /* set up input amps for analog loopback */ |
| 2228 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2229 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2231 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2232 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2233 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2234 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2235 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2236 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2237 | |
| 2238 | { } |
| 2239 | }; |
| 2240 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2241 | /* |
| 2242 | * 3-stack pin configuration: |
| 2243 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2244 | */ |
| 2245 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2246 | /* |
| 2247 | * preset connection lists of input pins |
| 2248 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2249 | */ |
| 2250 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2251 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2252 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2253 | |
| 2254 | /* |
| 2255 | * Set pin mode and muting |
| 2256 | */ |
| 2257 | /* set front pin widgets 0x14 for output */ |
| 2258 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2259 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2260 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2261 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2262 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2263 | /* Mic2 (as headphone out) for HP output */ |
| 2264 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2265 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2266 | /* Line In pin widget for input */ |
| 2267 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2268 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2269 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2270 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2271 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2272 | /* CD pin widget for input */ |
| 2273 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2274 | |
| 2275 | { } |
| 2276 | }; |
| 2277 | |
| 2278 | /* |
| 2279 | * 5-stack pin configuration: |
| 2280 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2281 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2282 | */ |
| 2283 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2284 | /* |
| 2285 | * preset connection lists of input pins |
| 2286 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2287 | */ |
| 2288 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2289 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2290 | |
| 2291 | /* |
| 2292 | * Set pin mode and muting |
| 2293 | */ |
| 2294 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2295 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2296 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2297 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2298 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2299 | /* unmute pins for output (no gain on this amp) */ |
| 2300 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2301 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2302 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2303 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2304 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2305 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2306 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2307 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2308 | /* Mic2 (as headphone out) for HP output */ |
| 2309 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2310 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2311 | /* Line In pin widget for input */ |
| 2312 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2313 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2314 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2315 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2316 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2317 | /* CD pin widget for input */ |
| 2318 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2319 | |
| 2320 | { } |
| 2321 | }; |
| 2322 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2323 | /* |
| 2324 | * W810 pin configuration: |
| 2325 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2326 | */ |
| 2327 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2328 | /* hphone/speaker input selector: front DAC */ |
| 2329 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2330 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2331 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2332 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2333 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2334 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2335 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2336 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2337 | |
| 2338 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2339 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2340 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2341 | { } |
| 2342 | }; |
| 2343 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2344 | /* |
| 2345 | * Z71V pin configuration: |
| 2346 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2347 | */ |
| 2348 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2349 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2350 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2351 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2352 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2353 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2354 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2355 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2356 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2357 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2358 | |
| 2359 | { } |
| 2360 | }; |
| 2361 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2362 | /* |
| 2363 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2364 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2365 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2366 | */ |
| 2367 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2368 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2369 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2370 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2371 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2372 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2373 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2374 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2375 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2376 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2377 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2378 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2379 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2380 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2381 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2382 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2383 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2384 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2385 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2386 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2387 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2388 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2389 | { } |
| 2390 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2391 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2392 | /* |
| 2393 | * Uniwill pin configuration: |
| 2394 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2395 | * line = 0x1a |
| 2396 | */ |
| 2397 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2398 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2399 | |
| 2400 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2401 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2402 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2403 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2404 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2405 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2406 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2407 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2408 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2409 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2410 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2411 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2412 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2413 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2414 | |
| 2415 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2416 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2417 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2418 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2419 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2420 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2421 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2422 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2423 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2424 | |
| 2425 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2426 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2427 | |
| 2428 | { } |
| 2429 | }; |
| 2430 | |
| 2431 | /* |
| 2432 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2433 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2434 | */ |
| 2435 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2436 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2437 | |
| 2438 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2439 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2440 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2441 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2442 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2443 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2444 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2445 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2446 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2447 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2448 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2449 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2450 | |
| 2451 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2452 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2453 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2454 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2455 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2456 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2457 | |
| 2458 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2459 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2460 | |
| 2461 | { } |
| 2462 | }; |
| 2463 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2464 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2465 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2466 | { } |
| 2467 | }; |
| 2468 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2469 | /* auto-toggle front mic */ |
| 2470 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2471 | { |
| 2472 | unsigned int present; |
| 2473 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2474 | |
| 2475 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2476 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2477 | bits = present ? HDA_AMP_MUTE : 0; |
| 2478 | 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] | 2479 | } |
| 2480 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2481 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2482 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2483 | struct alc_spec *spec = codec->spec; |
| 2484 | |
| 2485 | spec->autocfg.hp_pins[0] = 0x14; |
| 2486 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2487 | spec->autocfg.speaker_pins[0] = 0x16; |
| 2488 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2489 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2490 | } |
| 2491 | |
| 2492 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2493 | unsigned int res) |
| 2494 | { |
| 2495 | /* Looks like the unsol event is incompatible with the standard |
| 2496 | * definition. 4bit tag is placed at 28 bit! |
| 2497 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2498 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2499 | case ALC880_MIC_EVENT: |
| 2500 | alc880_uniwill_mic_automute(codec); |
| 2501 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2502 | default: |
| 2503 | alc_automute_amp_unsol_event(codec, res); |
| 2504 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2505 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2506 | } |
| 2507 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2508 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2509 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2510 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2511 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2512 | spec->autocfg.hp_pins[0] = 0x14; |
| 2513 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2514 | alc_automute_amp(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2515 | } |
| 2516 | |
| 2517 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2518 | { |
| 2519 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2520 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2521 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2522 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2523 | present &= HDA_AMP_VOLMASK; |
| 2524 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2525 | HDA_AMP_VOLMASK, present); |
| 2526 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2527 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2528 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2529 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2530 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2531 | unsigned int res) |
| 2532 | { |
| 2533 | /* Looks like the unsol event is incompatible with the standard |
| 2534 | * definition. 4bit tag is placed at 28 bit! |
| 2535 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2536 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2537 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2538 | else |
| 2539 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2540 | } |
| 2541 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2542 | /* |
| 2543 | * F1734 pin configuration: |
| 2544 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2545 | */ |
| 2546 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2547 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2548 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2549 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2550 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2551 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2552 | |
| 2553 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2554 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2555 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2556 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2557 | |
| 2558 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2559 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2560 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2561 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2562 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2563 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2564 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2565 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2566 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2567 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2568 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2569 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2570 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2571 | { } |
| 2572 | }; |
| 2573 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2574 | /* |
| 2575 | * ASUS pin configuration: |
| 2576 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2577 | */ |
| 2578 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2579 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2580 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2581 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2582 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2583 | |
| 2584 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2585 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2586 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2587 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2588 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2589 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2590 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2591 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2592 | |
| 2593 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2594 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2595 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2596 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2597 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2598 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2599 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2600 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2601 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2602 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2603 | { } |
| 2604 | }; |
| 2605 | |
| 2606 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2607 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2608 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2609 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2610 | /* Clevo m520g init */ |
| 2611 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2612 | /* headphone output */ |
| 2613 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2614 | /* line-out */ |
| 2615 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2616 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2617 | /* Line-in */ |
| 2618 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2619 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2620 | /* CD */ |
| 2621 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2622 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2623 | /* Mic1 (rear panel) */ |
| 2624 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2625 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2626 | /* Mic2 (front panel) */ |
| 2627 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2628 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2629 | /* headphone */ |
| 2630 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2631 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2632 | /* change to EAPD mode */ |
| 2633 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2634 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2635 | |
| 2636 | { } |
| 2637 | }; |
| 2638 | |
| 2639 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2640 | /* change to EAPD mode */ |
| 2641 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2642 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2643 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2644 | /* Headphone output */ |
| 2645 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2646 | /* Front output*/ |
| 2647 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2648 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2649 | |
| 2650 | /* Line In pin widget for input */ |
| 2651 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2652 | /* CD pin widget for input */ |
| 2653 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2654 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2655 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2656 | |
| 2657 | /* change to EAPD mode */ |
| 2658 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2659 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2660 | |
| 2661 | { } |
| 2662 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2663 | |
| 2664 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2665 | * LG m1 express dual |
| 2666 | * |
| 2667 | * Pin assignment: |
| 2668 | * Rear Line-In/Out (blue): 0x14 |
| 2669 | * Build-in Mic-In: 0x15 |
| 2670 | * Speaker-out: 0x17 |
| 2671 | * HP-Out (green): 0x1b |
| 2672 | * Mic-In/Out (red): 0x19 |
| 2673 | * SPDIF-Out: 0x1e |
| 2674 | */ |
| 2675 | |
| 2676 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2677 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2678 | 0x05, 0x02, 0x03 |
| 2679 | }; |
| 2680 | |
| 2681 | /* seems analog CD is not working */ |
| 2682 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2683 | .num_items = 3, |
| 2684 | .items = { |
| 2685 | { "Mic", 0x1 }, |
| 2686 | { "Line", 0x5 }, |
| 2687 | { "Internal Mic", 0x6 }, |
| 2688 | }, |
| 2689 | }; |
| 2690 | |
| 2691 | /* 2,4,6 channel modes */ |
| 2692 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2693 | /* set line-in and mic-in to input */ |
| 2694 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2695 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2696 | { } |
| 2697 | }; |
| 2698 | |
| 2699 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2700 | /* set line-in to out and mic-in to input */ |
| 2701 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2702 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2703 | { } |
| 2704 | }; |
| 2705 | |
| 2706 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2707 | /* set line-in and mic-in to output */ |
| 2708 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2709 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2710 | { } |
| 2711 | }; |
| 2712 | |
| 2713 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2714 | { 2, alc880_lg_ch2_init }, |
| 2715 | { 4, alc880_lg_ch4_init }, |
| 2716 | { 6, alc880_lg_ch6_init }, |
| 2717 | }; |
| 2718 | |
| 2719 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2720 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2721 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2722 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2723 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2724 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2725 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2726 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2727 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2728 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2729 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2730 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2731 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2732 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2733 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2734 | { |
| 2735 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2736 | .name = "Channel Mode", |
| 2737 | .info = alc_ch_mode_info, |
| 2738 | .get = alc_ch_mode_get, |
| 2739 | .put = alc_ch_mode_put, |
| 2740 | }, |
| 2741 | { } /* end */ |
| 2742 | }; |
| 2743 | |
| 2744 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2745 | /* set capture source to mic-in */ |
| 2746 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2747 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2748 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2749 | /* mute all amp mixer inputs */ |
| 2750 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2751 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2752 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2753 | /* line-in to input */ |
| 2754 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2755 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2756 | /* built-in mic */ |
| 2757 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2758 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2759 | /* speaker-out */ |
| 2760 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2761 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2762 | /* mic-in to input */ |
| 2763 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2764 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2765 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2766 | /* HP-out */ |
| 2767 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2768 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2769 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2770 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2771 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2772 | { } |
| 2773 | }; |
| 2774 | |
| 2775 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2776 | static void alc880_lg_init_hook(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2777 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2778 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2779 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2780 | spec->autocfg.hp_pins[0] = 0x1b; |
| 2781 | spec->autocfg.speaker_pins[0] = 0x17; |
| 2782 | alc_automute_amp(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2783 | } |
| 2784 | |
| 2785 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2786 | * LG LW20 |
| 2787 | * |
| 2788 | * Pin assignment: |
| 2789 | * Speaker-out: 0x14 |
| 2790 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2791 | * Built-in Mic-In: 0x19 |
| 2792 | * Line-In: 0x1b |
| 2793 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2794 | * SPDIF-Out: 0x1e |
| 2795 | */ |
| 2796 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2797 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2798 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2799 | .items = { |
| 2800 | { "Mic", 0x0 }, |
| 2801 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2802 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2803 | }, |
| 2804 | }; |
| 2805 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2806 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2807 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2808 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2809 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2810 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2811 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2812 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2813 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2814 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2815 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2816 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2817 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2818 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2821 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2822 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2823 | { |
| 2824 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2825 | .name = "Channel Mode", |
| 2826 | .info = alc_ch_mode_info, |
| 2827 | .get = alc_ch_mode_get, |
| 2828 | .put = alc_ch_mode_put, |
| 2829 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2830 | { } /* end */ |
| 2831 | }; |
| 2832 | |
| 2833 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2834 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2835 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2836 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2837 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2838 | /* set capture source to mic-in */ |
| 2839 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2840 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2841 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2842 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2843 | /* speaker-out */ |
| 2844 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2845 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2846 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2847 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2848 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2849 | /* mic-in to input */ |
| 2850 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2851 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2852 | /* built-in mic */ |
| 2853 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2854 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2855 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2856 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2857 | { } |
| 2858 | }; |
| 2859 | |
| 2860 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2861 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2862 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2863 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2864 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2865 | spec->autocfg.hp_pins[0] = 0x1b; |
| 2866 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2867 | alc_automute_amp(codec); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2868 | } |
| 2869 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2870 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2871 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2872 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2873 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2874 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2875 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2876 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2877 | { } /* end */ |
| 2878 | }; |
| 2879 | |
| 2880 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2881 | .num_items = 2, |
| 2882 | .items = { |
| 2883 | { "Mic", 0x0 }, |
| 2884 | { "Internal Mic", 0x1 }, |
| 2885 | }, |
| 2886 | }; |
| 2887 | |
| 2888 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2889 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2890 | |
| 2891 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2892 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2893 | |
| 2894 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2895 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2896 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2897 | /* Mic2 (as headphone out) for HP output */ |
| 2898 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2899 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2900 | /* Internal Speaker */ |
| 2901 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2902 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2903 | |
| 2904 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2905 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2906 | |
| 2907 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2908 | { } |
| 2909 | }; |
| 2910 | |
| 2911 | /* toggle speaker-output according to the hp-jack state */ |
| 2912 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2913 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2914 | struct alc_spec *spec = codec->spec; |
| 2915 | alc_automute_amp(codec); |
| 2916 | /* toggle EAPD */ |
| 2917 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2918 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2919 | else |
| 2920 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2921 | } |
| 2922 | |
| 2923 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2924 | unsigned int res) |
| 2925 | { |
| 2926 | /* Looks like the unsol event is incompatible with the standard |
| 2927 | * definition. 4bit tag is placed at 28 bit! |
| 2928 | */ |
| 2929 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2930 | alc880_medion_rim_automute(codec); |
| 2931 | } |
| 2932 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2933 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) |
| 2934 | { |
| 2935 | struct alc_spec *spec = codec->spec; |
| 2936 | |
| 2937 | spec->autocfg.hp_pins[0] = 0x14; |
| 2938 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 2939 | alc880_medion_rim_automute(codec); |
| 2940 | } |
| 2941 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2942 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2943 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2944 | { 0x0b, HDA_INPUT, 0 }, |
| 2945 | { 0x0b, HDA_INPUT, 1 }, |
| 2946 | { 0x0b, HDA_INPUT, 2 }, |
| 2947 | { 0x0b, HDA_INPUT, 3 }, |
| 2948 | { 0x0b, HDA_INPUT, 4 }, |
| 2949 | { } /* end */ |
| 2950 | }; |
| 2951 | |
| 2952 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2953 | { 0x0b, HDA_INPUT, 1 }, |
| 2954 | { 0x0b, HDA_INPUT, 6 }, |
| 2955 | { 0x0b, HDA_INPUT, 7 }, |
| 2956 | { } /* end */ |
| 2957 | }; |
| 2958 | #endif |
| 2959 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2960 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2961 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2962 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2963 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2964 | static int alc_init(struct hda_codec *codec) |
| 2965 | { |
| 2966 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2967 | unsigned int i; |
| 2968 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2969 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 2970 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2971 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2972 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2973 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2974 | |
| 2975 | if (spec->init_hook) |
| 2976 | spec->init_hook(codec); |
| 2977 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2978 | return 0; |
| 2979 | } |
| 2980 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2981 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2982 | { |
| 2983 | struct alc_spec *spec = codec->spec; |
| 2984 | |
| 2985 | if (spec->unsol_event) |
| 2986 | spec->unsol_event(codec, res); |
| 2987 | } |
| 2988 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2989 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2990 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2991 | { |
| 2992 | struct alc_spec *spec = codec->spec; |
| 2993 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2994 | } |
| 2995 | #endif |
| 2996 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2997 | /* |
| 2998 | * Analog playback callbacks |
| 2999 | */ |
| 3000 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3001 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3002 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3003 | { |
| 3004 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3005 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3006 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3007 | } |
| 3008 | |
| 3009 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3010 | struct hda_codec *codec, |
| 3011 | unsigned int stream_tag, |
| 3012 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3013 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3014 | { |
| 3015 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3016 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3017 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3018 | } |
| 3019 | |
| 3020 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3021 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3022 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3023 | { |
| 3024 | struct alc_spec *spec = codec->spec; |
| 3025 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3026 | } |
| 3027 | |
| 3028 | /* |
| 3029 | * Digital out |
| 3030 | */ |
| 3031 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3032 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3033 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3034 | { |
| 3035 | struct alc_spec *spec = codec->spec; |
| 3036 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3037 | } |
| 3038 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3039 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3040 | struct hda_codec *codec, |
| 3041 | unsigned int stream_tag, |
| 3042 | unsigned int format, |
| 3043 | struct snd_pcm_substream *substream) |
| 3044 | { |
| 3045 | struct alc_spec *spec = codec->spec; |
| 3046 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3047 | stream_tag, format, substream); |
| 3048 | } |
| 3049 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3050 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3051 | struct hda_codec *codec, |
| 3052 | struct snd_pcm_substream *substream) |
| 3053 | { |
| 3054 | struct alc_spec *spec = codec->spec; |
| 3055 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3056 | } |
| 3057 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3058 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3059 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3060 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3061 | { |
| 3062 | struct alc_spec *spec = codec->spec; |
| 3063 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3064 | } |
| 3065 | |
| 3066 | /* |
| 3067 | * Analog capture |
| 3068 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3069 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3070 | struct hda_codec *codec, |
| 3071 | unsigned int stream_tag, |
| 3072 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3073 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3074 | { |
| 3075 | struct alc_spec *spec = codec->spec; |
| 3076 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3077 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3078 | stream_tag, 0, format); |
| 3079 | return 0; |
| 3080 | } |
| 3081 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3082 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3083 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3084 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3085 | { |
| 3086 | struct alc_spec *spec = codec->spec; |
| 3087 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3088 | snd_hda_codec_cleanup_stream(codec, |
| 3089 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3090 | return 0; |
| 3091 | } |
| 3092 | |
| 3093 | |
| 3094 | /* |
| 3095 | */ |
| 3096 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3097 | .substreams = 1, |
| 3098 | .channels_min = 2, |
| 3099 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3100 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3101 | .ops = { |
| 3102 | .open = alc880_playback_pcm_open, |
| 3103 | .prepare = alc880_playback_pcm_prepare, |
| 3104 | .cleanup = alc880_playback_pcm_cleanup |
| 3105 | }, |
| 3106 | }; |
| 3107 | |
| 3108 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3109 | .substreams = 1, |
| 3110 | .channels_min = 2, |
| 3111 | .channels_max = 2, |
| 3112 | /* NID is set in alc_build_pcms */ |
| 3113 | }; |
| 3114 | |
| 3115 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3116 | .substreams = 1, |
| 3117 | .channels_min = 2, |
| 3118 | .channels_max = 2, |
| 3119 | /* NID is set in alc_build_pcms */ |
| 3120 | }; |
| 3121 | |
| 3122 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3123 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3124 | .channels_min = 2, |
| 3125 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3126 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3127 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3128 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3129 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3130 | }, |
| 3131 | }; |
| 3132 | |
| 3133 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3134 | .substreams = 1, |
| 3135 | .channels_min = 2, |
| 3136 | .channels_max = 2, |
| 3137 | /* NID is set in alc_build_pcms */ |
| 3138 | .ops = { |
| 3139 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3140 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3141 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3142 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3143 | }, |
| 3144 | }; |
| 3145 | |
| 3146 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3147 | .substreams = 1, |
| 3148 | .channels_min = 2, |
| 3149 | .channels_max = 2, |
| 3150 | /* NID is set in alc_build_pcms */ |
| 3151 | }; |
| 3152 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3153 | /* 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] | 3154 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3155 | .substreams = 0, |
| 3156 | .channels_min = 0, |
| 3157 | .channels_max = 0, |
| 3158 | }; |
| 3159 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3160 | static int alc_build_pcms(struct hda_codec *codec) |
| 3161 | { |
| 3162 | struct alc_spec *spec = codec->spec; |
| 3163 | struct hda_pcm *info = spec->pcm_rec; |
| 3164 | int i; |
| 3165 | |
| 3166 | codec->num_pcms = 1; |
| 3167 | codec->pcm_info = info; |
| 3168 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3169 | if (spec->no_analog) |
| 3170 | goto skip_analog; |
| 3171 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3172 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3173 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3174 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3175 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3176 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3177 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3178 | } |
| 3179 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3180 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3181 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3182 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3183 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3184 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3185 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3186 | if (spec->channel_mode) { |
| 3187 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3188 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3189 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3190 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3191 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3192 | } |
| 3193 | } |
| 3194 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3195 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3196 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3197 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3198 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3199 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3200 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3201 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3202 | if (spec->dig_out_type) |
| 3203 | info->pcm_type = spec->dig_out_type; |
| 3204 | else |
| 3205 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3206 | if (spec->multiout.dig_out_nid && |
| 3207 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3208 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3209 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3210 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3211 | if (spec->dig_in_nid && |
| 3212 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3213 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3214 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3215 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3216 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3217 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3218 | } |
| 3219 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3220 | if (spec->no_analog) |
| 3221 | return 0; |
| 3222 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3223 | /* If the use of more than one ADC is requested for the current |
| 3224 | * model, configure a second analog capture-only PCM. |
| 3225 | */ |
| 3226 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3227 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3228 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3229 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3230 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3231 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3232 | if (spec->alt_dac_nid) { |
| 3233 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3234 | *spec->stream_analog_alt_playback; |
| 3235 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3236 | spec->alt_dac_nid; |
| 3237 | } else { |
| 3238 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3239 | alc_pcm_null_stream; |
| 3240 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3241 | } |
| 3242 | if (spec->num_adc_nids > 1) { |
| 3243 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3244 | *spec->stream_analog_alt_capture; |
| 3245 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3246 | spec->adc_nids[1]; |
| 3247 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3248 | spec->num_adc_nids - 1; |
| 3249 | } else { |
| 3250 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3251 | alc_pcm_null_stream; |
| 3252 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3253 | } |
| 3254 | } |
| 3255 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3256 | return 0; |
| 3257 | } |
| 3258 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3259 | static void alc_free_kctls(struct hda_codec *codec) |
| 3260 | { |
| 3261 | struct alc_spec *spec = codec->spec; |
| 3262 | |
| 3263 | if (spec->kctls.list) { |
| 3264 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3265 | int i; |
| 3266 | for (i = 0; i < spec->kctls.used; i++) |
| 3267 | kfree(kctl[i].name); |
| 3268 | } |
| 3269 | snd_array_free(&spec->kctls); |
| 3270 | } |
| 3271 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3272 | static void alc_free(struct hda_codec *codec) |
| 3273 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3274 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3275 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3276 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3277 | return; |
| 3278 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3279 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3280 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3281 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3282 | } |
| 3283 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3284 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3285 | static int alc_resume(struct hda_codec *codec) |
| 3286 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3287 | codec->patch_ops.init(codec); |
| 3288 | snd_hda_codec_resume_amp(codec); |
| 3289 | snd_hda_codec_resume_cache(codec); |
| 3290 | return 0; |
| 3291 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3292 | #endif |
| 3293 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3294 | /* |
| 3295 | */ |
| 3296 | static struct hda_codec_ops alc_patch_ops = { |
| 3297 | .build_controls = alc_build_controls, |
| 3298 | .build_pcms = alc_build_pcms, |
| 3299 | .init = alc_init, |
| 3300 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3301 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3302 | #ifdef SND_HDA_NEEDS_RESUME |
| 3303 | .resume = alc_resume, |
| 3304 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3305 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3306 | .check_power_status = alc_check_power_status, |
| 3307 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3308 | }; |
| 3309 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3310 | |
| 3311 | /* |
| 3312 | * Test configuration for debugging |
| 3313 | * |
| 3314 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3315 | * enum controls. |
| 3316 | */ |
| 3317 | #ifdef CONFIG_SND_DEBUG |
| 3318 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3319 | 0x02, 0x03, 0x04, 0x05 |
| 3320 | }; |
| 3321 | |
| 3322 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3323 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3324 | .items = { |
| 3325 | { "In-1", 0x0 }, |
| 3326 | { "In-2", 0x1 }, |
| 3327 | { "In-3", 0x2 }, |
| 3328 | { "In-4", 0x3 }, |
| 3329 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3330 | { "Front", 0x5 }, |
| 3331 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3332 | }, |
| 3333 | }; |
| 3334 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3335 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3336 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3337 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3338 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3339 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3340 | }; |
| 3341 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3342 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3343 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3344 | { |
| 3345 | static char *texts[] = { |
| 3346 | "N/A", "Line Out", "HP Out", |
| 3347 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3348 | }; |
| 3349 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3350 | uinfo->count = 1; |
| 3351 | uinfo->value.enumerated.items = 8; |
| 3352 | if (uinfo->value.enumerated.item >= 8) |
| 3353 | uinfo->value.enumerated.item = 7; |
| 3354 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3355 | return 0; |
| 3356 | } |
| 3357 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3358 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3359 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3360 | { |
| 3361 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3362 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3363 | unsigned int pin_ctl, item = 0; |
| 3364 | |
| 3365 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3366 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3367 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3368 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3369 | item = 2; |
| 3370 | else |
| 3371 | item = 1; |
| 3372 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3373 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3374 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3375 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3376 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3377 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3378 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3379 | } |
| 3380 | } |
| 3381 | ucontrol->value.enumerated.item[0] = item; |
| 3382 | return 0; |
| 3383 | } |
| 3384 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3385 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3386 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3387 | { |
| 3388 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3389 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3390 | static unsigned int ctls[] = { |
| 3391 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3392 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3393 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3394 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3395 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3396 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3397 | }; |
| 3398 | unsigned int old_ctl, new_ctl; |
| 3399 | |
| 3400 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3401 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3402 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3403 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3404 | int val; |
| 3405 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3406 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3407 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3408 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3409 | HDA_AMP_MUTE : 0; |
| 3410 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3411 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3412 | return 1; |
| 3413 | } |
| 3414 | return 0; |
| 3415 | } |
| 3416 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3417 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3418 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3419 | { |
| 3420 | static char *texts[] = { |
| 3421 | "Front", "Surround", "CLFE", "Side" |
| 3422 | }; |
| 3423 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3424 | uinfo->count = 1; |
| 3425 | uinfo->value.enumerated.items = 4; |
| 3426 | if (uinfo->value.enumerated.item >= 4) |
| 3427 | uinfo->value.enumerated.item = 3; |
| 3428 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3429 | return 0; |
| 3430 | } |
| 3431 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3432 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3433 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3434 | { |
| 3435 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3436 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3437 | unsigned int sel; |
| 3438 | |
| 3439 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3440 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3441 | return 0; |
| 3442 | } |
| 3443 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3444 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3445 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3446 | { |
| 3447 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3448 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3449 | unsigned int sel; |
| 3450 | |
| 3451 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3452 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3453 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3454 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3455 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3456 | return 1; |
| 3457 | } |
| 3458 | return 0; |
| 3459 | } |
| 3460 | |
| 3461 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3462 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3463 | .name = xname, \ |
| 3464 | .info = alc_test_pin_ctl_info, \ |
| 3465 | .get = alc_test_pin_ctl_get, \ |
| 3466 | .put = alc_test_pin_ctl_put, \ |
| 3467 | .private_value = nid \ |
| 3468 | } |
| 3469 | |
| 3470 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3471 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3472 | .name = xname, \ |
| 3473 | .info = alc_test_pin_src_info, \ |
| 3474 | .get = alc_test_pin_src_get, \ |
| 3475 | .put = alc_test_pin_src_put, \ |
| 3476 | .private_value = nid \ |
| 3477 | } |
| 3478 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3479 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3480 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3481 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3482 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3483 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3484 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3485 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3486 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3487 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3488 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3489 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3490 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3491 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3492 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3493 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3494 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3495 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3496 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3497 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3498 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3499 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3500 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3501 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3502 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3503 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3504 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3505 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3506 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3507 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3508 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3509 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3510 | { |
| 3511 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3512 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3513 | .info = alc_ch_mode_info, |
| 3514 | .get = alc_ch_mode_get, |
| 3515 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3516 | }, |
| 3517 | { } /* end */ |
| 3518 | }; |
| 3519 | |
| 3520 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3521 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3522 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3523 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3524 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3525 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3526 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3527 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3528 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3529 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3530 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3531 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3532 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3533 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3534 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3535 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3536 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3537 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3538 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3539 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3540 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3541 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3542 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3543 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3544 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3545 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3546 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3547 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3548 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3549 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3550 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3551 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3552 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3553 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3554 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3555 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3556 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3557 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3558 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3559 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3560 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3561 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3562 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3563 | /* Analog input/passthru */ |
| 3564 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3565 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3566 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3567 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3569 | { } |
| 3570 | }; |
| 3571 | #endif |
| 3572 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3573 | /* |
| 3574 | */ |
| 3575 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3576 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3577 | [ALC880_3ST] = "3stack", |
| 3578 | [ALC880_TCL_S700] = "tcl", |
| 3579 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3580 | [ALC880_CLEVO] = "clevo", |
| 3581 | [ALC880_5ST] = "5stack", |
| 3582 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3583 | [ALC880_W810] = "w810", |
| 3584 | [ALC880_Z71V] = "z71v", |
| 3585 | [ALC880_6ST] = "6stack", |
| 3586 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3587 | [ALC880_ASUS] = "asus", |
| 3588 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3589 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3590 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3591 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3592 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3593 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3594 | [ALC880_F1734] = "F1734", |
| 3595 | [ALC880_LG] = "lg", |
| 3596 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3597 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3598 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3599 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3600 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3601 | [ALC880_AUTO] = "auto", |
| 3602 | }; |
| 3603 | |
| 3604 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3605 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3606 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3607 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3608 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3609 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3610 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3611 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3612 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3613 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3614 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3615 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3616 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3617 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3618 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3619 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3620 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3621 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3622 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3623 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3624 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3625 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3626 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3627 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3628 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3629 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3630 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3631 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3632 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3633 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3634 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3635 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3636 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3637 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3638 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3639 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3640 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3641 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3642 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3643 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3644 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3645 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3646 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3647 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3648 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3649 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3650 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3651 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3652 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3653 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3654 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3655 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3656 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3657 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3658 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3659 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3660 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3661 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3662 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3663 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3664 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3665 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3666 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3667 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3668 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3669 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3670 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3671 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3672 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3673 | /* default Intel */ |
| 3674 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3675 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3676 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3677 | {} |
| 3678 | }; |
| 3679 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3680 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3681 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3682 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3683 | static struct alc_config_preset alc880_presets[] = { |
| 3684 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3685 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3686 | .init_verbs = { alc880_volume_init_verbs, |
| 3687 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3688 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3689 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3690 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3691 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3692 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3693 | .input_mux = &alc880_capture_source, |
| 3694 | }, |
| 3695 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3696 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3697 | .init_verbs = { alc880_volume_init_verbs, |
| 3698 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3699 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3700 | .dac_nids = alc880_dac_nids, |
| 3701 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3702 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3703 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3704 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3705 | .input_mux = &alc880_capture_source, |
| 3706 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3707 | [ALC880_TCL_S700] = { |
| 3708 | .mixers = { alc880_tcl_s700_mixer }, |
| 3709 | .init_verbs = { alc880_volume_init_verbs, |
| 3710 | alc880_pin_tcl_S700_init_verbs, |
| 3711 | alc880_gpio2_init_verbs }, |
| 3712 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3713 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3714 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3715 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3716 | .hp_nid = 0x03, |
| 3717 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3718 | .channel_mode = alc880_2_jack_modes, |
| 3719 | .input_mux = &alc880_capture_source, |
| 3720 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3721 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3722 | .mixers = { alc880_three_stack_mixer, |
| 3723 | alc880_five_stack_mixer}, |
| 3724 | .init_verbs = { alc880_volume_init_verbs, |
| 3725 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3726 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3727 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3728 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3729 | .channel_mode = alc880_fivestack_modes, |
| 3730 | .input_mux = &alc880_capture_source, |
| 3731 | }, |
| 3732 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3733 | .mixers = { alc880_three_stack_mixer, |
| 3734 | alc880_five_stack_mixer }, |
| 3735 | .init_verbs = { alc880_volume_init_verbs, |
| 3736 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3737 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3738 | .dac_nids = alc880_dac_nids, |
| 3739 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3740 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3741 | .channel_mode = alc880_fivestack_modes, |
| 3742 | .input_mux = &alc880_capture_source, |
| 3743 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3744 | [ALC880_6ST] = { |
| 3745 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3746 | .init_verbs = { alc880_volume_init_verbs, |
| 3747 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3748 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3749 | .dac_nids = alc880_6st_dac_nids, |
| 3750 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3751 | .channel_mode = alc880_sixstack_modes, |
| 3752 | .input_mux = &alc880_6stack_capture_source, |
| 3753 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3754 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3755 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3756 | .init_verbs = { alc880_volume_init_verbs, |
| 3757 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3758 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3759 | .dac_nids = alc880_6st_dac_nids, |
| 3760 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3761 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3762 | .channel_mode = alc880_sixstack_modes, |
| 3763 | .input_mux = &alc880_6stack_capture_source, |
| 3764 | }, |
| 3765 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3766 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3767 | .init_verbs = { alc880_volume_init_verbs, |
| 3768 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3769 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3770 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3771 | .dac_nids = alc880_w810_dac_nids, |
| 3772 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3773 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3774 | .channel_mode = alc880_w810_modes, |
| 3775 | .input_mux = &alc880_capture_source, |
| 3776 | }, |
| 3777 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3778 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3779 | .init_verbs = { alc880_volume_init_verbs, |
| 3780 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3781 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3782 | .dac_nids = alc880_z71v_dac_nids, |
| 3783 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3784 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3785 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3786 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3787 | .input_mux = &alc880_capture_source, |
| 3788 | }, |
| 3789 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3790 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3791 | .init_verbs = { alc880_volume_init_verbs, |
| 3792 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3793 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3794 | .dac_nids = alc880_f1734_dac_nids, |
| 3795 | .hp_nid = 0x02, |
| 3796 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3797 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3798 | .input_mux = &alc880_f1734_capture_source, |
| 3799 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3800 | .init_hook = alc880_uniwill_p53_init_hook, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3801 | }, |
| 3802 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3803 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3804 | .init_verbs = { alc880_volume_init_verbs, |
| 3805 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3806 | alc880_gpio1_init_verbs }, |
| 3807 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3808 | .dac_nids = alc880_asus_dac_nids, |
| 3809 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3810 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3811 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3812 | .input_mux = &alc880_capture_source, |
| 3813 | }, |
| 3814 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3815 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3816 | .init_verbs = { alc880_volume_init_verbs, |
| 3817 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3818 | alc880_gpio1_init_verbs }, |
| 3819 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3820 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3821 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3822 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3823 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3824 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3825 | .input_mux = &alc880_capture_source, |
| 3826 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3827 | [ALC880_ASUS_DIG2] = { |
| 3828 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3829 | .init_verbs = { alc880_volume_init_verbs, |
| 3830 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3831 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3832 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3833 | .dac_nids = alc880_asus_dac_nids, |
| 3834 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3835 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3836 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3837 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3838 | .input_mux = &alc880_capture_source, |
| 3839 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3840 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3841 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3842 | .init_verbs = { alc880_volume_init_verbs, |
| 3843 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3844 | alc880_gpio1_init_verbs }, |
| 3845 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3846 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3847 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3848 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3849 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3850 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3851 | .input_mux = &alc880_capture_source, |
| 3852 | }, |
| 3853 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3854 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3855 | .init_verbs = { alc880_volume_init_verbs, |
| 3856 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3857 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3858 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3859 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3860 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3861 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3862 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3863 | .input_mux = &alc880_capture_source, |
| 3864 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3865 | [ALC880_UNIWILL] = { |
| 3866 | .mixers = { alc880_uniwill_mixer }, |
| 3867 | .init_verbs = { alc880_volume_init_verbs, |
| 3868 | alc880_uniwill_init_verbs }, |
| 3869 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3870 | .dac_nids = alc880_asus_dac_nids, |
| 3871 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3872 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3873 | .channel_mode = alc880_threestack_modes, |
| 3874 | .need_dac_fix = 1, |
| 3875 | .input_mux = &alc880_capture_source, |
| 3876 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3877 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3878 | }, |
| 3879 | [ALC880_UNIWILL_P53] = { |
| 3880 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3881 | .init_verbs = { alc880_volume_init_verbs, |
| 3882 | alc880_uniwill_p53_init_verbs }, |
| 3883 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3884 | .dac_nids = alc880_asus_dac_nids, |
| 3885 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3886 | .channel_mode = alc880_threestack_modes, |
| 3887 | .input_mux = &alc880_capture_source, |
| 3888 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3889 | .init_hook = alc880_uniwill_p53_init_hook, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3890 | }, |
| 3891 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3892 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3893 | .init_verbs = { alc880_volume_init_verbs, |
| 3894 | alc880_uniwill_p53_init_verbs, |
| 3895 | alc880_beep_init_verbs }, |
| 3896 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3897 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3898 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3899 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3900 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3901 | .input_mux = &alc880_capture_source, |
| 3902 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3903 | .init_hook = alc880_uniwill_p53_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3904 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3905 | [ALC880_CLEVO] = { |
| 3906 | .mixers = { alc880_three_stack_mixer }, |
| 3907 | .init_verbs = { alc880_volume_init_verbs, |
| 3908 | alc880_pin_clevo_init_verbs }, |
| 3909 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3910 | .dac_nids = alc880_dac_nids, |
| 3911 | .hp_nid = 0x03, |
| 3912 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3913 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3914 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3915 | .input_mux = &alc880_capture_source, |
| 3916 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3917 | [ALC880_LG] = { |
| 3918 | .mixers = { alc880_lg_mixer }, |
| 3919 | .init_verbs = { alc880_volume_init_verbs, |
| 3920 | alc880_lg_init_verbs }, |
| 3921 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3922 | .dac_nids = alc880_lg_dac_nids, |
| 3923 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3924 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3925 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3926 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3927 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3928 | .unsol_event = alc_automute_amp_unsol_event, |
| 3929 | .init_hook = alc880_lg_init_hook, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3930 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3931 | .loopbacks = alc880_lg_loopbacks, |
| 3932 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3933 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3934 | [ALC880_LG_LW] = { |
| 3935 | .mixers = { alc880_lg_lw_mixer }, |
| 3936 | .init_verbs = { alc880_volume_init_verbs, |
| 3937 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3938 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3939 | .dac_nids = alc880_dac_nids, |
| 3940 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3941 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3942 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3943 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3944 | .unsol_event = alc_automute_amp_unsol_event, |
| 3945 | .init_hook = alc880_lg_lw_init_hook, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3946 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3947 | [ALC880_MEDION_RIM] = { |
| 3948 | .mixers = { alc880_medion_rim_mixer }, |
| 3949 | .init_verbs = { alc880_volume_init_verbs, |
| 3950 | alc880_medion_rim_init_verbs, |
| 3951 | alc_gpio2_init_verbs }, |
| 3952 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3953 | .dac_nids = alc880_dac_nids, |
| 3954 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3955 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3956 | .channel_mode = alc880_2_jack_modes, |
| 3957 | .input_mux = &alc880_medion_rim_capture_source, |
| 3958 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3959 | .init_hook = alc880_medion_rim_init_hook, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3960 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3961 | #ifdef CONFIG_SND_DEBUG |
| 3962 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3963 | .mixers = { alc880_test_mixer }, |
| 3964 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3965 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3966 | .dac_nids = alc880_test_dac_nids, |
| 3967 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3968 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3969 | .channel_mode = alc880_test_modes, |
| 3970 | .input_mux = &alc880_test_capture_source, |
| 3971 | }, |
| 3972 | #endif |
| 3973 | }; |
| 3974 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3975 | /* |
| 3976 | * Automatic parse of I/O pins from the BIOS configuration |
| 3977 | */ |
| 3978 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3979 | enum { |
| 3980 | ALC_CTL_WIDGET_VOL, |
| 3981 | ALC_CTL_WIDGET_MUTE, |
| 3982 | ALC_CTL_BIND_MUTE, |
| 3983 | }; |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3984 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3985 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3986 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3987 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3988 | }; |
| 3989 | |
| 3990 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3991 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3992 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3993 | { |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3994 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3995 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3996 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 3997 | knew = snd_array_new(&spec->kctls); |
| 3998 | if (!knew) |
| 3999 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4000 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4001 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4002 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4003 | return -ENOMEM; |
| 4004 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4005 | return 0; |
| 4006 | } |
| 4007 | |
| 4008 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4009 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4010 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4011 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4012 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4013 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4014 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4015 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4016 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4017 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4018 | #define ALC880_PIN_CD_NID 0x1c |
| 4019 | |
| 4020 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4021 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4022 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4023 | { |
| 4024 | hda_nid_t nid; |
| 4025 | int assigned[4]; |
| 4026 | int i, j; |
| 4027 | |
| 4028 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4029 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4030 | |
| 4031 | /* check the pins hardwired to audio widget */ |
| 4032 | for (i = 0; i < cfg->line_outs; i++) { |
| 4033 | nid = cfg->line_out_pins[i]; |
| 4034 | if (alc880_is_fixed_pin(nid)) { |
| 4035 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4036 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4037 | assigned[idx] = 1; |
| 4038 | } |
| 4039 | } |
| 4040 | /* left pins can be connect to any audio widget */ |
| 4041 | for (i = 0; i < cfg->line_outs; i++) { |
| 4042 | nid = cfg->line_out_pins[i]; |
| 4043 | if (alc880_is_fixed_pin(nid)) |
| 4044 | continue; |
| 4045 | /* search for an empty channel */ |
| 4046 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4047 | if (!assigned[j]) { |
| 4048 | spec->multiout.dac_nids[i] = |
| 4049 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4050 | assigned[j] = 1; |
| 4051 | break; |
| 4052 | } |
| 4053 | } |
| 4054 | } |
| 4055 | spec->multiout.num_dacs = cfg->line_outs; |
| 4056 | return 0; |
| 4057 | } |
| 4058 | |
| 4059 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4060 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4061 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4062 | { |
| 4063 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4064 | static const char *chname[4] = { |
| 4065 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4066 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4067 | hda_nid_t nid; |
| 4068 | int i, err; |
| 4069 | |
| 4070 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4071 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4072 | continue; |
| 4073 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4074 | if (i == 2) { |
| 4075 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4076 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4077 | "Center Playback Volume", |
| 4078 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4079 | HDA_OUTPUT)); |
| 4080 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4081 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4082 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4083 | "LFE Playback Volume", |
| 4084 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4085 | HDA_OUTPUT)); |
| 4086 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4087 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4088 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4089 | "Center Playback Switch", |
| 4090 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4091 | HDA_INPUT)); |
| 4092 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4093 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4094 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4095 | "LFE Playback Switch", |
| 4096 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4097 | HDA_INPUT)); |
| 4098 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4099 | return err; |
| 4100 | } else { |
| 4101 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4102 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4103 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4104 | HDA_OUTPUT)); |
| 4105 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4106 | return err; |
| 4107 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4108 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4109 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4110 | HDA_INPUT)); |
| 4111 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4112 | return err; |
| 4113 | } |
| 4114 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4115 | return 0; |
| 4116 | } |
| 4117 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4118 | /* add playback controls for speaker and HP outputs */ |
| 4119 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4120 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4121 | { |
| 4122 | hda_nid_t nid; |
| 4123 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4124 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4125 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4126 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4127 | return 0; |
| 4128 | |
| 4129 | if (alc880_is_fixed_pin(pin)) { |
| 4130 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4131 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4132 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4133 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4134 | else |
| 4135 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4136 | /* control HP volume/switch on the output mixer amp */ |
| 4137 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4138 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4139 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4140 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4141 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4142 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4143 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4144 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4145 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4146 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4147 | return err; |
| 4148 | } else if (alc880_is_multi_pin(pin)) { |
| 4149 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4150 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4151 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4152 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4153 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4154 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4155 | return err; |
| 4156 | } |
| 4157 | return 0; |
| 4158 | } |
| 4159 | |
| 4160 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4161 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4162 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4163 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4164 | { |
| 4165 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4166 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4167 | |
| 4168 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4169 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4170 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4171 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4172 | return err; |
| 4173 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4174 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4175 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4176 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4177 | return err; |
| 4178 | return 0; |
| 4179 | } |
| 4180 | |
| 4181 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4182 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4183 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4184 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4185 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4186 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4187 | |
| 4188 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4189 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4190 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4191 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4192 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4193 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4194 | if (err < 0) |
| 4195 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4196 | imux->items[imux->num_items].label = |
| 4197 | auto_pin_cfg_labels[i]; |
| 4198 | imux->items[imux->num_items].index = |
| 4199 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4200 | imux->num_items++; |
| 4201 | } |
| 4202 | } |
| 4203 | return 0; |
| 4204 | } |
| 4205 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4206 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4207 | unsigned int pin_type) |
| 4208 | { |
| 4209 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4210 | pin_type); |
| 4211 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4212 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4213 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4214 | } |
| 4215 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4216 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4217 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4218 | int dac_idx) |
| 4219 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4220 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4221 | /* need the manual connection? */ |
| 4222 | if (alc880_is_multi_pin(nid)) { |
| 4223 | struct alc_spec *spec = codec->spec; |
| 4224 | int idx = alc880_multi_pin_idx(nid); |
| 4225 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4226 | AC_VERB_SET_CONNECT_SEL, |
| 4227 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4228 | } |
| 4229 | } |
| 4230 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4231 | static int get_pin_type(int line_out_type) |
| 4232 | { |
| 4233 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4234 | return PIN_HP; |
| 4235 | else |
| 4236 | return PIN_OUT; |
| 4237 | } |
| 4238 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4239 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4240 | { |
| 4241 | struct alc_spec *spec = codec->spec; |
| 4242 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4243 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4244 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4245 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4246 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4247 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4248 | } |
| 4249 | } |
| 4250 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4251 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4252 | { |
| 4253 | struct alc_spec *spec = codec->spec; |
| 4254 | hda_nid_t pin; |
| 4255 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4256 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4257 | if (pin) /* connect to front */ |
| 4258 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4259 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4260 | if (pin) /* connect to front */ |
| 4261 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4262 | } |
| 4263 | |
| 4264 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4265 | { |
| 4266 | struct alc_spec *spec = codec->spec; |
| 4267 | int i; |
| 4268 | |
| 4269 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4270 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4271 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4272 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4273 | if (nid != ALC880_PIN_CD_NID && |
| 4274 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4275 | snd_hda_codec_write(codec, nid, 0, |
| 4276 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4277 | AMP_OUT_MUTE); |
| 4278 | } |
| 4279 | } |
| 4280 | } |
| 4281 | |
| 4282 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4283 | /* return 1 if successful, 0 if the proper config is not found, |
| 4284 | * or a negative error code |
| 4285 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4286 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4287 | { |
| 4288 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4289 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4290 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4291 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4292 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4293 | alc880_ignore); |
| 4294 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4295 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4296 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4297 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4298 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4299 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4300 | if (err < 0) |
| 4301 | return err; |
| 4302 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4303 | if (err < 0) |
| 4304 | return err; |
| 4305 | err = alc880_auto_create_extra_out(spec, |
| 4306 | spec->autocfg.speaker_pins[0], |
| 4307 | "Speaker"); |
| 4308 | if (err < 0) |
| 4309 | return err; |
| 4310 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4311 | "Headphone"); |
| 4312 | if (err < 0) |
| 4313 | return err; |
| 4314 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4315 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4316 | return err; |
| 4317 | |
| 4318 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4319 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4320 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4321 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4322 | hda_nid_t dig_nid; |
| 4323 | err = snd_hda_get_connections(codec, |
| 4324 | spec->autocfg.dig_out_pins[i], |
| 4325 | &dig_nid, 1); |
| 4326 | if (err < 0) |
| 4327 | continue; |
| 4328 | if (!i) |
| 4329 | spec->multiout.dig_out_nid = dig_nid; |
| 4330 | else { |
| 4331 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4332 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4333 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4334 | break; |
| 4335 | } |
| 4336 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4337 | if (spec->autocfg.dig_in_pin) |
| 4338 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4339 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4340 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4341 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4342 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4343 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4344 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4345 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4346 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4347 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4348 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4349 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4350 | return 1; |
| 4351 | } |
| 4352 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4353 | /* additional initialization for auto-configuration model */ |
| 4354 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4355 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4356 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4358 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4359 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4360 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4361 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4362 | } |
| 4363 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4364 | static void set_capture_mixer(struct alc_spec *spec) |
| 4365 | { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4366 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4367 | { alc_capture_mixer_nosrc1, |
| 4368 | alc_capture_mixer_nosrc2, |
| 4369 | alc_capture_mixer_nosrc3 }, |
| 4370 | { alc_capture_mixer1, |
| 4371 | alc_capture_mixer2, |
| 4372 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4373 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4374 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4375 | int mux; |
| 4376 | if (spec->input_mux && spec->input_mux->num_items > 1) |
| 4377 | mux = 1; |
| 4378 | else |
| 4379 | mux = 0; |
| 4380 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4381 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4382 | } |
| 4383 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4384 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4385 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4386 | |
| 4387 | /* |
| 4388 | * OK, here we have finally the patch for ALC880 |
| 4389 | */ |
| 4390 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4391 | static int patch_alc880(struct hda_codec *codec) |
| 4392 | { |
| 4393 | struct alc_spec *spec; |
| 4394 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4395 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4396 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4397 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4398 | if (spec == NULL) |
| 4399 | return -ENOMEM; |
| 4400 | |
| 4401 | codec->spec = spec; |
| 4402 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4403 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4404 | alc880_models, |
| 4405 | alc880_cfg_tbl); |
| 4406 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4407 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 4408 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4409 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4410 | } |
| 4411 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4412 | if (board_config == ALC880_AUTO) { |
| 4413 | /* automatic parse from the BIOS config */ |
| 4414 | err = alc880_parse_auto_config(codec); |
| 4415 | if (err < 0) { |
| 4416 | alc_free(codec); |
| 4417 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4418 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4419 | printk(KERN_INFO |
| 4420 | "hda_codec: Cannot set up configuration " |
| 4421 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4422 | board_config = ALC880_3ST; |
| 4423 | } |
| 4424 | } |
| 4425 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4426 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4427 | if (err < 0) { |
| 4428 | alc_free(codec); |
| 4429 | return err; |
| 4430 | } |
| 4431 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4432 | if (board_config != ALC880_AUTO) |
| 4433 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4434 | |
| 4435 | spec->stream_name_analog = "ALC880 Analog"; |
| 4436 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4437 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4438 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4439 | |
| 4440 | spec->stream_name_digital = "ALC880 Digital"; |
| 4441 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4442 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4443 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4444 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4445 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4446 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4447 | /* get type */ |
| 4448 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4449 | if (wcap != AC_WID_AUD_IN) { |
| 4450 | spec->adc_nids = alc880_adc_nids_alt; |
| 4451 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4452 | } else { |
| 4453 | spec->adc_nids = alc880_adc_nids; |
| 4454 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4455 | } |
| 4456 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4457 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4458 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4459 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4460 | spec->vmaster_nid = 0x0c; |
| 4461 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4462 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4463 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4464 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4465 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4466 | if (!spec->loopback.amplist) |
| 4467 | spec->loopback.amplist = alc880_loopbacks; |
| 4468 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4469 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4470 | |
| 4471 | return 0; |
| 4472 | } |
| 4473 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4474 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4475 | /* |
| 4476 | * ALC260 support |
| 4477 | */ |
| 4478 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4479 | static hda_nid_t alc260_dac_nids[1] = { |
| 4480 | /* front */ |
| 4481 | 0x02, |
| 4482 | }; |
| 4483 | |
| 4484 | static hda_nid_t alc260_adc_nids[1] = { |
| 4485 | /* ADC0 */ |
| 4486 | 0x04, |
| 4487 | }; |
| 4488 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4489 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4490 | /* ADC1 */ |
| 4491 | 0x05, |
| 4492 | }; |
| 4493 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4494 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4495 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4496 | */ |
| 4497 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4498 | /* ADC0, ADC1 */ |
| 4499 | 0x04, 0x05 |
| 4500 | }; |
| 4501 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4502 | #define ALC260_DIGOUT_NID 0x03 |
| 4503 | #define ALC260_DIGIN_NID 0x06 |
| 4504 | |
| 4505 | static struct hda_input_mux alc260_capture_source = { |
| 4506 | .num_items = 4, |
| 4507 | .items = { |
| 4508 | { "Mic", 0x0 }, |
| 4509 | { "Front Mic", 0x1 }, |
| 4510 | { "Line", 0x2 }, |
| 4511 | { "CD", 0x4 }, |
| 4512 | }, |
| 4513 | }; |
| 4514 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4515 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4516 | * headphone jack and the internal CD lines since these are the only pins at |
| 4517 | * which audio can appear. For flexibility, also allow the option of |
| 4518 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4519 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4520 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4521 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4522 | { |
| 4523 | .num_items = 3, |
| 4524 | .items = { |
| 4525 | { "Mic/Line", 0x0 }, |
| 4526 | { "CD", 0x4 }, |
| 4527 | { "Headphone", 0x2 }, |
| 4528 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4529 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4530 | { |
| 4531 | .num_items = 4, |
| 4532 | .items = { |
| 4533 | { "Mic/Line", 0x0 }, |
| 4534 | { "CD", 0x4 }, |
| 4535 | { "Headphone", 0x2 }, |
| 4536 | { "Mixer", 0x5 }, |
| 4537 | }, |
| 4538 | }, |
| 4539 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4540 | }; |
| 4541 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4542 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4543 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4544 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4545 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4546 | { |
| 4547 | .num_items = 4, |
| 4548 | .items = { |
| 4549 | { "Mic", 0x0 }, |
| 4550 | { "Line", 0x2 }, |
| 4551 | { "CD", 0x4 }, |
| 4552 | { "Headphone", 0x5 }, |
| 4553 | }, |
| 4554 | }, |
| 4555 | { |
| 4556 | .num_items = 5, |
| 4557 | .items = { |
| 4558 | { "Mic", 0x0 }, |
| 4559 | { "Line", 0x2 }, |
| 4560 | { "CD", 0x4 }, |
| 4561 | { "Headphone", 0x6 }, |
| 4562 | { "Mixer", 0x5 }, |
| 4563 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4564 | }, |
| 4565 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4566 | |
| 4567 | /* Maxdata Favorit 100XS */ |
| 4568 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4569 | { |
| 4570 | .num_items = 2, |
| 4571 | .items = { |
| 4572 | { "Line/Mic", 0x0 }, |
| 4573 | { "CD", 0x4 }, |
| 4574 | }, |
| 4575 | }, |
| 4576 | { |
| 4577 | .num_items = 3, |
| 4578 | .items = { |
| 4579 | { "Line/Mic", 0x0 }, |
| 4580 | { "CD", 0x4 }, |
| 4581 | { "Mixer", 0x5 }, |
| 4582 | }, |
| 4583 | }, |
| 4584 | }; |
| 4585 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4586 | /* |
| 4587 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4588 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4589 | * element which allows changing the channel mode, so the verb list is |
| 4590 | * never used. |
| 4591 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4592 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4593 | { 2, NULL }, |
| 4594 | }; |
| 4595 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4596 | |
| 4597 | /* Mixer combinations |
| 4598 | * |
| 4599 | * basic: base_output + input + pc_beep + capture |
| 4600 | * HP: base_output + input + capture_alt |
| 4601 | * HP_3013: hp_3013 + input + capture |
| 4602 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4603 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4604 | */ |
| 4605 | |
| 4606 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4607 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4608 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4609 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4610 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4611 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4612 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4613 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4614 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4615 | |
| 4616 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4617 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4618 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4619 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4620 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4621 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4622 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4623 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4624 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4625 | { } /* end */ |
| 4626 | }; |
| 4627 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4628 | /* update HP, line and mono out pins according to the master switch */ |
| 4629 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4630 | hda_nid_t hp, hda_nid_t line, |
| 4631 | hda_nid_t mono) |
| 4632 | { |
| 4633 | struct alc_spec *spec = codec->spec; |
| 4634 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4635 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4636 | 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] | 4637 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4638 | 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] | 4639 | val); |
| 4640 | /* mono (speaker) depending on the HP jack sense */ |
| 4641 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4642 | 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] | 4643 | val); |
| 4644 | } |
| 4645 | |
| 4646 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4647 | struct snd_ctl_elem_value *ucontrol) |
| 4648 | { |
| 4649 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4650 | struct alc_spec *spec = codec->spec; |
| 4651 | *ucontrol->value.integer.value = spec->master_sw; |
| 4652 | return 0; |
| 4653 | } |
| 4654 | |
| 4655 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4656 | struct snd_ctl_elem_value *ucontrol) |
| 4657 | { |
| 4658 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4659 | struct alc_spec *spec = codec->spec; |
| 4660 | int val = !!*ucontrol->value.integer.value; |
| 4661 | hda_nid_t hp, line, mono; |
| 4662 | |
| 4663 | if (val == spec->master_sw) |
| 4664 | return 0; |
| 4665 | spec->master_sw = val; |
| 4666 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4667 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4668 | mono = kcontrol->private_value & 0xff; |
| 4669 | alc260_hp_master_update(codec, hp, line, mono); |
| 4670 | return 1; |
| 4671 | } |
| 4672 | |
| 4673 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4674 | { |
| 4675 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4676 | .name = "Master Playback Switch", |
| 4677 | .info = snd_ctl_boolean_mono_info, |
| 4678 | .get = alc260_hp_master_sw_get, |
| 4679 | .put = alc260_hp_master_sw_put, |
| 4680 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4681 | }, |
| 4682 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4683 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4684 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4685 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4686 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4687 | HDA_OUTPUT), |
| 4688 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4689 | { } /* end */ |
| 4690 | }; |
| 4691 | |
| 4692 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4693 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4694 | {}, |
| 4695 | }; |
| 4696 | |
| 4697 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4698 | { |
| 4699 | struct alc_spec *spec = codec->spec; |
| 4700 | unsigned int present; |
| 4701 | |
| 4702 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4703 | AC_VERB_GET_PIN_SENSE, 0); |
| 4704 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4705 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4706 | } |
| 4707 | |
| 4708 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4709 | { |
| 4710 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4711 | alc260_hp_automute(codec); |
| 4712 | } |
| 4713 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4714 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4715 | { |
| 4716 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4717 | .name = "Master Playback Switch", |
| 4718 | .info = snd_ctl_boolean_mono_info, |
| 4719 | .get = alc260_hp_master_sw_get, |
| 4720 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4721 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4722 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4723 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4724 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4725 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4726 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4727 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4728 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4729 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4730 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4731 | { } /* end */ |
| 4732 | }; |
| 4733 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4734 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4735 | .ops = &snd_hda_bind_vol, |
| 4736 | .values = { |
| 4737 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4738 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4739 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4740 | 0 |
| 4741 | }, |
| 4742 | }; |
| 4743 | |
| 4744 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4745 | .ops = &snd_hda_bind_sw, |
| 4746 | .values = { |
| 4747 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4748 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4749 | 0 |
| 4750 | }, |
| 4751 | }; |
| 4752 | |
| 4753 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4754 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4755 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4756 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4757 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4758 | { } /* end */ |
| 4759 | }; |
| 4760 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4761 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4762 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4763 | {}, |
| 4764 | }; |
| 4765 | |
| 4766 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4767 | { |
| 4768 | struct alc_spec *spec = codec->spec; |
| 4769 | unsigned int present; |
| 4770 | |
| 4771 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4772 | AC_VERB_GET_PIN_SENSE, 0); |
| 4773 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4774 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4775 | } |
| 4776 | |
| 4777 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4778 | unsigned int res) |
| 4779 | { |
| 4780 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4781 | alc260_hp_3013_automute(codec); |
| 4782 | } |
| 4783 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4784 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4785 | { |
| 4786 | unsigned int present, bits; |
| 4787 | |
| 4788 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4789 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4790 | |
| 4791 | bits = present ? 0 : PIN_OUT; |
| 4792 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4793 | bits); |
| 4794 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4795 | bits); |
| 4796 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4797 | bits); |
| 4798 | } |
| 4799 | |
| 4800 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4801 | unsigned int res) |
| 4802 | { |
| 4803 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4804 | alc260_hp_3012_automute(codec); |
| 4805 | } |
| 4806 | |
| 4807 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4808 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4809 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4810 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4811 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4812 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4813 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4814 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4815 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4816 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4817 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4818 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4819 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4820 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4821 | { } /* end */ |
| 4822 | }; |
| 4823 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4824 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4825 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4826 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4827 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4828 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4829 | * revisions available in early 2006. Therefore for now allow the |
| 4830 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4831 | * that the lack of mic bias for this NID is intentional we could change the |
| 4832 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4833 | * |
| 4834 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4835 | * don't appear to make the mic bias available from the "line" jack, even |
| 4836 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4837 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4838 | * and the output jack. If this turns out to be the case for all such |
| 4839 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4840 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4841 | * |
| 4842 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4843 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4844 | * controls for such models. On models without a "mono speaker" the control |
| 4845 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4846 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4847 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4848 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4849 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4850 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4851 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4852 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4853 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4854 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4855 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4856 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4857 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4858 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4859 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4860 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4861 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4862 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4863 | { } /* end */ |
| 4864 | }; |
| 4865 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4866 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 4867 | */ |
| 4868 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 4869 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4870 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 4871 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4872 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4873 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4874 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4875 | { } /* end */ |
| 4876 | }; |
| 4877 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4878 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4879 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4880 | */ |
| 4881 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4882 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4883 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4884 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4885 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4886 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4887 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4888 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4889 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4890 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4891 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4892 | { } /* end */ |
| 4893 | }; |
| 4894 | |
| 4895 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4896 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4897 | */ |
| 4898 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4899 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4900 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4901 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4902 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4903 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4904 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4905 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4906 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4907 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4908 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4909 | { } /* end */ |
| 4910 | }; |
| 4911 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4912 | /* |
| 4913 | * initialization verbs |
| 4914 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4915 | static struct hda_verb alc260_init_verbs[] = { |
| 4916 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4917 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4918 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4919 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4920 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4921 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4922 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4923 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4924 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4925 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4926 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4927 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4928 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4929 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4930 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4931 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4932 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4933 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4934 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4935 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4936 | /* set connection select to line in (default select for this ADC) */ |
| 4937 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4938 | /* mute capture amp left and right */ |
| 4939 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4940 | /* set connection select to line in (default select for this ADC) */ |
| 4941 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4942 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4943 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4944 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4945 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4946 | /* set vol=0 HP mixer amp left and right */ |
| 4947 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4948 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4949 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4950 | /* set vol=0 Mono mixer amp left and right */ |
| 4951 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4952 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4953 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4954 | /* unmute LINE-2 out pin */ |
| 4955 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4956 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4957 | * Line In 2 = 0x03 |
| 4958 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4959 | /* mute analog inputs */ |
| 4960 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4961 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4962 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4963 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4964 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4965 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4966 | /* mute Front out path */ |
| 4967 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4968 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4969 | /* mute Headphone out path */ |
| 4970 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4971 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4972 | /* mute Mono out path */ |
| 4973 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4974 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4975 | { } |
| 4976 | }; |
| 4977 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4978 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4979 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4980 | /* Headphone and output */ |
| 4981 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4982 | /* mono output */ |
| 4983 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4984 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4985 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4986 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4987 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4988 | /* Line In pin widget for input */ |
| 4989 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4990 | /* Line-2 pin widget for output */ |
| 4991 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4992 | /* CD pin widget for input */ |
| 4993 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4994 | /* unmute amp left and right */ |
| 4995 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4996 | /* set connection select to line in (default select for this ADC) */ |
| 4997 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4998 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4999 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5000 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5001 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5002 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5003 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5004 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5005 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5006 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5007 | * Line In 2 = 0x03 |
| 5008 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5009 | /* mute analog inputs */ |
| 5010 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5011 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5012 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5013 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5014 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5015 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5016 | /* Unmute Front out path */ |
| 5017 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5018 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5019 | /* Unmute Headphone out path */ |
| 5020 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5021 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5022 | /* Unmute Mono out path */ |
| 5023 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5024 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5025 | { } |
| 5026 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5027 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5028 | |
| 5029 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5030 | /* Line out and output */ |
| 5031 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5032 | /* mono output */ |
| 5033 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5034 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5035 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5036 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5037 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5038 | /* Line In pin widget for input */ |
| 5039 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5040 | /* Headphone pin widget for output */ |
| 5041 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5042 | /* CD pin widget for input */ |
| 5043 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5044 | /* unmute amp left and right */ |
| 5045 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5046 | /* set connection select to line in (default select for this ADC) */ |
| 5047 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5048 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5049 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5050 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5051 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5052 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5053 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5054 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5055 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5056 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5057 | * Line In 2 = 0x03 |
| 5058 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5059 | /* mute analog inputs */ |
| 5060 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5061 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5062 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5063 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5064 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5065 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5066 | /* Unmute Front out path */ |
| 5067 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5068 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5069 | /* Unmute Headphone out path */ |
| 5070 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5071 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5072 | /* Unmute Mono out path */ |
| 5073 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5074 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5075 | { } |
| 5076 | }; |
| 5077 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5078 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5079 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5080 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5081 | */ |
| 5082 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5083 | /* Disable all GPIOs */ |
| 5084 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5085 | /* Internal speaker is connected to headphone pin */ |
| 5086 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5087 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5088 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5089 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5090 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5091 | /* Ensure all other unused pins are disabled and muted. */ |
| 5092 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5093 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5094 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5095 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5096 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5097 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5098 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5099 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5100 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5101 | /* Disable digital (SPDIF) pins */ |
| 5102 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5103 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5104 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5105 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5106 | * when acting as an output. |
| 5107 | */ |
| 5108 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5109 | |
| 5110 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5111 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5112 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5113 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5114 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5115 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5116 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5117 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5118 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5119 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5120 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5121 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5122 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5123 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5124 | * If the pin mode is changed by the user the pin mode control will |
| 5125 | * take care of enabling the pin's input/output buffers as needed. |
| 5126 | * Therefore there's no need to enable the input buffer at this |
| 5127 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5128 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5129 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5130 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5131 | * mixer ctrl) |
| 5132 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5133 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5134 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5135 | /* Mute capture amp left and right */ |
| 5136 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5137 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5138 | * in (on mic1 pin) |
| 5139 | */ |
| 5140 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5141 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5142 | /* Do the same for the second ADC: mute capture input amp and |
| 5143 | * set ADC connection to line in (on mic1 pin) |
| 5144 | */ |
| 5145 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5146 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5147 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5148 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5149 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5150 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5151 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5152 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5153 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5154 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5155 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5156 | {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] | 5157 | |
| 5158 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5159 | }; |
| 5160 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5161 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5162 | * similar laptops (adapted from Fujitsu init verbs). |
| 5163 | */ |
| 5164 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5165 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5166 | * the headphone jack. Turn this on and rely on the standard mute |
| 5167 | * methods whenever the user wants to turn these outputs off. |
| 5168 | */ |
| 5169 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5170 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5171 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5172 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5173 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5174 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5175 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5176 | /* Line In jack is connected to Line1 pin */ |
| 5177 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5178 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5179 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5180 | /* Ensure all other unused pins are disabled and muted. */ |
| 5181 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5182 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5183 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5184 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5185 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5186 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5187 | /* Disable digital (SPDIF) pins */ |
| 5188 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5189 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5190 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5191 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5192 | * bus when acting as outputs. |
| 5193 | */ |
| 5194 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5195 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5196 | |
| 5197 | /* Start with output sum widgets muted and their output gains at min */ |
| 5198 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5199 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5200 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5201 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5202 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5203 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5204 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5205 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5206 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5207 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5208 | /* Unmute Line-out pin widget amp left and right |
| 5209 | * (no equiv mixer ctrl) |
| 5210 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5211 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5212 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5213 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5214 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5215 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5216 | * will take care of enabling the pin's input/output buffers as needed. |
| 5217 | * Therefore there's no need to enable the input buffer at this |
| 5218 | * stage. |
| 5219 | */ |
| 5220 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5221 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5222 | |
| 5223 | /* Mute capture amp left and right */ |
| 5224 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5225 | /* Set ADC connection select to match default mixer setting - mic |
| 5226 | * (on mic1 pin) |
| 5227 | */ |
| 5228 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5229 | |
| 5230 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5231 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5232 | */ |
| 5233 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5234 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5235 | |
| 5236 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5237 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5238 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5239 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5240 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5241 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5242 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5243 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5244 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5245 | |
| 5246 | { } |
| 5247 | }; |
| 5248 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5249 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5250 | * (adapted from Acer init verbs). |
| 5251 | */ |
| 5252 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5253 | /* GPIO 0 enables the output jack. |
| 5254 | * Turn this on and rely on the standard mute |
| 5255 | * methods whenever the user wants to turn these outputs off. |
| 5256 | */ |
| 5257 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5258 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5259 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5260 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5261 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5262 | /* Ensure all other unused pins are disabled and muted. */ |
| 5263 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5264 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5265 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5266 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5267 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5268 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5269 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5270 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5271 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5272 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5273 | /* Disable digital (SPDIF) pins */ |
| 5274 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5275 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5276 | |
| 5277 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5278 | * bus when acting as outputs. |
| 5279 | */ |
| 5280 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5281 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5282 | |
| 5283 | /* Start with output sum widgets muted and their output gains at min */ |
| 5284 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5285 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5286 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5287 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5288 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5289 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5290 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5291 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5292 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5293 | |
| 5294 | /* Unmute Line-out pin widget amp left and right |
| 5295 | * (no equiv mixer ctrl) |
| 5296 | */ |
| 5297 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5298 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5299 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5300 | * will take care of enabling the pin's input/output buffers as needed. |
| 5301 | * Therefore there's no need to enable the input buffer at this |
| 5302 | * stage. |
| 5303 | */ |
| 5304 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5305 | |
| 5306 | /* Mute capture amp left and right */ |
| 5307 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5308 | /* Set ADC connection select to match default mixer setting - mic |
| 5309 | * (on mic1 pin) |
| 5310 | */ |
| 5311 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5312 | |
| 5313 | /* Do similar with the second ADC: mute capture input amp and |
| 5314 | * set ADC connection to mic to match ALSA's default state. |
| 5315 | */ |
| 5316 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5317 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5318 | |
| 5319 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5320 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5321 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5322 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5323 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5324 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5325 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5326 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5327 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5328 | |
| 5329 | { } |
| 5330 | }; |
| 5331 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5332 | static struct hda_verb alc260_will_verbs[] = { |
| 5333 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5334 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5335 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5336 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5337 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5338 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5339 | {} |
| 5340 | }; |
| 5341 | |
| 5342 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5343 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5344 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5345 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5346 | |
| 5347 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5348 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5349 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5350 | |
| 5351 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5352 | {} |
| 5353 | }; |
| 5354 | |
| 5355 | /* toggle speaker-output according to the hp-jack state */ |
| 5356 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5357 | { |
| 5358 | unsigned int present; |
| 5359 | |
| 5360 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5361 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5362 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5363 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5364 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5365 | AC_VERB_SET_GPIO_DATA, 1); |
| 5366 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5367 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5368 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5369 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5370 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5371 | AC_VERB_SET_GPIO_DATA, 0); |
| 5372 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5373 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5374 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5375 | } |
| 5376 | } |
| 5377 | |
| 5378 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5379 | unsigned int res) |
| 5380 | { |
| 5381 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5382 | alc260_replacer_672v_automute(codec); |
| 5383 | } |
| 5384 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5385 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5386 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5387 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5388 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5389 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5390 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5392 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5393 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5394 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5395 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5396 | {} |
| 5397 | }; |
| 5398 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5399 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5400 | * configuration. |
| 5401 | */ |
| 5402 | #ifdef CONFIG_SND_DEBUG |
| 5403 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5404 | 0x02, |
| 5405 | }; |
| 5406 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5407 | 0x04, 0x05, |
| 5408 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5409 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5410 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5411 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5412 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5413 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5414 | { |
| 5415 | .num_items = 7, |
| 5416 | .items = { |
| 5417 | { "MIC1 pin", 0x0 }, |
| 5418 | { "MIC2 pin", 0x1 }, |
| 5419 | { "LINE1 pin", 0x2 }, |
| 5420 | { "LINE2 pin", 0x3 }, |
| 5421 | { "CD pin", 0x4 }, |
| 5422 | { "LINE-OUT pin", 0x5 }, |
| 5423 | { "HP-OUT pin", 0x6 }, |
| 5424 | }, |
| 5425 | }, |
| 5426 | { |
| 5427 | .num_items = 8, |
| 5428 | .items = { |
| 5429 | { "MIC1 pin", 0x0 }, |
| 5430 | { "MIC2 pin", 0x1 }, |
| 5431 | { "LINE1 pin", 0x2 }, |
| 5432 | { "LINE2 pin", 0x3 }, |
| 5433 | { "CD pin", 0x4 }, |
| 5434 | { "Mixer", 0x5 }, |
| 5435 | { "LINE-OUT pin", 0x6 }, |
| 5436 | { "HP-OUT pin", 0x7 }, |
| 5437 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5438 | }, |
| 5439 | }; |
| 5440 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5441 | /* Output driver widgets */ |
| 5442 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5443 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5444 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5445 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5446 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5447 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5448 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5449 | /* Modes for retasking pin widgets |
| 5450 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5451 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5452 | * mention this restriction. At this stage it's not clear whether |
| 5453 | * this behaviour is intentional or is a hardware bug in chip |
| 5454 | * revisions available at least up until early 2006. Therefore for |
| 5455 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5456 | * choices, but if it turns out that the lack of mic bias for these |
| 5457 | * NIDs is intentional we could change their modes from |
| 5458 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5459 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5460 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5461 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5462 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5463 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5464 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5465 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5466 | |
| 5467 | /* Loopback mixer controls */ |
| 5468 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5469 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5470 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5471 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5472 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5473 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5474 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5475 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5476 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5477 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5478 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5479 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5480 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5481 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5482 | |
| 5483 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5484 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5485 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5486 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5487 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5488 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5489 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5490 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5491 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5492 | */ |
| 5493 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5494 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5495 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5496 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5497 | * this output to turn on an external amplifier. |
| 5498 | */ |
| 5499 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5500 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5501 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5502 | { } /* end */ |
| 5503 | }; |
| 5504 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5505 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5506 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5507 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5508 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5509 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5510 | /* Enable retasking pins as output, initially without power amp */ |
| 5511 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5512 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5513 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5514 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5515 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5516 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5517 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5518 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5519 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5520 | * payload also sets the generation to 0, output to be in "consumer" |
| 5521 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5522 | * control. |
| 5523 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5524 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5525 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5526 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5527 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5528 | * OUT1 sum bus when acting as an output. |
| 5529 | */ |
| 5530 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5531 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5532 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5533 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5534 | |
| 5535 | /* Start with output sum widgets muted and their output gains at min */ |
| 5536 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5537 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5538 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5539 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5540 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5541 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5542 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5543 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5544 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5545 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5546 | /* Unmute retasking pin widget output buffers since the default |
| 5547 | * state appears to be output. As the pin mode is changed by the |
| 5548 | * user the pin mode control will take care of enabling the pin's |
| 5549 | * input/output buffers as needed. |
| 5550 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5551 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5552 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5553 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5554 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5555 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5556 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5557 | /* Also unmute the mono-out pin widget */ |
| 5558 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5559 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5560 | /* Mute capture amp left and right */ |
| 5561 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5562 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5563 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5564 | */ |
| 5565 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5566 | |
| 5567 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5568 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5569 | */ |
| 5570 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5571 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5572 | |
| 5573 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5574 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5575 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5576 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5577 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5578 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5579 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5580 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5581 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5582 | |
| 5583 | { } |
| 5584 | }; |
| 5585 | #endif |
| 5586 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5587 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5588 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5589 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5590 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5591 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5592 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5593 | /* |
| 5594 | * for BIOS auto-configuration |
| 5595 | */ |
| 5596 | |
| 5597 | 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] | 5598 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5599 | { |
| 5600 | hda_nid_t nid_vol; |
| 5601 | unsigned long vol_val, sw_val; |
| 5602 | char name[32]; |
| 5603 | int err; |
| 5604 | |
| 5605 | if (nid >= 0x0f && nid < 0x11) { |
| 5606 | nid_vol = nid - 0x7; |
| 5607 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5608 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5609 | } else if (nid == 0x11) { |
| 5610 | nid_vol = nid - 0x7; |
| 5611 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5612 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5613 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5614 | nid_vol = 0x08; |
| 5615 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5616 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5617 | } else |
| 5618 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5619 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5620 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5621 | /* first control for the volume widget */ |
| 5622 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5623 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5624 | if (err < 0) |
| 5625 | return err; |
| 5626 | *vol_bits |= (1 << nid_vol); |
| 5627 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5628 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5629 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5630 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5631 | return err; |
| 5632 | return 1; |
| 5633 | } |
| 5634 | |
| 5635 | /* add playback controls from the parsed DAC table */ |
| 5636 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5637 | const struct auto_pin_cfg *cfg) |
| 5638 | { |
| 5639 | hda_nid_t nid; |
| 5640 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5641 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5642 | |
| 5643 | spec->multiout.num_dacs = 1; |
| 5644 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5645 | spec->multiout.dac_nids[0] = 0x02; |
| 5646 | |
| 5647 | nid = cfg->line_out_pins[0]; |
| 5648 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5649 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5650 | if (err < 0) |
| 5651 | return err; |
| 5652 | } |
| 5653 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5654 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5655 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5656 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5657 | if (err < 0) |
| 5658 | return err; |
| 5659 | } |
| 5660 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5661 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5662 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5663 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5664 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5665 | if (err < 0) |
| 5666 | return err; |
| 5667 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5668 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5669 | } |
| 5670 | |
| 5671 | /* create playback/capture controls for input pins */ |
| 5672 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5673 | const struct auto_pin_cfg *cfg) |
| 5674 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5675 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5676 | int i, err, idx; |
| 5677 | |
| 5678 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5679 | if (cfg->input_pins[i] >= 0x12) { |
| 5680 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5681 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5682 | auto_pin_cfg_labels[i], idx, |
| 5683 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5684 | if (err < 0) |
| 5685 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5686 | imux->items[imux->num_items].label = |
| 5687 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5688 | imux->items[imux->num_items].index = idx; |
| 5689 | imux->num_items++; |
| 5690 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5691 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5692 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5693 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5694 | auto_pin_cfg_labels[i], idx, |
| 5695 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5696 | if (err < 0) |
| 5697 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5698 | imux->items[imux->num_items].label = |
| 5699 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5700 | imux->items[imux->num_items].index = idx; |
| 5701 | imux->num_items++; |
| 5702 | } |
| 5703 | } |
| 5704 | return 0; |
| 5705 | } |
| 5706 | |
| 5707 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5708 | hda_nid_t nid, int pin_type, |
| 5709 | int sel_idx) |
| 5710 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5711 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5712 | /* need the manual connection? */ |
| 5713 | if (nid >= 0x12) { |
| 5714 | int idx = nid - 0x12; |
| 5715 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5716 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5717 | } |
| 5718 | } |
| 5719 | |
| 5720 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5721 | { |
| 5722 | struct alc_spec *spec = codec->spec; |
| 5723 | hda_nid_t nid; |
| 5724 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5725 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5726 | if (nid) { |
| 5727 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5728 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5729 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5730 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5731 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5732 | if (nid) |
| 5733 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5734 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5735 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5736 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5737 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5738 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5739 | |
| 5740 | #define ALC260_PIN_CD_NID 0x16 |
| 5741 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5742 | { |
| 5743 | struct alc_spec *spec = codec->spec; |
| 5744 | int i; |
| 5745 | |
| 5746 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5747 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5748 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5749 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5750 | if (nid != ALC260_PIN_CD_NID && |
| 5751 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5752 | snd_hda_codec_write(codec, nid, 0, |
| 5753 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5754 | AMP_OUT_MUTE); |
| 5755 | } |
| 5756 | } |
| 5757 | } |
| 5758 | |
| 5759 | /* |
| 5760 | * generic initialization of ADC, input mixers and output mixers |
| 5761 | */ |
| 5762 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5763 | /* |
| 5764 | * Unmute ADC0-1 and set the default input to mic-in |
| 5765 | */ |
| 5766 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5767 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5768 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5769 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5770 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5771 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5772 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5773 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5774 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5775 | */ |
| 5776 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5777 | /* mute analog inputs */ |
| 5778 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5779 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5780 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5781 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5782 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5783 | |
| 5784 | /* |
| 5785 | * Set up output mixers (0x08 - 0x0a) |
| 5786 | */ |
| 5787 | /* set vol=0 to output mixers */ |
| 5788 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5789 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5790 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5791 | /* set up input amps for analog loopback */ |
| 5792 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5793 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5794 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5795 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5796 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5797 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5798 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5799 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5800 | { } |
| 5801 | }; |
| 5802 | |
| 5803 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5804 | { |
| 5805 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5806 | int err; |
| 5807 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5808 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5809 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5810 | alc260_ignore); |
| 5811 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5812 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5813 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5814 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5815 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5816 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5817 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5818 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5819 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5820 | return err; |
| 5821 | |
| 5822 | spec->multiout.max_channels = 2; |
| 5823 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 5824 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5825 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5826 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5827 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5828 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5829 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5830 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5831 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5832 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5833 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5834 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 5835 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5836 | return 1; |
| 5837 | } |
| 5838 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5839 | /* additional initialization for auto-configuration model */ |
| 5840 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5841 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5842 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5843 | alc260_auto_init_multi_out(codec); |
| 5844 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5845 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5846 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5847 | } |
| 5848 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5849 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5850 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5851 | { 0x07, HDA_INPUT, 0 }, |
| 5852 | { 0x07, HDA_INPUT, 1 }, |
| 5853 | { 0x07, HDA_INPUT, 2 }, |
| 5854 | { 0x07, HDA_INPUT, 3 }, |
| 5855 | { 0x07, HDA_INPUT, 4 }, |
| 5856 | { } /* end */ |
| 5857 | }; |
| 5858 | #endif |
| 5859 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5860 | /* |
| 5861 | * ALC260 configurations |
| 5862 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5863 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5864 | [ALC260_BASIC] = "basic", |
| 5865 | [ALC260_HP] = "hp", |
| 5866 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5867 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5868 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5869 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5870 | [ALC260_WILL] = "will", |
| 5871 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5872 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5873 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5874 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5875 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5876 | [ALC260_AUTO] = "auto", |
| 5877 | }; |
| 5878 | |
| 5879 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5880 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5881 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5882 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5883 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5884 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5885 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5886 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5887 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5888 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5889 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5890 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5891 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5892 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5893 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5894 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5895 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5896 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5897 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5898 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5899 | {} |
| 5900 | }; |
| 5901 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5902 | static struct alc_config_preset alc260_presets[] = { |
| 5903 | [ALC260_BASIC] = { |
| 5904 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5905 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5906 | .init_verbs = { alc260_init_verbs }, |
| 5907 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5908 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5909 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5910 | .adc_nids = alc260_adc_nids, |
| 5911 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5912 | .channel_mode = alc260_modes, |
| 5913 | .input_mux = &alc260_capture_source, |
| 5914 | }, |
| 5915 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5916 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5917 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5918 | .init_verbs = { alc260_init_verbs, |
| 5919 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5920 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5921 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5922 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5923 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5924 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5925 | .channel_mode = alc260_modes, |
| 5926 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5927 | .unsol_event = alc260_hp_unsol_event, |
| 5928 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5929 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5930 | [ALC260_HP_DC7600] = { |
| 5931 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5932 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5933 | .init_verbs = { alc260_init_verbs, |
| 5934 | alc260_hp_dc7600_verbs }, |
| 5935 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5936 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5937 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5938 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5939 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5940 | .channel_mode = alc260_modes, |
| 5941 | .input_mux = &alc260_capture_source, |
| 5942 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5943 | .init_hook = alc260_hp_3012_automute, |
| 5944 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5945 | [ALC260_HP_3013] = { |
| 5946 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5947 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5948 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5949 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5950 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5951 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5952 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5953 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5954 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5955 | .channel_mode = alc260_modes, |
| 5956 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5957 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5958 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5959 | }, |
| 5960 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5961 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5962 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5963 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5964 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5965 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5966 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5967 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5968 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5969 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5970 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5971 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5972 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5973 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5974 | .init_verbs = { alc260_acer_init_verbs }, |
| 5975 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5976 | .dac_nids = alc260_dac_nids, |
| 5977 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5978 | .adc_nids = alc260_dual_adc_nids, |
| 5979 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5980 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5981 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5982 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5983 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5984 | [ALC260_FAVORIT100] = { |
| 5985 | .mixers = { alc260_favorit100_mixer }, |
| 5986 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 5987 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5988 | .dac_nids = alc260_dac_nids, |
| 5989 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5990 | .adc_nids = alc260_dual_adc_nids, |
| 5991 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5992 | .channel_mode = alc260_modes, |
| 5993 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 5994 | .input_mux = alc260_favorit100_capture_sources, |
| 5995 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5996 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5997 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5998 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5999 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6000 | .dac_nids = alc260_dac_nids, |
| 6001 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6002 | .adc_nids = alc260_adc_nids, |
| 6003 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6004 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6005 | .channel_mode = alc260_modes, |
| 6006 | .input_mux = &alc260_capture_source, |
| 6007 | }, |
| 6008 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6009 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6010 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6011 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6012 | .dac_nids = alc260_dac_nids, |
| 6013 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6014 | .adc_nids = alc260_adc_nids, |
| 6015 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6016 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6017 | .channel_mode = alc260_modes, |
| 6018 | .input_mux = &alc260_capture_source, |
| 6019 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6020 | .init_hook = alc260_replacer_672v_automute, |
| 6021 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6022 | #ifdef CONFIG_SND_DEBUG |
| 6023 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6024 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6025 | .init_verbs = { alc260_test_init_verbs }, |
| 6026 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6027 | .dac_nids = alc260_test_dac_nids, |
| 6028 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6029 | .adc_nids = alc260_test_adc_nids, |
| 6030 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6031 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6032 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6033 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6034 | }, |
| 6035 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6036 | }; |
| 6037 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6038 | static int patch_alc260(struct hda_codec *codec) |
| 6039 | { |
| 6040 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6041 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6042 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6043 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6044 | if (spec == NULL) |
| 6045 | return -ENOMEM; |
| 6046 | |
| 6047 | codec->spec = spec; |
| 6048 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6049 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6050 | alc260_models, |
| 6051 | alc260_cfg_tbl); |
| 6052 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6053 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 6054 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6055 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6056 | } |
| 6057 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6058 | if (board_config == ALC260_AUTO) { |
| 6059 | /* automatic parse from the BIOS config */ |
| 6060 | err = alc260_parse_auto_config(codec); |
| 6061 | if (err < 0) { |
| 6062 | alc_free(codec); |
| 6063 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6064 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6065 | printk(KERN_INFO |
| 6066 | "hda_codec: Cannot set up configuration " |
| 6067 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6068 | board_config = ALC260_BASIC; |
| 6069 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6070 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6071 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6072 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6073 | if (err < 0) { |
| 6074 | alc_free(codec); |
| 6075 | return err; |
| 6076 | } |
| 6077 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6078 | if (board_config != ALC260_AUTO) |
| 6079 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6080 | |
| 6081 | spec->stream_name_analog = "ALC260 Analog"; |
| 6082 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6083 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6084 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6085 | spec->stream_name_digital = "ALC260 Digital"; |
| 6086 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6087 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6088 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6089 | if (!spec->adc_nids && spec->input_mux) { |
| 6090 | /* check whether NID 0x04 is valid */ |
| 6091 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 6092 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 6093 | /* get type */ |
| 6094 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6095 | spec->adc_nids = alc260_adc_nids_alt; |
| 6096 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6097 | } else { |
| 6098 | spec->adc_nids = alc260_adc_nids; |
| 6099 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6100 | } |
| 6101 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6102 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6103 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6104 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6105 | spec->vmaster_nid = 0x08; |
| 6106 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6107 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6108 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6109 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6110 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6111 | if (!spec->loopback.amplist) |
| 6112 | spec->loopback.amplist = alc260_loopbacks; |
| 6113 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6114 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6115 | |
| 6116 | return 0; |
| 6117 | } |
| 6118 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6119 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6120 | /* |
| 6121 | * ALC882 support |
| 6122 | * |
| 6123 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6124 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6125 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6126 | * 6-channel independent captures. |
| 6127 | * |
| 6128 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6129 | * driver yet). |
| 6130 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6131 | #define ALC882_DIGOUT_NID 0x06 |
| 6132 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6133 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6134 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6135 | { 8, NULL } |
| 6136 | }; |
| 6137 | |
| 6138 | static hda_nid_t alc882_dac_nids[4] = { |
| 6139 | /* front, rear, clfe, rear_surr */ |
| 6140 | 0x02, 0x03, 0x04, 0x05 |
| 6141 | }; |
| 6142 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6143 | /* identical with ALC880 */ |
| 6144 | #define alc882_adc_nids alc880_adc_nids |
| 6145 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6146 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6147 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6148 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 6149 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6150 | /* input MUX */ |
| 6151 | /* FIXME: should be a matrix-type input source selection */ |
| 6152 | |
| 6153 | static struct hda_input_mux alc882_capture_source = { |
| 6154 | .num_items = 4, |
| 6155 | .items = { |
| 6156 | { "Mic", 0x0 }, |
| 6157 | { "Front Mic", 0x1 }, |
| 6158 | { "Line", 0x2 }, |
| 6159 | { "CD", 0x4 }, |
| 6160 | }, |
| 6161 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6162 | |
| 6163 | static struct hda_input_mux mb5_capture_source = { |
| 6164 | .num_items = 3, |
| 6165 | .items = { |
| 6166 | { "Mic", 0x1 }, |
| 6167 | { "Line", 0x2 }, |
| 6168 | { "CD", 0x4 }, |
| 6169 | }, |
| 6170 | }; |
| 6171 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6172 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6173 | * 2ch mode |
| 6174 | */ |
| 6175 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6176 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6177 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6178 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6179 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6180 | { } /* end */ |
| 6181 | }; |
| 6182 | |
| 6183 | /* |
| 6184 | * 6ch mode |
| 6185 | */ |
| 6186 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6187 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6188 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6189 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6190 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6191 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6192 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6193 | { } /* end */ |
| 6194 | }; |
| 6195 | |
| 6196 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 6197 | { 2, alc882_3ST_ch2_init }, |
| 6198 | { 6, alc882_3ST_ch6_init }, |
| 6199 | }; |
| 6200 | |
| 6201 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6202 | * 6ch mode |
| 6203 | */ |
| 6204 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6205 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6206 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6207 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6208 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6209 | { } /* end */ |
| 6210 | }; |
| 6211 | |
| 6212 | /* |
| 6213 | * 8ch mode |
| 6214 | */ |
| 6215 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6216 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6217 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6218 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6219 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6220 | { } /* end */ |
| 6221 | }; |
| 6222 | |
| 6223 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6224 | { 6, alc882_sixstack_ch6_init }, |
| 6225 | { 8, alc882_sixstack_ch8_init }, |
| 6226 | }; |
| 6227 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6228 | /* |
| 6229 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 6230 | */ |
| 6231 | |
| 6232 | /* |
| 6233 | * 2ch mode |
| 6234 | */ |
| 6235 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6236 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6237 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6238 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6239 | { } /* end */ |
| 6240 | }; |
| 6241 | |
| 6242 | /* |
| 6243 | * 6ch mode |
| 6244 | */ |
| 6245 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6246 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6247 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6248 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6249 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6250 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6251 | { } /* end */ |
| 6252 | }; |
| 6253 | |
| 6254 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6255 | { 2, alc885_mbp_ch2_init }, |
| 6256 | { 6, alc885_mbp_ch6_init }, |
| 6257 | }; |
| 6258 | |
| 6259 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6260 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6261 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6262 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6263 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6264 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6265 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6266 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6267 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6268 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6269 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6270 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6271 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6272 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6273 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6274 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6275 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6276 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6277 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6278 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6279 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6280 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6281 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6282 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6283 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6284 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6285 | { } /* end */ |
| 6286 | }; |
| 6287 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6288 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6289 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6290 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6291 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6292 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6293 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6294 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6295 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6296 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6297 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6298 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6299 | { } /* end */ |
| 6300 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6301 | |
| 6302 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
| 6303 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6304 | HDA_BIND_MUTE ("Front Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 6305 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6306 | HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6307 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6308 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6309 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6310 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6311 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 6312 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 6313 | { } /* end */ |
| 6314 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6315 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6316 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6317 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6318 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6319 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6320 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6321 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6322 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6323 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6324 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6325 | { } /* end */ |
| 6326 | }; |
| 6327 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6328 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6329 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6330 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6331 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6332 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6333 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6334 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6335 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6336 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6337 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6338 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6339 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6340 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6341 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6342 | { } /* end */ |
| 6343 | }; |
| 6344 | |
| 6345 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6346 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6347 | */ |
| 6348 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6349 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6350 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6351 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6352 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6353 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6354 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6355 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6356 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6357 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6358 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6359 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6360 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6361 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6362 | { } /* end */ |
| 6363 | }; |
| 6364 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6365 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6366 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6367 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6368 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6369 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6370 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6371 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6372 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6373 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6374 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6375 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6376 | { } /* end */ |
| 6377 | }; |
| 6378 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6379 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6380 | { |
| 6381 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6382 | .name = "Channel Mode", |
| 6383 | .info = alc_ch_mode_info, |
| 6384 | .get = alc_ch_mode_get, |
| 6385 | .put = alc_ch_mode_put, |
| 6386 | }, |
| 6387 | { } /* end */ |
| 6388 | }; |
| 6389 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6390 | static struct hda_verb alc882_init_verbs[] = { |
| 6391 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6392 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6393 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6394 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6395 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6396 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6397 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6398 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6399 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6400 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6401 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6402 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6403 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6404 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6405 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6406 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6407 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6408 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6409 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6410 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6411 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6412 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6413 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6414 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6415 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6416 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6417 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6418 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6419 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6420 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6421 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6422 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6423 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6424 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6425 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6426 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6427 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6428 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6429 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6430 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6431 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6432 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6433 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6434 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6435 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6436 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6437 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6438 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6439 | |
| 6440 | /* FIXME: use matrix-type input source selection */ |
| 6441 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6442 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6443 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6444 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6445 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6446 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6447 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6448 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6449 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6450 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6451 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6452 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6453 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6454 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6455 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6456 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6457 | /* ADC1: mute amp left and right */ |
| 6458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6459 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6460 | /* ADC2: mute amp left and right */ |
| 6461 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6462 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6463 | /* ADC3: mute amp left and right */ |
| 6464 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6465 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6466 | |
| 6467 | { } |
| 6468 | }; |
| 6469 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6470 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6471 | /* change to EAPD mode */ |
| 6472 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6473 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6474 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6475 | }; |
| 6476 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6477 | /* Mac Pro test */ |
| 6478 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6479 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6480 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6481 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6482 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6483 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6484 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6485 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6486 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6487 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6488 | { } /* end */ |
| 6489 | }; |
| 6490 | |
| 6491 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6492 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6493 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6494 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6495 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6496 | /* Front Pin: output 0 (0x0c) */ |
| 6497 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6498 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6499 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6500 | /* Front Mic pin: input vref at 80% */ |
| 6501 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6502 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6503 | /* Speaker: output */ |
| 6504 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6505 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6506 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6507 | /* Headphone output (output 0 - 0x0c) */ |
| 6508 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6509 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6510 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6511 | |
| 6512 | /* FIXME: use matrix-type input source selection */ |
| 6513 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6514 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6515 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6516 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6517 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6518 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6519 | /* Input mixer2 */ |
| 6520 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6521 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6522 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6523 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6524 | /* Input mixer3 */ |
| 6525 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6526 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6527 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6528 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6529 | /* ADC1: mute amp left and right */ |
| 6530 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6531 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6532 | /* ADC2: mute amp left and right */ |
| 6533 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6534 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6535 | /* ADC3: mute amp left and right */ |
| 6536 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6537 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6538 | |
| 6539 | { } |
| 6540 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6541 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6542 | /* Macbook 5,1 */ |
| 6543 | static struct hda_verb alc885_mb5_init_verbs[] = { |
| 6544 | /* Front mixer */ |
| 6545 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6546 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6547 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6548 | /* LineOut mixer */ |
| 6549 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6550 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6551 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6552 | /* Front Pin: output 0 (0x0d) */ |
| 6553 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 6554 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6555 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6556 | /* HP Pin: output 0 (0x0c) */ |
| 6557 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6558 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6559 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6560 | /* Front Mic pin: input vref at 80% */ |
| 6561 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6562 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6563 | /* Line In pin */ |
| 6564 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6565 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6566 | |
| 6567 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6568 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6569 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6570 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6571 | { } |
| 6572 | }; |
| 6573 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6574 | /* Macbook Pro rev3 */ |
| 6575 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6576 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6577 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6578 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6579 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6580 | /* Rear mixer */ |
| 6581 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6582 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6583 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6584 | /* Front Pin: output 0 (0x0c) */ |
| 6585 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6586 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6587 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6588 | /* HP Pin: output 0 (0x0d) */ |
| 6589 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6590 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6591 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6592 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6593 | /* Mic (rear) pin: input vref at 80% */ |
| 6594 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6595 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6596 | /* Front Mic pin: input vref at 80% */ |
| 6597 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6598 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6599 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6600 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6601 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6602 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6603 | |
| 6604 | /* FIXME: use matrix-type input source selection */ |
| 6605 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6606 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6607 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6608 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6609 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6610 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6611 | /* Input mixer2 */ |
| 6612 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6613 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6614 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6615 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6616 | /* Input mixer3 */ |
| 6617 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6618 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6619 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6620 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6621 | /* ADC1: mute amp left and right */ |
| 6622 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6623 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6624 | /* ADC2: mute amp left and right */ |
| 6625 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6626 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6627 | /* ADC3: mute amp left and right */ |
| 6628 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6629 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6630 | |
| 6631 | { } |
| 6632 | }; |
| 6633 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6634 | /* iMac 24 mixer. */ |
| 6635 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6636 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6637 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6638 | { } /* end */ |
| 6639 | }; |
| 6640 | |
| 6641 | /* iMac 24 init verbs. */ |
| 6642 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6643 | /* Internal speakers: output 0 (0x0c) */ |
| 6644 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6645 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6646 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6647 | /* Internal speakers: output 0 (0x0c) */ |
| 6648 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6649 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6650 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6651 | /* Headphone: output 0 (0x0c) */ |
| 6652 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6653 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6654 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6655 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6656 | /* Front Mic: input vref at 80% */ |
| 6657 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6658 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6659 | { } |
| 6660 | }; |
| 6661 | |
| 6662 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6663 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6664 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6665 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6666 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6667 | spec->autocfg.hp_pins[0] = 0x14; |
| 6668 | spec->autocfg.speaker_pins[0] = 0x18; |
| 6669 | spec->autocfg.speaker_pins[1] = 0x1a; |
| 6670 | alc_automute_amp(codec); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6671 | } |
| 6672 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6673 | static void alc885_mbp3_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6674 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6675 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6676 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6677 | spec->autocfg.hp_pins[0] = 0x15; |
| 6678 | spec->autocfg.speaker_pins[0] = 0x14; |
| 6679 | alc_automute_amp(codec); |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6680 | } |
| 6681 | |
| 6682 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6683 | static struct hda_verb alc882_targa_verbs[] = { |
| 6684 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6685 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6686 | |
| 6687 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6688 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6689 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6690 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6691 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6692 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6693 | |
| 6694 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6695 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6696 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6697 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6698 | { } /* end */ |
| 6699 | }; |
| 6700 | |
| 6701 | /* toggle speaker-output according to the hp-jack state */ |
| 6702 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6703 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6704 | struct alc_spec *spec = codec->spec; |
| 6705 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6706 | 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] | 6707 | spec->jack_present ? 1 : 3); |
| 6708 | } |
| 6709 | |
| 6710 | static void alc882_targa_init_hook(struct hda_codec *codec) |
| 6711 | { |
| 6712 | struct alc_spec *spec = codec->spec; |
| 6713 | |
| 6714 | spec->autocfg.hp_pins[0] = 0x14; |
| 6715 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 6716 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6717 | } |
| 6718 | |
| 6719 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6720 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6721 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6722 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6723 | } |
| 6724 | |
| 6725 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6726 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6727 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6728 | |
| 6729 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6730 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6731 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6732 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6733 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6734 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6735 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6736 | |
| 6737 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6738 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6739 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6740 | { } /* end */ |
| 6741 | }; |
| 6742 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6743 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6744 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6745 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6746 | |
| 6747 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6748 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6749 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6750 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6751 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6752 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6753 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6754 | |
| 6755 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6756 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6757 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6758 | { } /* end */ |
| 6759 | }; |
| 6760 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6761 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6762 | { |
| 6763 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6764 | |
| 6765 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6766 | AC_VERB_GET_GPIO_DATA, 0); |
| 6767 | |
| 6768 | if (!muted) |
| 6769 | gpiostate |= (1 << pin); |
| 6770 | else |
| 6771 | gpiostate &= ~(1 << pin); |
| 6772 | |
| 6773 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6774 | AC_VERB_GET_GPIO_MASK, 0); |
| 6775 | gpiomask |= (1 << pin); |
| 6776 | |
| 6777 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6778 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6779 | gpiodir |= (1 << pin); |
| 6780 | |
| 6781 | |
| 6782 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6783 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6784 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6785 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6786 | |
| 6787 | msleep(1); |
| 6788 | |
| 6789 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6790 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6791 | } |
| 6792 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6793 | /* set up GPIO at initialization */ |
| 6794 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6795 | { |
| 6796 | alc882_gpio_mute(codec, 0, 0); |
| 6797 | alc882_gpio_mute(codec, 1, 0); |
| 6798 | } |
| 6799 | |
| 6800 | /* set up GPIO and update auto-muting at initialization */ |
| 6801 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6802 | { |
| 6803 | alc885_macpro_init_hook(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6804 | alc885_imac24_automute_init_hook(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6805 | } |
| 6806 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6807 | /* |
| 6808 | * generic initialization of ADC, input mixers and output mixers |
| 6809 | */ |
| 6810 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6811 | /* |
| 6812 | * Unmute ADC0-2 and set the default input to mic-in |
| 6813 | */ |
| 6814 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6815 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6816 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6817 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6818 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6819 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6820 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6821 | /* 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] | 6822 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6823 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6824 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6825 | */ |
| 6826 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6827 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6828 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6829 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6830 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6831 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6832 | |
| 6833 | /* |
| 6834 | * Set up output mixers (0x0c - 0x0f) |
| 6835 | */ |
| 6836 | /* set vol=0 to output mixers */ |
| 6837 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6838 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6839 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6840 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6841 | /* set up input amps for analog loopback */ |
| 6842 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6843 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6844 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6845 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6846 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6847 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6848 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6849 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6850 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6851 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6852 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6853 | |
| 6854 | /* FIXME: use matrix-type input source selection */ |
| 6855 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6856 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6857 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6858 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6859 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6860 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6861 | /* Input mixer2 */ |
| 6862 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6863 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6864 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6865 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6866 | /* Input mixer3 */ |
| 6867 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6868 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6869 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6870 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6871 | |
| 6872 | { } |
| 6873 | }; |
| 6874 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6875 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6876 | #define alc882_loopbacks alc880_loopbacks |
| 6877 | #endif |
| 6878 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6879 | /* pcm configuration: identiacal with ALC880 */ |
| 6880 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6881 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6882 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6883 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6884 | |
| 6885 | /* |
| 6886 | * configuration and preset |
| 6887 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6888 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6889 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6890 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6891 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6892 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6893 | [ALC882_TARGA] = "targa", |
| 6894 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6895 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6896 | [ALC885_MACPRO] = "macpro", |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6897 | [ALC885_MB5] = "mb5", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6898 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6899 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6900 | [ALC882_AUTO] = "auto", |
| 6901 | }; |
| 6902 | |
| 6903 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6904 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6905 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6906 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6907 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6908 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6909 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6910 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6911 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6912 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6913 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6914 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6915 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6916 | {} |
| 6917 | }; |
| 6918 | |
| 6919 | static struct alc_config_preset alc882_presets[] = { |
| 6920 | [ALC882_3ST_DIG] = { |
| 6921 | .mixers = { alc882_base_mixer }, |
| 6922 | .init_verbs = { alc882_init_verbs }, |
| 6923 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6924 | .dac_nids = alc882_dac_nids, |
| 6925 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6926 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6927 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6928 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6929 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6930 | .input_mux = &alc882_capture_source, |
| 6931 | }, |
| 6932 | [ALC882_6ST_DIG] = { |
| 6933 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6934 | .init_verbs = { alc882_init_verbs }, |
| 6935 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6936 | .dac_nids = alc882_dac_nids, |
| 6937 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6938 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6939 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6940 | .channel_mode = alc882_sixstack_modes, |
| 6941 | .input_mux = &alc882_capture_source, |
| 6942 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6943 | [ALC882_ARIMA] = { |
| 6944 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6945 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6946 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6947 | .dac_nids = alc882_dac_nids, |
| 6948 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6949 | .channel_mode = alc882_sixstack_modes, |
| 6950 | .input_mux = &alc882_capture_source, |
| 6951 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6952 | [ALC882_W2JC] = { |
| 6953 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6954 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6955 | alc880_gpio1_init_verbs }, |
| 6956 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6957 | .dac_nids = alc882_dac_nids, |
| 6958 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6959 | .channel_mode = alc880_threestack_modes, |
| 6960 | .need_dac_fix = 1, |
| 6961 | .input_mux = &alc882_capture_source, |
| 6962 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6963 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6964 | [ALC885_MBP3] = { |
| 6965 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6966 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6967 | alc880_gpio1_init_verbs }, |
| 6968 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6969 | .dac_nids = alc882_dac_nids, |
| 6970 | .channel_mode = alc885_mbp_6ch_modes, |
| 6971 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6972 | .input_mux = &alc882_capture_source, |
| 6973 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6974 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6975 | .unsol_event = alc_automute_amp_unsol_event, |
| 6976 | .init_hook = alc885_mbp3_init_hook, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6977 | }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6978 | [ALC885_MB5] = { |
| 6979 | .mixers = { alc885_mb5_mixer }, |
| 6980 | .init_verbs = { alc885_mb5_init_verbs, |
| 6981 | alc880_gpio1_init_verbs }, |
| 6982 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6983 | .dac_nids = alc882_dac_nids, |
| 6984 | .channel_mode = alc885_mbp_6ch_modes, |
| 6985 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6986 | .input_mux = &mb5_capture_source, |
| 6987 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6988 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6989 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6990 | [ALC885_MACPRO] = { |
| 6991 | .mixers = { alc882_macpro_mixer }, |
| 6992 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6993 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6994 | .dac_nids = alc882_dac_nids, |
| 6995 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6996 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6997 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6998 | .channel_mode = alc882_ch_modes, |
| 6999 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7000 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7001 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7002 | [ALC885_IMAC24] = { |
| 7003 | .mixers = { alc885_imac24_mixer }, |
| 7004 | .init_verbs = { alc885_imac24_init_verbs }, |
| 7005 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7006 | .dac_nids = alc882_dac_nids, |
| 7007 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7008 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7009 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 7010 | .channel_mode = alc882_ch_modes, |
| 7011 | .input_mux = &alc882_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7012 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7013 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7014 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7015 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7016 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7017 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 7018 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7019 | .dac_nids = alc882_dac_nids, |
| 7020 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7021 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 7022 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7023 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7024 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 7025 | .channel_mode = alc882_3ST_6ch_modes, |
| 7026 | .need_dac_fix = 1, |
| 7027 | .input_mux = &alc882_capture_source, |
| 7028 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7029 | .init_hook = alc882_targa_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7030 | }, |
| 7031 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7032 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7033 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 7034 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7035 | .dac_nids = alc882_dac_nids, |
| 7036 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7037 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 7038 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7039 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7040 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 7041 | .channel_mode = alc882_3ST_6ch_modes, |
| 7042 | .need_dac_fix = 1, |
| 7043 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7044 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7045 | [ALC882_ASUS_A7M] = { |
| 7046 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 7047 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 7048 | alc880_gpio1_init_verbs, |
| 7049 | alc882_asus_a7m_verbs }, |
| 7050 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7051 | .dac_nids = alc882_dac_nids, |
| 7052 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7053 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 7054 | .channel_mode = alc880_threestack_modes, |
| 7055 | .need_dac_fix = 1, |
| 7056 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7057 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7058 | }; |
| 7059 | |
| 7060 | |
| 7061 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7062 | * Pin config fixes |
| 7063 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7064 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7065 | PINFIX_ABIT_AW9D_MAX |
| 7066 | }; |
| 7067 | |
| 7068 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 7069 | { 0x15, 0x01080104 }, /* side */ |
| 7070 | { 0x16, 0x01011012 }, /* rear */ |
| 7071 | { 0x17, 0x01016011 }, /* clfe */ |
| 7072 | { } |
| 7073 | }; |
| 7074 | |
| 7075 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 7076 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 7077 | }; |
| 7078 | |
| 7079 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 7080 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 7081 | {} |
| 7082 | }; |
| 7083 | |
| 7084 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7085 | * BIOS auto configuration |
| 7086 | */ |
| 7087 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7088 | hda_nid_t nid, int pin_type, |
| 7089 | int dac_idx) |
| 7090 | { |
| 7091 | /* set as output */ |
| 7092 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7093 | int idx; |
| 7094 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7095 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7096 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7097 | idx = 4; |
| 7098 | else |
| 7099 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7100 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7101 | |
| 7102 | } |
| 7103 | |
| 7104 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 7105 | { |
| 7106 | struct alc_spec *spec = codec->spec; |
| 7107 | int i; |
| 7108 | |
| 7109 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7110 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7111 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7112 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7113 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7114 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7115 | } |
| 7116 | } |
| 7117 | |
| 7118 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 7119 | { |
| 7120 | struct alc_spec *spec = codec->spec; |
| 7121 | hda_nid_t pin; |
| 7122 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7123 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7124 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7125 | /* use dac 0 */ |
| 7126 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7127 | pin = spec->autocfg.speaker_pins[0]; |
| 7128 | if (pin) |
| 7129 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7130 | } |
| 7131 | |
| 7132 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7133 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 7134 | |
| 7135 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 7136 | { |
| 7137 | struct alc_spec *spec = codec->spec; |
| 7138 | int i; |
| 7139 | |
| 7140 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7141 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7142 | if (!nid) |
| 7143 | continue; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 7144 | alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7145 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 7146 | snd_hda_codec_write(codec, nid, 0, |
| 7147 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7148 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7149 | } |
| 7150 | } |
| 7151 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7152 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 7153 | { |
| 7154 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7155 | int c; |
| 7156 | |
| 7157 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 7158 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 7159 | hda_nid_t nid = spec->capsrc_nids[c]; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7160 | unsigned int mux_idx; |
| 7161 | const struct hda_input_mux *imux; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7162 | int conns, mute, idx, item; |
| 7163 | |
| 7164 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 7165 | ARRAY_SIZE(conn_list)); |
| 7166 | if (conns < 0) |
| 7167 | continue; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7168 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 7169 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7170 | for (idx = 0; idx < conns; idx++) { |
| 7171 | /* if the current connection is the selected one, |
| 7172 | * unmute it as default - otherwise mute it |
| 7173 | */ |
| 7174 | mute = AMP_IN_MUTE(idx); |
| 7175 | for (item = 0; item < imux->num_items; item++) { |
| 7176 | if (imux->items[item].index == idx) { |
| 7177 | if (spec->cur_mux[c] == item) |
| 7178 | mute = AMP_IN_UNMUTE(idx); |
| 7179 | break; |
| 7180 | } |
| 7181 | } |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7182 | /* check if we have a selector or mixer |
| 7183 | * we could check for the widget type instead, but |
| 7184 | * just check for Amp-In presence (in case of mixer |
| 7185 | * without amp-in there is something wrong, this |
| 7186 | * function shouldn't be used or capsrc nid is wrong) |
| 7187 | */ |
| 7188 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
| 7189 | snd_hda_codec_write(codec, nid, 0, |
| 7190 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7191 | mute); |
| 7192 | else if (mute != AMP_IN_MUTE(idx)) |
| 7193 | snd_hda_codec_write(codec, nid, 0, |
| 7194 | AC_VERB_SET_CONNECT_SEL, |
| 7195 | idx); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7196 | } |
| 7197 | } |
| 7198 | } |
| 7199 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7200 | /* add mic boosts if needed */ |
| 7201 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 7202 | { |
| 7203 | struct alc_spec *spec = codec->spec; |
| 7204 | int err; |
| 7205 | hda_nid_t nid; |
| 7206 | |
| 7207 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7208 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7209 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7210 | "Mic Boost", |
| 7211 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7212 | if (err < 0) |
| 7213 | return err; |
| 7214 | } |
| 7215 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7216 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7217 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7218 | "Front Mic Boost", |
| 7219 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7220 | if (err < 0) |
| 7221 | return err; |
| 7222 | } |
| 7223 | return 0; |
| 7224 | } |
| 7225 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7226 | /* almost identical with ALC880 parser... */ |
| 7227 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 7228 | { |
| 7229 | struct alc_spec *spec = codec->spec; |
| 7230 | int err = alc880_parse_auto_config(codec); |
| 7231 | |
| 7232 | if (err < 0) |
| 7233 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7234 | else if (!err) |
| 7235 | return 0; /* no config found */ |
| 7236 | |
| 7237 | err = alc_auto_add_mic_boost(codec); |
| 7238 | if (err < 0) |
| 7239 | return err; |
| 7240 | |
| 7241 | /* hack - override the init verbs */ |
| 7242 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7243 | |
| 7244 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7245 | } |
| 7246 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7247 | /* additional initialization for auto-configuration model */ |
| 7248 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7249 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7250 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7251 | alc882_auto_init_multi_out(codec); |
| 7252 | alc882_auto_init_hp_out(codec); |
| 7253 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7254 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7255 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7256 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7257 | } |
| 7258 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7259 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7260 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7261 | static int patch_alc882(struct hda_codec *codec) |
| 7262 | { |
| 7263 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7264 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7265 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7266 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7267 | if (spec == NULL) |
| 7268 | return -ENOMEM; |
| 7269 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7270 | codec->spec = spec; |
| 7271 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7272 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7273 | alc882_models, |
| 7274 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7275 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7276 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7277 | /* Pick up systems that don't supply PCI SSID */ |
| 7278 | switch (codec->subsystem_id) { |
| 7279 | case 0x106b0c00: /* Mac Pro */ |
| 7280 | board_config = ALC885_MACPRO; |
| 7281 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7282 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7283 | case 0x106b2800: /* AppleTV */ |
Mark Eggleston | 3077e44 | 2009-01-31 17:57:54 +0100 | [diff] [blame] | 7284 | case 0x106b3e00: /* iMac 24 Aluminium */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7285 | board_config = ALC885_IMAC24; |
| 7286 | break; |
Luke Yelavich | 2d46638 | 2009-02-23 13:00:33 +1100 | [diff] [blame] | 7287 | case 0x106b00a0: /* MacBookPro3,1 - Another revision */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7288 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7289 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7290 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7291 | case 0x106b3600: /* Macbook 3.1 */ |
Luke Yelavich | 2a88464 | 2009-01-28 15:58:38 +1100 | [diff] [blame] | 7292 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7293 | board_config = ALC885_MBP3; |
| 7294 | break; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7295 | case 0x106b3f00: /* Macbook 5,1 */ |
| 7296 | board_config = ALC885_MB5; |
| 7297 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7298 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7299 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7300 | if (codec->revision_id == 0x100101 || |
| 7301 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7302 | alc_free(codec); |
| 7303 | return patch_alc883(codec); |
| 7304 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7305 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 7306 | "trying auto-probe from BIOS...\n"); |
| 7307 | board_config = ALC882_AUTO; |
| 7308 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7309 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7310 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7311 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7312 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7313 | if (board_config == ALC882_AUTO) { |
| 7314 | /* automatic parse from the BIOS config */ |
| 7315 | err = alc882_parse_auto_config(codec); |
| 7316 | if (err < 0) { |
| 7317 | alc_free(codec); |
| 7318 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7319 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7320 | printk(KERN_INFO |
| 7321 | "hda_codec: Cannot set up configuration " |
| 7322 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7323 | board_config = ALC882_3ST_DIG; |
| 7324 | } |
| 7325 | } |
| 7326 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7327 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7328 | if (err < 0) { |
| 7329 | alc_free(codec); |
| 7330 | return err; |
| 7331 | } |
| 7332 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7333 | if (board_config != ALC882_AUTO) |
| 7334 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7335 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 7336 | if (codec->vendor_id == 0x10ec0885) { |
| 7337 | spec->stream_name_analog = "ALC885 Analog"; |
| 7338 | spec->stream_name_digital = "ALC885 Digital"; |
| 7339 | } else { |
| 7340 | spec->stream_name_analog = "ALC882 Analog"; |
| 7341 | spec->stream_name_digital = "ALC882 Digital"; |
| 7342 | } |
| 7343 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7344 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7345 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7346 | /* FIXME: setup DAC5 */ |
| 7347 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7348 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7349 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7350 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7351 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7352 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7353 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7354 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7355 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7356 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7357 | /* get type */ |
| 7358 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7359 | if (wcap != AC_WID_AUD_IN) { |
| 7360 | spec->adc_nids = alc882_adc_nids_alt; |
| 7361 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7362 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7363 | } else { |
| 7364 | spec->adc_nids = alc882_adc_nids; |
| 7365 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7366 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7367 | } |
| 7368 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7369 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7370 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7371 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7372 | spec->vmaster_nid = 0x0c; |
| 7373 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7374 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7375 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7376 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7377 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7378 | if (!spec->loopback.amplist) |
| 7379 | spec->loopback.amplist = alc882_loopbacks; |
| 7380 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7381 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7382 | |
| 7383 | return 0; |
| 7384 | } |
| 7385 | |
| 7386 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7387 | * ALC883 support |
| 7388 | * |
| 7389 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7390 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7391 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7392 | * 6-channel independent captures. |
| 7393 | * |
| 7394 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7395 | * driver yet). |
| 7396 | */ |
| 7397 | #define ALC883_DIGOUT_NID 0x06 |
| 7398 | #define ALC883_DIGIN_NID 0x0a |
| 7399 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7400 | #define ALC1200_DIGOUT_NID 0x10 |
| 7401 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7402 | static hda_nid_t alc883_dac_nids[4] = { |
| 7403 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7404 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7405 | }; |
| 7406 | |
| 7407 | static hda_nid_t alc883_adc_nids[2] = { |
| 7408 | /* ADC1-2 */ |
| 7409 | 0x08, 0x09, |
| 7410 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7411 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7412 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7413 | /* ADC1 */ |
| 7414 | 0x08, |
| 7415 | }; |
| 7416 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7417 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7418 | /* ADC2-1 */ |
| 7419 | 0x09, 0x08 |
| 7420 | }; |
| 7421 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7422 | #define alc889_adc_nids alc880_adc_nids |
| 7423 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7424 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7425 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7426 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7427 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7428 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7429 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7430 | /* input MUX */ |
| 7431 | /* FIXME: should be a matrix-type input source selection */ |
| 7432 | |
| 7433 | static struct hda_input_mux alc883_capture_source = { |
| 7434 | .num_items = 4, |
| 7435 | .items = { |
| 7436 | { "Mic", 0x0 }, |
| 7437 | { "Front Mic", 0x1 }, |
| 7438 | { "Line", 0x2 }, |
| 7439 | { "CD", 0x4 }, |
| 7440 | }, |
| 7441 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7442 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7443 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7444 | .num_items = 4, |
| 7445 | .items = { |
| 7446 | { "Mic", 0x1 }, |
| 7447 | { "Front Mic", 0x0 }, |
| 7448 | { "Line", 0x2 }, |
| 7449 | { "CD", 0x4 }, |
| 7450 | }, |
| 7451 | }; |
| 7452 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7453 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7454 | .num_items = 2, |
| 7455 | .items = { |
| 7456 | { "Mic", 0x1 }, |
| 7457 | { "Line", 0x2 }, |
| 7458 | }, |
| 7459 | }; |
| 7460 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7461 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7462 | .num_items = 4, |
| 7463 | .items = { |
| 7464 | { "Mic", 0x0 }, |
| 7465 | { "iMic", 0x1 }, |
| 7466 | { "Line", 0x2 }, |
| 7467 | { "CD", 0x4 }, |
| 7468 | }, |
| 7469 | }; |
| 7470 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7471 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7472 | .num_items = 2, |
| 7473 | .items = { |
| 7474 | { "Mic", 0x0 }, |
| 7475 | { "Int Mic", 0x1 }, |
| 7476 | }, |
| 7477 | }; |
| 7478 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7479 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7480 | .num_items = 3, |
| 7481 | .items = { |
| 7482 | { "Mic", 0x0 }, |
| 7483 | { "Front Mic", 0x1 }, |
| 7484 | { "Line", 0x4 }, |
| 7485 | }, |
| 7486 | }; |
| 7487 | |
| 7488 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7489 | .num_items = 2, |
| 7490 | .items = { |
| 7491 | { "Mic", 0x0 }, |
| 7492 | { "Line", 0x2 }, |
| 7493 | }, |
| 7494 | }; |
| 7495 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7496 | /* |
| 7497 | * 2ch mode |
| 7498 | */ |
| 7499 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7500 | { 2, NULL } |
| 7501 | }; |
| 7502 | |
| 7503 | /* |
| 7504 | * 2ch mode |
| 7505 | */ |
| 7506 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7507 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7508 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7509 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7510 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7511 | { } /* end */ |
| 7512 | }; |
| 7513 | |
| 7514 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7515 | * 4ch mode |
| 7516 | */ |
| 7517 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7518 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7519 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7520 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7521 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7522 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7523 | { } /* end */ |
| 7524 | }; |
| 7525 | |
| 7526 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7527 | * 6ch mode |
| 7528 | */ |
| 7529 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7530 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7531 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7532 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7533 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7534 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7535 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7536 | { } /* end */ |
| 7537 | }; |
| 7538 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7539 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7540 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7541 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7542 | { 6, alc883_3ST_ch6_init }, |
| 7543 | }; |
| 7544 | |
| 7545 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7546 | * 2ch mode |
| 7547 | */ |
| 7548 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7549 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7550 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7551 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7552 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7553 | { } /* end */ |
| 7554 | }; |
| 7555 | |
| 7556 | /* |
| 7557 | * 4ch mode |
| 7558 | */ |
| 7559 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7560 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7561 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7562 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7563 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7564 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7565 | { } /* end */ |
| 7566 | }; |
| 7567 | |
| 7568 | /* |
| 7569 | * 6ch mode |
| 7570 | */ |
| 7571 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7572 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7573 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7574 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7575 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7576 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7577 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7578 | { } /* end */ |
| 7579 | }; |
| 7580 | |
| 7581 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7582 | { 2, alc883_3ST_ch2_intel_init }, |
| 7583 | { 4, alc883_3ST_ch4_intel_init }, |
| 7584 | { 6, alc883_3ST_ch6_intel_init }, |
| 7585 | }; |
| 7586 | |
| 7587 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7588 | * 6ch mode |
| 7589 | */ |
| 7590 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7591 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7592 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7593 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7594 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7595 | { } /* end */ |
| 7596 | }; |
| 7597 | |
| 7598 | /* |
| 7599 | * 8ch mode |
| 7600 | */ |
| 7601 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7602 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7603 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7604 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7605 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7606 | { } /* end */ |
| 7607 | }; |
| 7608 | |
| 7609 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7610 | { 6, alc883_sixstack_ch6_init }, |
| 7611 | { 8, alc883_sixstack_ch8_init }, |
| 7612 | }; |
| 7613 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7614 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7615 | /* eanable EAPD on medion laptop */ |
| 7616 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7617 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7618 | { } |
| 7619 | }; |
| 7620 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7621 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7622 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7623 | */ |
| 7624 | |
| 7625 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7626 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7627 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7628 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7629 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7630 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7631 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7632 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7633 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7634 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7635 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7636 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7637 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7638 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7639 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7640 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7642 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7643 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7644 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7645 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7646 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7647 | { } /* end */ |
| 7648 | }; |
| 7649 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7650 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7651 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7652 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7653 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7654 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7655 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7656 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7657 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7658 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7659 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7660 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7661 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7662 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7663 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7664 | { } /* end */ |
| 7665 | }; |
| 7666 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7667 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7668 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7669 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7670 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7671 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7672 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7673 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7674 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7675 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7676 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7677 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7678 | { } /* end */ |
| 7679 | }; |
| 7680 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7681 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7682 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7683 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7684 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7685 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7686 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7687 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7688 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7689 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7690 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7691 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7692 | { } /* end */ |
| 7693 | }; |
| 7694 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7695 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7696 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7697 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7698 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7699 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7700 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7701 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7702 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7703 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7704 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7705 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7706 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7707 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7708 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7709 | { } /* end */ |
| 7710 | }; |
| 7711 | |
| 7712 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7713 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7714 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7715 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7716 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7717 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7718 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7719 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7720 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7721 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7722 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7723 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7724 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7725 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7726 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7727 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7728 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7729 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7730 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7731 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7732 | { } /* end */ |
| 7733 | }; |
| 7734 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7735 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7736 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7737 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7738 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7739 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7740 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7741 | HDA_OUTPUT), |
| 7742 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7743 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7744 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7745 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7746 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7747 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7748 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7749 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7750 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7751 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7752 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7753 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7754 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7755 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7756 | { } /* end */ |
| 7757 | }; |
| 7758 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7759 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7760 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7761 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7762 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7763 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7764 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7765 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7766 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7767 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7768 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7769 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7770 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7771 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7772 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7773 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7774 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7775 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7776 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7777 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7778 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7779 | { } /* end */ |
| 7780 | }; |
| 7781 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7782 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7783 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7784 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7785 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7786 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7787 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7788 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7789 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7790 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7791 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7792 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7793 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7794 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7795 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7797 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7798 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7799 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7800 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7801 | |
| 7802 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7803 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7804 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7805 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7806 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7807 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7808 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7809 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7810 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7811 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7812 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7813 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7814 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7815 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7816 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7817 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7818 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7819 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7820 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7821 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7822 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7823 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7824 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7825 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7826 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7827 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7828 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7829 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7830 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7831 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7832 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7833 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7834 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7835 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7836 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7837 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7838 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7839 | { } /* end */ |
| 7840 | }; |
| 7841 | |
| 7842 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7843 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7844 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7845 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7846 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7847 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7848 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7849 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7850 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7851 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7852 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7853 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7854 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7855 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7856 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7857 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7858 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7859 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7860 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7861 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7862 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7863 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7864 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7865 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7866 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7867 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7868 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7869 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7870 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7871 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7872 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7873 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7874 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7875 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7876 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7877 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7878 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7879 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7880 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7881 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7882 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7883 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7884 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7885 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7886 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7887 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7888 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7889 | { } /* end */ |
| 7890 | }; |
| 7891 | |
| 7892 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7893 | .ops = &snd_hda_bind_vol, |
| 7894 | .values = { |
| 7895 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7896 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7897 | 0 |
| 7898 | }, |
| 7899 | }; |
| 7900 | |
| 7901 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7902 | .ops = &snd_hda_bind_sw, |
| 7903 | .values = { |
| 7904 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7905 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7906 | 0 |
| 7907 | }, |
| 7908 | }; |
| 7909 | |
| 7910 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7911 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7912 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7913 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7914 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7915 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7916 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7917 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7918 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7919 | { } /* end */ |
| 7920 | }; |
| 7921 | |
| 7922 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7923 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7924 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7925 | { |
| 7926 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7927 | /* .name = "Capture Source", */ |
| 7928 | .name = "Input Source", |
| 7929 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7930 | .info = alc_mux_enum_info, |
| 7931 | .get = alc_mux_enum_get, |
| 7932 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7933 | }, |
| 7934 | { } /* end */ |
| 7935 | }; |
| 7936 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7937 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7938 | { |
| 7939 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7940 | .name = "Channel Mode", |
| 7941 | .info = alc_ch_mode_info, |
| 7942 | .get = alc_ch_mode_get, |
| 7943 | .put = alc_ch_mode_put, |
| 7944 | }, |
| 7945 | { } /* end */ |
| 7946 | }; |
| 7947 | |
| 7948 | static struct hda_verb alc883_init_verbs[] = { |
| 7949 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7950 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7951 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7952 | /* ADC2: mute amp left and right */ |
| 7953 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7954 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7955 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7956 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7957 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7958 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7959 | /* Rear mixer */ |
| 7960 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7961 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7962 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7963 | /* CLFE mixer */ |
| 7964 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7965 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7966 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7967 | /* Side mixer */ |
| 7968 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7969 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7970 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7971 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7972 | /* mute analog input loopbacks */ |
| 7973 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7974 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7975 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7976 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7977 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7978 | |
| 7979 | /* Front Pin: output 0 (0x0c) */ |
| 7980 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7981 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7982 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7983 | /* Rear Pin: output 1 (0x0d) */ |
| 7984 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7985 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7986 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7987 | /* CLFE Pin: output 2 (0x0e) */ |
| 7988 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7989 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7990 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7991 | /* Side Pin: output 3 (0x0f) */ |
| 7992 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7993 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7994 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7995 | /* Mic (rear) pin: input vref at 80% */ |
| 7996 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7997 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7998 | /* Front Mic pin: input vref at 80% */ |
| 7999 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8000 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8001 | /* Line In pin: input */ |
| 8002 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8003 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8004 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8005 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8006 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8007 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8008 | /* CD pin widget for input */ |
| 8009 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8010 | |
| 8011 | /* FIXME: use matrix-type input source selection */ |
| 8012 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8013 | /* Input mixer2 */ |
| 8014 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8015 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8016 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8017 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8018 | /* Input mixer3 */ |
| 8019 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8020 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8021 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8022 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8023 | { } |
| 8024 | }; |
| 8025 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8026 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8027 | static void alc883_mitac_init_hook(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8028 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8029 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8030 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8031 | spec->autocfg.hp_pins[0] = 0x15; |
| 8032 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8033 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8034 | alc_automute_amp(codec); |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8035 | } |
| 8036 | |
| 8037 | /* auto-toggle front mic */ |
| 8038 | /* |
| 8039 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8040 | { |
| 8041 | unsigned int present; |
| 8042 | unsigned char bits; |
| 8043 | |
| 8044 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8045 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8046 | bits = present ? HDA_AMP_MUTE : 0; |
| 8047 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8048 | } |
| 8049 | */ |
| 8050 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8051 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8052 | /* HP */ |
| 8053 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8054 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8055 | /* Subwoofer */ |
| 8056 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8057 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8058 | |
| 8059 | /* enable unsolicited event */ |
| 8060 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8061 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8062 | |
| 8063 | { } /* end */ |
| 8064 | }; |
| 8065 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8066 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8067 | /* HP */ |
| 8068 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8069 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8070 | /* Int speaker */ |
| 8071 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8072 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8073 | |
| 8074 | /* enable unsolicited event */ |
| 8075 | {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] | 8076 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8077 | |
| 8078 | { } /* end */ |
| 8079 | }; |
| 8080 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8081 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8082 | /* HP */ |
| 8083 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8084 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8085 | /* Subwoofer */ |
| 8086 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8087 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8088 | |
| 8089 | /* enable unsolicited event */ |
| 8090 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8091 | |
| 8092 | { } /* end */ |
| 8093 | }; |
| 8094 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8095 | static struct hda_verb alc883_tagra_verbs[] = { |
| 8096 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8097 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8098 | |
| 8099 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8100 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8101 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8102 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8103 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8104 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8105 | |
| 8106 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8107 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 8108 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 8109 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8110 | |
| 8111 | { } /* end */ |
| 8112 | }; |
| 8113 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8114 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8115 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8116 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8117 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8118 | { } /* end */ |
| 8119 | }; |
| 8120 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8121 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8122 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8123 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8124 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8125 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8126 | { } /* end */ |
| 8127 | }; |
| 8128 | |
| 8129 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8130 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8131 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8132 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8133 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8134 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8135 | { } /* end */ |
| 8136 | }; |
| 8137 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8138 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8139 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8140 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8141 | |
| 8142 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8143 | |
| 8144 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8145 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8146 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8147 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8148 | { } /* end */ |
| 8149 | }; |
| 8150 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8151 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8152 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8153 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8154 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8155 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8156 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8157 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8158 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8159 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8160 | { } /* end */ |
| 8161 | }; |
| 8162 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8163 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8164 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8165 | { } |
| 8166 | }; |
| 8167 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8168 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8169 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8170 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8171 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8172 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8173 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8174 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8175 | spec->autocfg.speaker_pins[2] = 0x18; |
| 8176 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8177 | } |
| 8178 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8179 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8180 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8181 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8182 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8183 | {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] | 8184 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8185 | }; |
| 8186 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8187 | /* |
| 8188 | * 2ch mode |
| 8189 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8190 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8191 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8192 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8193 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8194 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8195 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8196 | }; |
| 8197 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8198 | /* |
| 8199 | * 4ch mode |
| 8200 | */ |
| 8201 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8202 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8203 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8204 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8205 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8206 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8207 | { } /* end */ |
| 8208 | }; |
| 8209 | |
| 8210 | /* |
| 8211 | * 6ch mode |
| 8212 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8213 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8214 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8215 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8216 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8217 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8218 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8219 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8220 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8221 | }; |
| 8222 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8223 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8224 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8225 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8226 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8227 | }; |
| 8228 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8229 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8230 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8231 | { |
| 8232 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8233 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8234 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8235 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8236 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8237 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8238 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8239 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8240 | } |
| 8241 | |
| 8242 | /* toggle RCA according to the front-jack state */ |
| 8243 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8244 | { |
| 8245 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8246 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8247 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8248 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8249 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8250 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8251 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8252 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8253 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8254 | unsigned int res) |
| 8255 | { |
| 8256 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8257 | alc888_lenovo_ms7195_front_automute(codec); |
| 8258 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8259 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8260 | } |
| 8261 | |
| 8262 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8263 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8264 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8265 | |
| 8266 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8267 | |
| 8268 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8269 | { } /* end */ |
| 8270 | }; |
| 8271 | |
| 8272 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8273 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8274 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8275 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8276 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8277 | spec->autocfg.hp_pins[0] = 0x14; |
| 8278 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8279 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8280 | } |
| 8281 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8282 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8283 | #define alc883_tagra_init_hook alc882_targa_init_hook |
| 8284 | #define alc883_tagra_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8285 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8286 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8287 | { |
| 8288 | unsigned int present; |
| 8289 | |
| 8290 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8291 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8292 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8293 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8294 | } |
| 8295 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8296 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8297 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8298 | struct alc_spec *spec = codec->spec; |
| 8299 | |
| 8300 | spec->autocfg.hp_pins[0] = 0x15; |
| 8301 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8302 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8303 | alc883_clevo_m720_mic_automute(codec); |
| 8304 | } |
| 8305 | |
| 8306 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8307 | unsigned int res) |
| 8308 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8309 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8310 | case ALC880_MIC_EVENT: |
| 8311 | alc883_clevo_m720_mic_automute(codec); |
| 8312 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8313 | default: |
| 8314 | alc_automute_amp_unsol_event(codec, res); |
| 8315 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8316 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8317 | } |
| 8318 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8319 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8320 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8321 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8322 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8323 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8324 | spec->autocfg.hp_pins[0] = 0x14; |
| 8325 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8326 | alc_automute_amp(codec); |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8327 | } |
| 8328 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8329 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8330 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8331 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8332 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8333 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8334 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8335 | alc_automute_amp(codec); |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8336 | } |
| 8337 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8338 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8339 | { |
| 8340 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8341 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8342 | |
| 8343 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8344 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8345 | bits = present ? HDA_AMP_MUTE : 0; |
| 8346 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8347 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8348 | } |
| 8349 | |
| 8350 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8351 | { |
| 8352 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8353 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8354 | |
| 8355 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8356 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8357 | bits = present ? HDA_AMP_MUTE : 0; |
| 8358 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8359 | HDA_AMP_MUTE, bits); |
| 8360 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8361 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8362 | } |
| 8363 | |
| 8364 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8365 | unsigned int res) |
| 8366 | { |
| 8367 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8368 | alc883_lenovo_101e_all_automute(codec); |
| 8369 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8370 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8371 | } |
| 8372 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8373 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8374 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8375 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8376 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8377 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8378 | spec->autocfg.hp_pins[0] = 0x14; |
| 8379 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8380 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8381 | alc_automute_amp(codec); |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8382 | } |
| 8383 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8384 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8385 | /* HP Pin: output 0 (0x0c) */ |
| 8386 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8387 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8388 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8389 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8390 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8391 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8392 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8393 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8394 | /* eanable EAPD on medion laptop */ |
| 8395 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8396 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8397 | /* enable unsolicited event */ |
| 8398 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8399 | { } |
| 8400 | }; |
| 8401 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8402 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8403 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8404 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8405 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8406 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8407 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8408 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8409 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8410 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8411 | alc_automute_amp(codec); |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8412 | } |
| 8413 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8414 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8415 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8416 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8417 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8418 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8419 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8420 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8421 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8422 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8423 | spec->autocfg.speaker_pins[4] = 0x1a; |
| 8424 | alc_automute_amp(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8425 | } |
| 8426 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8427 | /* |
| 8428 | * generic initialization of ADC, input mixers and output mixers |
| 8429 | */ |
| 8430 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8431 | /* |
| 8432 | * Unmute ADC0-2 and set the default input to mic-in |
| 8433 | */ |
| 8434 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8435 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8436 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8437 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8438 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8439 | /* 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] | 8440 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8441 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8442 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8443 | */ |
| 8444 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8445 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8446 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8447 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8448 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8449 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8450 | |
| 8451 | /* |
| 8452 | * Set up output mixers (0x0c - 0x0f) |
| 8453 | */ |
| 8454 | /* set vol=0 to output mixers */ |
| 8455 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8456 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8457 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8458 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8459 | /* set up input amps for analog loopback */ |
| 8460 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8461 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8463 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8464 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8465 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8466 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8467 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8468 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8469 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8470 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8471 | |
| 8472 | /* FIXME: use matrix-type input source selection */ |
| 8473 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8474 | /* Input mixer1 */ |
| 8475 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8476 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8477 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8478 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8479 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8480 | /* Input mixer2 */ |
| 8481 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8482 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8483 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8484 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8485 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8486 | |
| 8487 | { } |
| 8488 | }; |
| 8489 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8490 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8491 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8492 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8493 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8494 | /* enable unsolicited event */ |
| 8495 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8496 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8497 | { } /* end */ |
| 8498 | }; |
| 8499 | |
| 8500 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8501 | { |
| 8502 | unsigned int present; |
| 8503 | |
| 8504 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8505 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8506 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8507 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8508 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8509 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8510 | } |
| 8511 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8512 | static void alc883_M90V_init_hook(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8513 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8514 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8515 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8516 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8517 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8518 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8519 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8520 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8521 | } |
| 8522 | |
| 8523 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8524 | unsigned int res) |
| 8525 | { |
| 8526 | switch (res >> 26) { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8527 | case ALC880_MIC_EVENT: |
| 8528 | alc883_nb_mic_automute(codec); |
| 8529 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8530 | default: |
| 8531 | alc_sku_unsol_event(codec, res); |
| 8532 | break; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8533 | } |
| 8534 | } |
| 8535 | |
| 8536 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8537 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8538 | alc883_M90V_init_hook(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8539 | alc883_nb_mic_automute(codec); |
| 8540 | } |
| 8541 | |
| 8542 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8543 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8544 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8545 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8546 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8547 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8548 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8549 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8550 | /* enable unsolicited event */ |
| 8551 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8552 | { } /* end */ |
| 8553 | }; |
| 8554 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8555 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8556 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8557 | struct alc_spec *spec = codec->spec; |
| 8558 | |
| 8559 | spec->autocfg.hp_pins[0] = 0x14; |
| 8560 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8561 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8562 | } |
| 8563 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8564 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8565 | #define alc883_loopbacks alc880_loopbacks |
| 8566 | #endif |
| 8567 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8568 | /* pcm configuration: identiacal with ALC880 */ |
| 8569 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8570 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8571 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8572 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8573 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8574 | |
| 8575 | /* |
| 8576 | * configuration and preset |
| 8577 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8578 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8579 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8580 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8581 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8582 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8583 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8584 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8585 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8586 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8587 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8588 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8589 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8590 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8591 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8592 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8593 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8594 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8595 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8596 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8597 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8598 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8599 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8600 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8601 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8602 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8603 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8604 | [ALC883_AUTO] = "auto", |
| 8605 | }; |
| 8606 | |
| 8607 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8608 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8609 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8610 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8611 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8612 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8613 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8614 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8615 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8616 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8617 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8618 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | b3bdb30 | 2009-02-18 13:16:26 +0100 | [diff] [blame] | 8619 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), |
Takashi Iwai | 9468350 | 2009-02-13 09:31:20 +0100 | [diff] [blame] | 8620 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8621 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 8622 | ALC888_ACER_ASPIRE_4930G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8623 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
| 8624 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame^] | 8625 | /* default Acer -- disabled as it causes more problems. |
| 8626 | * model=auto should work fine now |
| 8627 | */ |
| 8628 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8629 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8630 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8631 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8632 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8633 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8634 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8635 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8636 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8637 | 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] | 8638 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8639 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8640 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8641 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8642 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8643 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8644 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8645 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8646 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8647 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8648 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8649 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8650 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8651 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8652 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8653 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8654 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8655 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8656 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8657 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8658 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8659 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8660 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8661 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8662 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8663 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8664 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8665 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8666 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8667 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8668 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8669 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8670 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8671 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8672 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8673 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8674 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8675 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8676 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8677 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8678 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8679 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8680 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8681 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8682 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8683 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8684 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8685 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8686 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8687 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8688 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8689 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8690 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8691 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8692 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8693 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 8694 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8695 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8696 | {} |
| 8697 | }; |
| 8698 | |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8699 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8700 | ALC1200_DIGOUT_NID, 0, |
| 8701 | }; |
| 8702 | |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 8703 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8704 | ALC883_DIGOUT_NID, 0, |
| 8705 | }; |
| 8706 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8707 | static struct alc_config_preset alc883_presets[] = { |
| 8708 | [ALC883_3ST_2ch_DIG] = { |
| 8709 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8710 | .init_verbs = { alc883_init_verbs }, |
| 8711 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8712 | .dac_nids = alc883_dac_nids, |
| 8713 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8714 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8715 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8716 | .channel_mode = alc883_3ST_2ch_modes, |
| 8717 | .input_mux = &alc883_capture_source, |
| 8718 | }, |
| 8719 | [ALC883_3ST_6ch_DIG] = { |
| 8720 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8721 | .init_verbs = { alc883_init_verbs }, |
| 8722 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8723 | .dac_nids = alc883_dac_nids, |
| 8724 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8725 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8726 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8727 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8728 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8729 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8730 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8731 | [ALC883_3ST_6ch] = { |
| 8732 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8733 | .init_verbs = { alc883_init_verbs }, |
| 8734 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8735 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8736 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8737 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8738 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8739 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8740 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8741 | [ALC883_3ST_6ch_INTEL] = { |
| 8742 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8743 | .init_verbs = { alc883_init_verbs }, |
| 8744 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8745 | .dac_nids = alc883_dac_nids, |
| 8746 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8747 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8748 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8749 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8750 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8751 | .need_dac_fix = 1, |
| 8752 | .input_mux = &alc883_3stack_6ch_intel, |
| 8753 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8754 | [ALC883_6ST_DIG] = { |
| 8755 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8756 | .init_verbs = { alc883_init_verbs }, |
| 8757 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8758 | .dac_nids = alc883_dac_nids, |
| 8759 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8760 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8761 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8762 | .channel_mode = alc883_sixstack_modes, |
| 8763 | .input_mux = &alc883_capture_source, |
| 8764 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8765 | [ALC883_TARGA_DIG] = { |
| 8766 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8767 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8768 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8769 | .dac_nids = alc883_dac_nids, |
| 8770 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8771 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8772 | .channel_mode = alc883_3ST_6ch_modes, |
| 8773 | .need_dac_fix = 1, |
| 8774 | .input_mux = &alc883_capture_source, |
| 8775 | .unsol_event = alc883_tagra_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8776 | .init_hook = alc883_tagra_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8777 | }, |
| 8778 | [ALC883_TARGA_2ch_DIG] = { |
| 8779 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8780 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8781 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8782 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8783 | .adc_nids = alc883_adc_nids_alt, |
| 8784 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8785 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8786 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8787 | .channel_mode = alc883_3ST_2ch_modes, |
| 8788 | .input_mux = &alc883_capture_source, |
| 8789 | .unsol_event = alc883_tagra_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8790 | .init_hook = alc883_tagra_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8791 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8792 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8793 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8794 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8795 | * and the headphone jack. Turn this on and rely on the |
| 8796 | * standard mute methods whenever the user wants to turn |
| 8797 | * these outputs off. |
| 8798 | */ |
| 8799 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8800 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8801 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8802 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8803 | .channel_mode = alc883_3ST_2ch_modes, |
| 8804 | .input_mux = &alc883_capture_source, |
| 8805 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8806 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8807 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8808 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8809 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8810 | .dac_nids = alc883_dac_nids, |
| 8811 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8812 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8813 | .channel_mode = alc883_3ST_2ch_modes, |
| 8814 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8815 | .unsol_event = alc_automute_amp_unsol_event, |
| 8816 | .init_hook = alc883_acer_aspire_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8817 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8818 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8819 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8820 | alc883_chmode_mixer }, |
| 8821 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8822 | alc888_acer_aspire_4930g_verbs }, |
| 8823 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8824 | .dac_nids = alc883_dac_nids, |
| 8825 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8826 | .adc_nids = alc883_adc_nids_rev, |
| 8827 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8828 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8829 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8830 | .channel_mode = alc883_3ST_6ch_modes, |
| 8831 | .need_dac_fix = 1, |
| 8832 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8833 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8834 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8835 | .unsol_event = alc_automute_amp_unsol_event, |
| 8836 | .init_hook = alc888_acer_aspire_4930g_init_hook, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8837 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8838 | [ALC883_MEDION] = { |
| 8839 | .mixers = { alc883_fivestack_mixer, |
| 8840 | alc883_chmode_mixer }, |
| 8841 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8842 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8843 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8844 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8845 | .adc_nids = alc883_adc_nids_alt, |
| 8846 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8847 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8848 | .channel_mode = alc883_sixstack_modes, |
| 8849 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8850 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8851 | [ALC883_MEDION_MD2] = { |
| 8852 | .mixers = { alc883_medion_md2_mixer}, |
| 8853 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8854 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8855 | .dac_nids = alc883_dac_nids, |
| 8856 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8857 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8858 | .channel_mode = alc883_3ST_2ch_modes, |
| 8859 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8860 | .unsol_event = alc_automute_amp_unsol_event, |
| 8861 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8862 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8863 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8864 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8865 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8866 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8867 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8868 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8869 | .channel_mode = alc883_3ST_2ch_modes, |
| 8870 | .input_mux = &alc883_capture_source, |
| 8871 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8872 | [ALC883_CLEVO_M720] = { |
| 8873 | .mixers = { alc883_clevo_m720_mixer }, |
| 8874 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8875 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8876 | .dac_nids = alc883_dac_nids, |
| 8877 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8878 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8879 | .channel_mode = alc883_3ST_2ch_modes, |
| 8880 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8881 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8882 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8883 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8884 | [ALC883_LENOVO_101E_2ch] = { |
| 8885 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8886 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8887 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8888 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8889 | .adc_nids = alc883_adc_nids_alt, |
| 8890 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8891 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8892 | .channel_mode = alc883_3ST_2ch_modes, |
| 8893 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8894 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8895 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8896 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8897 | [ALC883_LENOVO_NB0763] = { |
| 8898 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8899 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8900 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8901 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8902 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8903 | .channel_mode = alc883_3ST_2ch_modes, |
| 8904 | .need_dac_fix = 1, |
| 8905 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8906 | .unsol_event = alc_automute_amp_unsol_event, |
| 8907 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8908 | }, |
| 8909 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8910 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8911 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8912 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8913 | .dac_nids = alc883_dac_nids, |
| 8914 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8915 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8916 | .channel_mode = alc883_3ST_6ch_modes, |
| 8917 | .need_dac_fix = 1, |
| 8918 | .input_mux = &alc883_capture_source, |
| 8919 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8920 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8921 | }, |
| 8922 | [ALC883_HAIER_W66] = { |
| 8923 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8924 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8925 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8926 | .dac_nids = alc883_dac_nids, |
| 8927 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8928 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8929 | .channel_mode = alc883_3ST_2ch_modes, |
| 8930 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8931 | .unsol_event = alc_automute_amp_unsol_event, |
| 8932 | .init_hook = alc883_haier_w66_init_hook, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8933 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8934 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8935 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8936 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8937 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8938 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8939 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8940 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8941 | .need_dac_fix = 1, |
| 8942 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8943 | .unsol_event = alc_automute_amp_unsol_event, |
| 8944 | .init_hook = alc888_3st_hp_init_hook, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8945 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8946 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8947 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8948 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8949 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8950 | .dac_nids = alc883_dac_nids, |
| 8951 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8952 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8953 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8954 | .channel_mode = alc883_sixstack_modes, |
| 8955 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8956 | .unsol_event = alc_automute_amp_unsol_event, |
| 8957 | .init_hook = alc888_6st_dell_init_hook, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8958 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8959 | [ALC883_MITAC] = { |
| 8960 | .mixers = { alc883_mitac_mixer }, |
| 8961 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8962 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8963 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8964 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8965 | .channel_mode = alc883_3ST_2ch_modes, |
| 8966 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8967 | .unsol_event = alc_automute_amp_unsol_event, |
| 8968 | .init_hook = alc883_mitac_init_hook, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8969 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8970 | [ALC883_FUJITSU_PI2515] = { |
| 8971 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8972 | .init_verbs = { alc883_init_verbs, |
| 8973 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8974 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8975 | .dac_nids = alc883_dac_nids, |
| 8976 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8977 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8978 | .channel_mode = alc883_3ST_2ch_modes, |
| 8979 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8980 | .unsol_event = alc_automute_amp_unsol_event, |
| 8981 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8982 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8983 | [ALC888_FUJITSU_XA3530] = { |
| 8984 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 8985 | .init_verbs = { alc883_init_verbs, |
| 8986 | alc888_fujitsu_xa3530_verbs }, |
| 8987 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8988 | .dac_nids = alc883_dac_nids, |
| 8989 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8990 | .adc_nids = alc883_adc_nids_rev, |
| 8991 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8992 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8993 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 8994 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 8995 | .num_mux_defs = |
| 8996 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8997 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8998 | .unsol_event = alc_automute_amp_unsol_event, |
| 8999 | .init_hook = alc888_fujitsu_xa3530_init_hook, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9000 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9001 | [ALC888_LENOVO_SKY] = { |
| 9002 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9003 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9004 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9005 | .dac_nids = alc883_dac_nids, |
| 9006 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9007 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9008 | .channel_mode = alc883_sixstack_modes, |
| 9009 | .need_dac_fix = 1, |
| 9010 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9011 | .unsol_event = alc_automute_amp_unsol_event, |
| 9012 | .init_hook = alc888_lenovo_sky_init_hook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9013 | }, |
| 9014 | [ALC888_ASUS_M90V] = { |
| 9015 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9016 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9017 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9018 | .dac_nids = alc883_dac_nids, |
| 9019 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9020 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9021 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9022 | .channel_mode = alc883_3ST_6ch_modes, |
| 9023 | .need_dac_fix = 1, |
| 9024 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9025 | .unsol_event = alc883_mode2_unsol_event, |
| 9026 | .init_hook = alc883_mode2_inithook, |
| 9027 | }, |
| 9028 | [ALC888_ASUS_EEE1601] = { |
| 9029 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9030 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9031 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9032 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9033 | .dac_nids = alc883_dac_nids, |
| 9034 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9035 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9036 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9037 | .channel_mode = alc883_3ST_2ch_modes, |
| 9038 | .need_dac_fix = 1, |
| 9039 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9040 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9041 | .init_hook = alc883_eee1601_inithook, |
| 9042 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9043 | [ALC1200_ASUS_P5Q] = { |
| 9044 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9045 | .init_verbs = { alc883_init_verbs }, |
| 9046 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9047 | .dac_nids = alc883_dac_nids, |
| 9048 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9049 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9050 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9051 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9052 | .channel_mode = alc883_sixstack_modes, |
| 9053 | .input_mux = &alc883_capture_source, |
| 9054 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9055 | }; |
| 9056 | |
| 9057 | |
| 9058 | /* |
| 9059 | * BIOS auto configuration |
| 9060 | */ |
| 9061 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9062 | hda_nid_t nid, int pin_type, |
| 9063 | int dac_idx) |
| 9064 | { |
| 9065 | /* set as output */ |
| 9066 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9067 | int idx; |
| 9068 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9069 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9070 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9071 | idx = 4; |
| 9072 | else |
| 9073 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9074 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9075 | |
| 9076 | } |
| 9077 | |
| 9078 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 9079 | { |
| 9080 | struct alc_spec *spec = codec->spec; |
| 9081 | int i; |
| 9082 | |
| 9083 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9084 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9085 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9086 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9087 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9088 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9089 | } |
| 9090 | } |
| 9091 | |
| 9092 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 9093 | { |
| 9094 | struct alc_spec *spec = codec->spec; |
| 9095 | hda_nid_t pin; |
| 9096 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9097 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9098 | if (pin) /* connect to front */ |
| 9099 | /* use dac 0 */ |
| 9100 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9101 | pin = spec->autocfg.speaker_pins[0]; |
| 9102 | if (pin) |
| 9103 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9104 | } |
| 9105 | |
| 9106 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9107 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 9108 | |
| 9109 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 9110 | { |
| 9111 | struct alc_spec *spec = codec->spec; |
| 9112 | int i; |
| 9113 | |
| 9114 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9115 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9116 | if (alc883_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 9117 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 9118 | if (nid != ALC883_PIN_CD_NID && |
| 9119 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9120 | snd_hda_codec_write(codec, nid, 0, |
| 9121 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9122 | AMP_OUT_MUTE); |
| 9123 | } |
| 9124 | } |
| 9125 | } |
| 9126 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9127 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 9128 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9129 | /* almost identical with ALC880 parser... */ |
| 9130 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 9131 | { |
| 9132 | struct alc_spec *spec = codec->spec; |
| 9133 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9134 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 9135 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9136 | |
| 9137 | if (err < 0) |
| 9138 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9139 | else if (!err) |
| 9140 | return 0; /* no config found */ |
| 9141 | |
| 9142 | err = alc_auto_add_mic_boost(codec); |
| 9143 | if (err < 0) |
| 9144 | return err; |
| 9145 | |
| 9146 | /* hack - override the init verbs */ |
| 9147 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9148 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9149 | /* setup input_mux for ALC889 */ |
| 9150 | if (codec->vendor_id == 0x10ec0889) { |
| 9151 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9152 | * because it's under 0x18 |
| 9153 | */ |
| 9154 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9155 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9156 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9157 | for (i = 1; i < 3; i++) |
| 9158 | memcpy(&spec->private_imux[i], |
| 9159 | &spec->private_imux[0], |
| 9160 | sizeof(spec->private_imux[0])); |
| 9161 | imux->items[imux->num_items].label = "Int DMic"; |
| 9162 | imux->items[imux->num_items].index = 0x0b; |
| 9163 | imux->num_items++; |
| 9164 | spec->num_mux_defs = 3; |
| 9165 | spec->input_mux = spec->private_imux; |
| 9166 | } |
| 9167 | } |
| 9168 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9169 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9170 | } |
| 9171 | |
| 9172 | /* additional initialization for auto-configuration model */ |
| 9173 | static void alc883_auto_init(struct hda_codec *codec) |
| 9174 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9175 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9176 | alc883_auto_init_multi_out(codec); |
| 9177 | alc883_auto_init_hp_out(codec); |
| 9178 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9179 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9180 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9181 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9182 | } |
| 9183 | |
| 9184 | static int patch_alc883(struct hda_codec *codec) |
| 9185 | { |
| 9186 | struct alc_spec *spec; |
| 9187 | int err, board_config; |
| 9188 | |
| 9189 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9190 | if (spec == NULL) |
| 9191 | return -ENOMEM; |
| 9192 | |
| 9193 | codec->spec = spec; |
| 9194 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9195 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9196 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9197 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9198 | alc883_models, |
| 9199 | alc883_cfg_tbl); |
| 9200 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9201 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 9202 | "trying auto-probe from BIOS...\n"); |
| 9203 | board_config = ALC883_AUTO; |
| 9204 | } |
| 9205 | |
| 9206 | if (board_config == ALC883_AUTO) { |
| 9207 | /* automatic parse from the BIOS config */ |
| 9208 | err = alc883_parse_auto_config(codec); |
| 9209 | if (err < 0) { |
| 9210 | alc_free(codec); |
| 9211 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9212 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9213 | printk(KERN_INFO |
| 9214 | "hda_codec: Cannot set up configuration " |
| 9215 | "from BIOS. Using base mode...\n"); |
| 9216 | board_config = ALC883_3ST_2ch_DIG; |
| 9217 | } |
| 9218 | } |
| 9219 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9220 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9221 | if (err < 0) { |
| 9222 | alc_free(codec); |
| 9223 | return err; |
| 9224 | } |
| 9225 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9226 | if (board_config != ALC883_AUTO) |
| 9227 | setup_preset(spec, &alc883_presets[board_config]); |
| 9228 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9229 | switch (codec->vendor_id) { |
| 9230 | case 0x10ec0888: |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 9231 | if (codec->revision_id == 0x100101) { |
| 9232 | spec->stream_name_analog = "ALC1200 Analog"; |
| 9233 | spec->stream_name_digital = "ALC1200 Digital"; |
| 9234 | } else { |
| 9235 | spec->stream_name_analog = "ALC888 Analog"; |
| 9236 | spec->stream_name_digital = "ALC888 Digital"; |
| 9237 | } |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9238 | if (!spec->num_adc_nids) { |
| 9239 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9240 | spec->adc_nids = alc883_adc_nids; |
| 9241 | } |
| 9242 | if (!spec->capsrc_nids) |
| 9243 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9244 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9245 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9246 | break; |
| 9247 | case 0x10ec0889: |
| 9248 | spec->stream_name_analog = "ALC889 Analog"; |
| 9249 | spec->stream_name_digital = "ALC889 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9250 | if (!spec->num_adc_nids) { |
| 9251 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9252 | spec->adc_nids = alc889_adc_nids; |
| 9253 | } |
| 9254 | if (!spec->capsrc_nids) |
| 9255 | spec->capsrc_nids = alc889_capsrc_nids; |
| 9256 | spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style |
| 9257 | capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9258 | break; |
| 9259 | default: |
| 9260 | spec->stream_name_analog = "ALC883 Analog"; |
| 9261 | spec->stream_name_digital = "ALC883 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9262 | if (!spec->num_adc_nids) { |
| 9263 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9264 | spec->adc_nids = alc883_adc_nids; |
| 9265 | } |
| 9266 | if (!spec->capsrc_nids) |
| 9267 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9268 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9269 | break; |
| 9270 | } |
| 9271 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9272 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9273 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9274 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9275 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9276 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9277 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9278 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9279 | if (!spec->cap_mixer) |
| 9280 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9281 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9282 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9283 | spec->vmaster_nid = 0x0c; |
| 9284 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9285 | codec->patch_ops = alc_patch_ops; |
| 9286 | if (board_config == ALC883_AUTO) |
| 9287 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9288 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9289 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9290 | if (!spec->loopback.amplist) |
| 9291 | spec->loopback.amplist = alc883_loopbacks; |
| 9292 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9293 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9294 | |
| 9295 | return 0; |
| 9296 | } |
| 9297 | |
| 9298 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9299 | * ALC262 support |
| 9300 | */ |
| 9301 | |
| 9302 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9303 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9304 | |
| 9305 | #define alc262_dac_nids alc260_dac_nids |
| 9306 | #define alc262_adc_nids alc882_adc_nids |
| 9307 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9308 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9309 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9310 | |
| 9311 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9312 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9313 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9314 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9315 | /* ADC0 */ |
| 9316 | 0x09 |
| 9317 | }; |
| 9318 | |
| 9319 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9320 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9321 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9322 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9323 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9324 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9325 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9326 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9327 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9328 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9329 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9330 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9331 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9332 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9333 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9334 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9335 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9336 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9337 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9338 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9339 | }; |
| 9340 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9341 | /* update HP, line and mono-out pins according to the master switch */ |
| 9342 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9343 | { |
| 9344 | struct alc_spec *spec = codec->spec; |
| 9345 | int val = spec->master_sw; |
| 9346 | |
| 9347 | /* HP & line-out */ |
| 9348 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9349 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9350 | val ? PIN_HP : 0); |
| 9351 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9352 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9353 | val ? PIN_HP : 0); |
| 9354 | /* mono (speaker) depending on the HP jack sense */ |
| 9355 | val = val && !spec->jack_present; |
| 9356 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9357 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9358 | val ? PIN_OUT : 0); |
| 9359 | } |
| 9360 | |
| 9361 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9362 | { |
| 9363 | struct alc_spec *spec = codec->spec; |
| 9364 | unsigned int presence; |
| 9365 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9366 | AC_VERB_GET_PIN_SENSE, 0); |
| 9367 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9368 | alc262_hp_master_update(codec); |
| 9369 | } |
| 9370 | |
| 9371 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9372 | { |
| 9373 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9374 | return; |
| 9375 | alc262_hp_bpc_automute(codec); |
| 9376 | } |
| 9377 | |
| 9378 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9379 | { |
| 9380 | struct alc_spec *spec = codec->spec; |
| 9381 | unsigned int presence; |
| 9382 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9383 | AC_VERB_GET_PIN_SENSE, 0); |
| 9384 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9385 | alc262_hp_master_update(codec); |
| 9386 | } |
| 9387 | |
| 9388 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9389 | unsigned int res) |
| 9390 | { |
| 9391 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9392 | return; |
| 9393 | alc262_hp_wildwest_automute(codec); |
| 9394 | } |
| 9395 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9396 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9397 | |
| 9398 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9399 | struct snd_ctl_elem_value *ucontrol) |
| 9400 | { |
| 9401 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9402 | struct alc_spec *spec = codec->spec; |
| 9403 | int val = !!*ucontrol->value.integer.value; |
| 9404 | |
| 9405 | if (val == spec->master_sw) |
| 9406 | return 0; |
| 9407 | spec->master_sw = val; |
| 9408 | alc262_hp_master_update(codec); |
| 9409 | return 1; |
| 9410 | } |
| 9411 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9412 | #define ALC262_HP_MASTER_SWITCH \ |
| 9413 | { \ |
| 9414 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9415 | .name = "Master Playback Switch", \ |
| 9416 | .info = snd_ctl_boolean_mono_info, \ |
| 9417 | .get = alc262_hp_master_sw_get, \ |
| 9418 | .put = alc262_hp_master_sw_put, \ |
| 9419 | } |
| 9420 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9421 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9422 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9423 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9424 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9425 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9426 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9427 | HDA_OUTPUT), |
| 9428 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9429 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9431 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9432 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9433 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9434 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9435 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9436 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9437 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9438 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9439 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9440 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9441 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9442 | { } /* end */ |
| 9443 | }; |
| 9444 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9445 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9446 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9447 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9448 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9449 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9450 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9451 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9452 | HDA_OUTPUT), |
| 9453 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9454 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9455 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9456 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9457 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9458 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9459 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9460 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9461 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9462 | { } /* end */ |
| 9463 | }; |
| 9464 | |
| 9465 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9466 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9467 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9468 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9469 | { } /* end */ |
| 9470 | }; |
| 9471 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9472 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9473 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9474 | { |
| 9475 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9476 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9477 | spec->autocfg.hp_pins[0] = 0x15; |
| 9478 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
| 9479 | alc_automute_amp(codec); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9480 | } |
| 9481 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9482 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9483 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9484 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9485 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9486 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9487 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9488 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9489 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9490 | { } /* end */ |
| 9491 | }; |
| 9492 | |
| 9493 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9494 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9495 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9496 | |
| 9497 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9498 | { } |
| 9499 | }; |
| 9500 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9501 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9502 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9503 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9504 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9505 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9506 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9507 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9508 | { } /* end */ |
| 9509 | }; |
| 9510 | |
| 9511 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9512 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9513 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9514 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9515 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9516 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9517 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9518 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9519 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9520 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9521 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9522 | {} |
| 9523 | }; |
| 9524 | |
| 9525 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9526 | .num_items = 1, |
| 9527 | .items = { |
| 9528 | { "Line", 0x1 }, |
| 9529 | }, |
| 9530 | }; |
| 9531 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9532 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 9533 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 9534 | { |
| 9535 | struct alc_spec *spec = codec->spec; |
| 9536 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9537 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 9538 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 9539 | unsigned int mute; |
| 9540 | |
| 9541 | /* HP */ |
| 9542 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 9543 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 9544 | HDA_AMP_MUTE, mute); |
| 9545 | /* mute internal speaker per jack sense */ |
| 9546 | if (spec->jack_present) |
| 9547 | mute = HDA_AMP_MUTE; |
| 9548 | if (line_nid) |
| 9549 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 9550 | HDA_AMP_MUTE, mute); |
| 9551 | if (speaker_nid && speaker_nid != line_nid) |
| 9552 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 9553 | HDA_AMP_MUTE, mute); |
| 9554 | } |
| 9555 | |
| 9556 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 9557 | |
| 9558 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9559 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9560 | { |
| 9561 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9562 | struct alc_spec *spec = codec->spec; |
| 9563 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9564 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9565 | if (val == spec->master_sw) |
| 9566 | return 0; |
| 9567 | spec->master_sw = val; |
| 9568 | alc262_hippo_master_update(codec); |
| 9569 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9570 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9571 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9572 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 9573 | { \ |
| 9574 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9575 | .name = "Master Playback Switch", \ |
| 9576 | .info = snd_ctl_boolean_mono_info, \ |
| 9577 | .get = alc262_hippo_master_sw_get, \ |
| 9578 | .put = alc262_hippo_master_sw_put, \ |
| 9579 | } |
| 9580 | |
| 9581 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 9582 | ALC262_HIPPO_MASTER_SWITCH, |
| 9583 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9584 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9585 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9586 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9587 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9588 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9589 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9590 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9591 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9592 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9593 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9594 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9595 | { } /* end */ |
| 9596 | }; |
| 9597 | |
| 9598 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9599 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9600 | ALC262_HIPPO_MASTER_SWITCH, |
| 9601 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9602 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9603 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9604 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9605 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9606 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9607 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9608 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9609 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9610 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9611 | { } /* end */ |
| 9612 | }; |
| 9613 | |
| 9614 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9615 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 9616 | { |
| 9617 | struct alc_spec *spec = codec->spec; |
| 9618 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9619 | unsigned int present; |
| 9620 | |
| 9621 | /* need to execute and sync at first */ |
| 9622 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9623 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 9624 | AC_VERB_GET_PIN_SENSE, 0); |
| 9625 | spec->jack_present = (present & 0x80000000) != 0; |
| 9626 | alc262_hippo_master_update(codec); |
| 9627 | } |
| 9628 | |
| 9629 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9630 | { |
| 9631 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9632 | return; |
| 9633 | alc262_hippo_automute(codec); |
| 9634 | } |
| 9635 | |
| 9636 | static void alc262_hippo_init_hook(struct hda_codec *codec) |
| 9637 | { |
| 9638 | struct alc_spec *spec = codec->spec; |
| 9639 | |
| 9640 | spec->autocfg.hp_pins[0] = 0x15; |
| 9641 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9642 | alc262_hippo_automute(codec); |
| 9643 | } |
| 9644 | |
| 9645 | static void alc262_hippo1_init_hook(struct hda_codec *codec) |
| 9646 | { |
| 9647 | struct alc_spec *spec = codec->spec; |
| 9648 | |
| 9649 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9650 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9651 | alc262_hippo_automute(codec); |
| 9652 | } |
| 9653 | |
| 9654 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9655 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9656 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9657 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9658 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9659 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9660 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9661 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9662 | { } /* end */ |
| 9663 | }; |
| 9664 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9665 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9666 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9667 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9668 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9669 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9670 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9671 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9672 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9673 | { } /* end */ |
| 9674 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9675 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9676 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 9677 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9678 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9679 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9680 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9681 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9682 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9683 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9684 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9685 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9686 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9687 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9688 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9689 | { } /* end */ |
| 9690 | }; |
| 9691 | |
| 9692 | static struct hda_verb alc262_tyan_verbs[] = { |
| 9693 | /* Headphone automute */ |
| 9694 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9695 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9696 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9697 | |
| 9698 | /* P11 AUX_IN, white 4-pin connector */ |
| 9699 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9700 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 9701 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 9702 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 9703 | |
| 9704 | {} |
| 9705 | }; |
| 9706 | |
| 9707 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9708 | static void alc262_tyan_init_hook(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9709 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9710 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9711 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9712 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9713 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9714 | alc_automute_amp(codec); |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9715 | } |
| 9716 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9717 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9718 | #define alc262_capture_mixer alc882_capture_mixer |
| 9719 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9720 | |
| 9721 | /* |
| 9722 | * generic initialization of ADC, input mixers and output mixers |
| 9723 | */ |
| 9724 | static struct hda_verb alc262_init_verbs[] = { |
| 9725 | /* |
| 9726 | * Unmute ADC0-2 and set the default input to mic-in |
| 9727 | */ |
| 9728 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9729 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9730 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9731 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9732 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9733 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9734 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9735 | /* 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] | 9736 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9737 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9738 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9739 | */ |
| 9740 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9741 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9742 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9743 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9744 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9745 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9746 | |
| 9747 | /* |
| 9748 | * Set up output mixers (0x0c - 0x0e) |
| 9749 | */ |
| 9750 | /* set vol=0 to output mixers */ |
| 9751 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9752 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9753 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9754 | /* set up input amps for analog loopback */ |
| 9755 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9756 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9757 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9758 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9759 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9760 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9761 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9762 | |
| 9763 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9764 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9765 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9766 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9767 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9768 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9769 | |
| 9770 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9771 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9772 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9773 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9774 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9775 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9776 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9777 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9778 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9779 | /* FIXME: use matrix-type input source selection */ |
| 9780 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9781 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9782 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9783 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9784 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9785 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9786 | /* Input mixer2 */ |
| 9787 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9788 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9789 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9790 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9791 | /* Input mixer3 */ |
| 9792 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9793 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9794 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9795 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9796 | |
| 9797 | { } |
| 9798 | }; |
| 9799 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9800 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9801 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9802 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9803 | { } |
| 9804 | }; |
| 9805 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9806 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9807 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9808 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9809 | {} |
| 9810 | }; |
| 9811 | |
| 9812 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9813 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9814 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9815 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9816 | |
| 9817 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9818 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9819 | {} |
| 9820 | }; |
| 9821 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9822 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9823 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9824 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9825 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9826 | |
| 9827 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9828 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9829 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9830 | }; |
| 9831 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9832 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9833 | .num_items = 2, |
| 9834 | .items = { |
| 9835 | { "Int DMic", 0x9 }, |
| 9836 | { "Mic", 0x0 }, |
| 9837 | }, |
| 9838 | }; |
| 9839 | |
| 9840 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9841 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9842 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9843 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9844 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9845 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9846 | { } /* end */ |
| 9847 | }; |
| 9848 | |
| 9849 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9850 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9851 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9852 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9853 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9854 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9855 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9856 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9857 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9858 | {} |
| 9859 | }; |
| 9860 | |
| 9861 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9862 | { |
| 9863 | unsigned int present; |
| 9864 | |
| 9865 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9866 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9867 | snd_hda_codec_write(codec, 0x22, 0, |
| 9868 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9869 | } |
| 9870 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9871 | |
| 9872 | /* unsolicited event for HP jack sensing */ |
| 9873 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9874 | unsigned int res) |
| 9875 | { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9876 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9877 | alc262_dmic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9878 | else |
| 9879 | alc_sku_unsol_event(codec, res); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9880 | } |
| 9881 | |
| 9882 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9883 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9884 | struct alc_spec *spec = codec->spec; |
| 9885 | |
| 9886 | spec->autocfg.hp_pins[0] = 0x15; |
| 9887 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9888 | alc_automute_pin(codec); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9889 | alc262_dmic_automute(codec); |
| 9890 | } |
| 9891 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9892 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9893 | * nec model |
| 9894 | * 0x15 = headphone |
| 9895 | * 0x16 = internal speaker |
| 9896 | * 0x18 = external mic |
| 9897 | */ |
| 9898 | |
| 9899 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9900 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9901 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9902 | |
| 9903 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9904 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9905 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9906 | |
| 9907 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9908 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9909 | { } /* end */ |
| 9910 | }; |
| 9911 | |
| 9912 | static struct hda_verb alc262_nec_verbs[] = { |
| 9913 | /* Unmute Speaker */ |
| 9914 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9915 | |
| 9916 | /* Headphone */ |
| 9917 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9918 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9919 | |
| 9920 | /* External mic to headphone */ |
| 9921 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9922 | /* External mic to speaker */ |
| 9923 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9924 | {} |
| 9925 | }; |
| 9926 | |
| 9927 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9928 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9929 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 9930 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9931 | */ |
| 9932 | |
| 9933 | #define ALC_HP_EVENT 0x37 |
| 9934 | |
| 9935 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 9936 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9937 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9938 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9939 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9940 | {} |
| 9941 | }; |
| 9942 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9943 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9944 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9945 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9946 | {} |
| 9947 | }; |
| 9948 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9949 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9950 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9951 | .items = { |
| 9952 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9953 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9954 | { "CD", 0x4 }, |
| 9955 | }, |
| 9956 | }; |
| 9957 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9958 | static struct hda_input_mux alc262_HP_capture_source = { |
| 9959 | .num_items = 5, |
| 9960 | .items = { |
| 9961 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9962 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9963 | { "Line", 0x2 }, |
| 9964 | { "CD", 0x4 }, |
| 9965 | { "AUX IN", 0x6 }, |
| 9966 | }, |
| 9967 | }; |
| 9968 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9969 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 9970 | .num_items = 4, |
| 9971 | .items = { |
| 9972 | { "Mic", 0x0 }, |
| 9973 | { "Front Mic", 0x2 }, |
| 9974 | { "Line", 0x1 }, |
| 9975 | { "CD", 0x4 }, |
| 9976 | }, |
| 9977 | }; |
| 9978 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9979 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9980 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 9981 | { |
| 9982 | struct alc_spec *spec = codec->spec; |
| 9983 | unsigned int mute; |
| 9984 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9985 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9986 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9987 | /* need to execute and sync at first */ |
| 9988 | 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] | 9989 | /* check laptop HP jack */ |
| 9990 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9991 | AC_VERB_GET_PIN_SENSE, 0); |
| 9992 | /* need to execute and sync at first */ |
| 9993 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9994 | /* check docking HP jack */ |
| 9995 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 9996 | AC_VERB_GET_PIN_SENSE, 0); |
| 9997 | if (present & AC_PINSENSE_PRESENCE) |
| 9998 | spec->jack_present = 1; |
| 9999 | else |
| 10000 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10001 | spec->sense_updated = 1; |
| 10002 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10003 | /* unmute internal speaker only if both HPs are unplugged and |
| 10004 | * master switch is on |
| 10005 | */ |
| 10006 | if (spec->jack_present) |
| 10007 | mute = HDA_AMP_MUTE; |
| 10008 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10009 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10010 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10011 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10012 | } |
| 10013 | |
| 10014 | /* unsolicited event for HP jack sensing */ |
| 10015 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10016 | unsigned int res) |
| 10017 | { |
| 10018 | if ((res >> 26) != ALC_HP_EVENT) |
| 10019 | return; |
| 10020 | alc262_fujitsu_automute(codec, 1); |
| 10021 | } |
| 10022 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10023 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10024 | { |
| 10025 | alc262_fujitsu_automute(codec, 1); |
| 10026 | } |
| 10027 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10028 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10029 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10030 | .ops = &snd_hda_bind_vol, |
| 10031 | .values = { |
| 10032 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10033 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10034 | 0 |
| 10035 | }, |
| 10036 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10037 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10038 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10039 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10040 | { |
| 10041 | struct alc_spec *spec = codec->spec; |
| 10042 | unsigned int mute; |
| 10043 | |
| 10044 | if (force || !spec->sense_updated) { |
| 10045 | unsigned int present_int_hp; |
| 10046 | /* need to execute and sync at first */ |
| 10047 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10048 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10049 | AC_VERB_GET_PIN_SENSE, 0); |
| 10050 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10051 | spec->sense_updated = 1; |
| 10052 | } |
| 10053 | if (spec->jack_present) { |
| 10054 | /* mute internal speaker */ |
| 10055 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10056 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10057 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10058 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10059 | } else { |
| 10060 | /* unmute internal speaker if necessary */ |
| 10061 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10062 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10063 | HDA_AMP_MUTE, mute); |
| 10064 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10065 | HDA_AMP_MUTE, mute); |
| 10066 | } |
| 10067 | } |
| 10068 | |
| 10069 | /* unsolicited event for HP jack sensing */ |
| 10070 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10071 | unsigned int res) |
| 10072 | { |
| 10073 | if ((res >> 26) != ALC_HP_EVENT) |
| 10074 | return; |
| 10075 | alc262_lenovo_3000_automute(codec, 1); |
| 10076 | } |
| 10077 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10078 | /* bind hp and internal speaker mute (with plug check) */ |
| 10079 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10080 | struct snd_ctl_elem_value *ucontrol) |
| 10081 | { |
| 10082 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10083 | long *valp = ucontrol->value.integer.value; |
| 10084 | int change; |
| 10085 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10086 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10087 | HDA_AMP_MUTE, |
| 10088 | valp ? 0 : HDA_AMP_MUTE); |
| 10089 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10090 | HDA_AMP_MUTE, |
| 10091 | valp ? 0 : HDA_AMP_MUTE); |
| 10092 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10093 | if (change) |
| 10094 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10095 | return change; |
| 10096 | } |
| 10097 | |
| 10098 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10099 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10100 | { |
| 10101 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10102 | .name = "Master Playback Switch", |
| 10103 | .info = snd_hda_mixer_amp_switch_info, |
| 10104 | .get = snd_hda_mixer_amp_switch_get, |
| 10105 | .put = alc262_fujitsu_master_sw_put, |
| 10106 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10107 | }, |
| 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("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10111 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10112 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10113 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10114 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10115 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10116 | { } /* end */ |
| 10117 | }; |
| 10118 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10119 | /* bind hp and internal speaker mute (with plug check) */ |
| 10120 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10121 | struct snd_ctl_elem_value *ucontrol) |
| 10122 | { |
| 10123 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10124 | long *valp = ucontrol->value.integer.value; |
| 10125 | int change; |
| 10126 | |
| 10127 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10128 | HDA_AMP_MUTE, |
| 10129 | valp ? 0 : HDA_AMP_MUTE); |
| 10130 | |
| 10131 | if (change) |
| 10132 | alc262_lenovo_3000_automute(codec, 0); |
| 10133 | return change; |
| 10134 | } |
| 10135 | |
| 10136 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10137 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10138 | { |
| 10139 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10140 | .name = "Master Playback Switch", |
| 10141 | .info = snd_hda_mixer_amp_switch_info, |
| 10142 | .get = snd_hda_mixer_amp_switch_get, |
| 10143 | .put = alc262_lenovo_3000_master_sw_put, |
| 10144 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10145 | }, |
| 10146 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10147 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10148 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10149 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10150 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10151 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10152 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10153 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10154 | { } /* end */ |
| 10155 | }; |
| 10156 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10157 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10158 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10159 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10160 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10161 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10162 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10163 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10164 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10165 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10166 | { } /* end */ |
| 10167 | }; |
| 10168 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10169 | /* additional init verbs for Benq laptops */ |
| 10170 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10171 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10172 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10173 | {} |
| 10174 | }; |
| 10175 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10176 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10177 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10178 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10179 | |
| 10180 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10181 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10182 | {} |
| 10183 | }; |
| 10184 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10185 | /* Samsung Q1 Ultra Vista model setup */ |
| 10186 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10187 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10188 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10189 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10190 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10191 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10192 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10193 | { } /* end */ |
| 10194 | }; |
| 10195 | |
| 10196 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10197 | /* output mixer */ |
| 10198 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10199 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10200 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10201 | /* speaker */ |
| 10202 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10203 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10204 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10205 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10206 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10207 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10208 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10209 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10210 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10211 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10212 | /* internal mic */ |
| 10213 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10214 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10215 | /* ADC, choose mic */ |
| 10216 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10217 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10218 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10219 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10220 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10221 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10222 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10223 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10224 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10225 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10226 | {} |
| 10227 | }; |
| 10228 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10229 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10230 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10231 | { |
| 10232 | struct alc_spec *spec = codec->spec; |
| 10233 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10234 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10235 | mute = 0; |
| 10236 | /* auto-mute only when HP is used as HP */ |
| 10237 | if (!spec->cur_mux[0]) { |
| 10238 | unsigned int present; |
| 10239 | /* need to execute and sync at first */ |
| 10240 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10241 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10242 | AC_VERB_GET_PIN_SENSE, 0); |
| 10243 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10244 | if (spec->jack_present) |
| 10245 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10246 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10247 | /* mute/unmute internal speaker */ |
| 10248 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10249 | HDA_AMP_MUTE, mute); |
| 10250 | /* mute/unmute HP */ |
| 10251 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10252 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10253 | } |
| 10254 | |
| 10255 | /* unsolicited event for HP jack sensing */ |
| 10256 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10257 | unsigned int res) |
| 10258 | { |
| 10259 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10260 | return; |
| 10261 | alc262_ultra_automute(codec); |
| 10262 | } |
| 10263 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10264 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10265 | .num_items = 2, |
| 10266 | .items = { |
| 10267 | { "Mic", 0x1 }, |
| 10268 | { "Headphone", 0x7 }, |
| 10269 | }, |
| 10270 | }; |
| 10271 | |
| 10272 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10273 | struct snd_ctl_elem_value *ucontrol) |
| 10274 | { |
| 10275 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10276 | struct alc_spec *spec = codec->spec; |
| 10277 | int ret; |
| 10278 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10279 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10280 | if (!ret) |
| 10281 | return 0; |
| 10282 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10283 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10284 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10285 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10286 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10287 | return ret; |
| 10288 | } |
| 10289 | |
| 10290 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10291 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10292 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10293 | { |
| 10294 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10295 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10296 | .info = alc_mux_enum_info, |
| 10297 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10298 | .put = alc262_ultra_mux_enum_put, |
| 10299 | }, |
| 10300 | { } /* end */ |
| 10301 | }; |
| 10302 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10303 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10304 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10305 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10306 | { |
| 10307 | hda_nid_t nid; |
| 10308 | int err; |
| 10309 | |
| 10310 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10311 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10312 | spec->multiout.dac_nids[0] = 2; |
| 10313 | |
| 10314 | nid = cfg->line_out_pins[0]; |
| 10315 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10316 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10317 | "Front Playback Volume", |
| 10318 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10319 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10320 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10321 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10322 | "Front Playback Switch", |
| 10323 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10324 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10325 | return err; |
| 10326 | } |
| 10327 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10328 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10329 | if (nid) { |
| 10330 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10331 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10332 | "Speaker Playback Volume", |
| 10333 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10334 | HDA_OUTPUT)); |
| 10335 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10336 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10337 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10338 | "Speaker Playback Switch", |
| 10339 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10340 | HDA_OUTPUT)); |
| 10341 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10342 | return err; |
| 10343 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10344 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10345 | "Speaker Playback Switch", |
| 10346 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10347 | HDA_OUTPUT)); |
| 10348 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10349 | return err; |
| 10350 | } |
| 10351 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10352 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10353 | if (nid) { |
| 10354 | /* spec->multiout.hp_nid = 2; */ |
| 10355 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10356 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10357 | "Headphone Playback Volume", |
| 10358 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10359 | HDA_OUTPUT)); |
| 10360 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10361 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10362 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10363 | "Headphone Playback Switch", |
| 10364 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10365 | HDA_OUTPUT)); |
| 10366 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10367 | return err; |
| 10368 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10369 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10370 | "Headphone Playback Switch", |
| 10371 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10372 | HDA_OUTPUT)); |
| 10373 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10374 | return err; |
| 10375 | } |
| 10376 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10377 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10378 | } |
| 10379 | |
| 10380 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10381 | #define alc262_auto_create_analog_input_ctls \ |
| 10382 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10383 | |
| 10384 | /* |
| 10385 | * generic initialization of ADC, input mixers and output mixers |
| 10386 | */ |
| 10387 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10388 | /* |
| 10389 | * Unmute ADC0-2 and set the default input to mic-in |
| 10390 | */ |
| 10391 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10392 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10393 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10394 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10395 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10396 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10397 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10398 | /* 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] | 10399 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10400 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10401 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10402 | */ |
| 10403 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10404 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10405 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10406 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10407 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10408 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10409 | |
| 10410 | /* |
| 10411 | * Set up output mixers (0x0c - 0x0f) |
| 10412 | */ |
| 10413 | /* set vol=0 to output mixers */ |
| 10414 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10415 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10416 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10417 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10418 | /* set up input amps for analog loopback */ |
| 10419 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10420 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10421 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10422 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10423 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10424 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10425 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10426 | |
| 10427 | /* FIXME: use matrix-type input source selection */ |
| 10428 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10429 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10430 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10431 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10432 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10433 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10434 | /* Input mixer2 */ |
| 10435 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10436 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10437 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10438 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10439 | /* Input mixer3 */ |
| 10440 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10441 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10442 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10443 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10444 | |
| 10445 | { } |
| 10446 | }; |
| 10447 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10448 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10449 | /* |
| 10450 | * Unmute ADC0-2 and set the default input to mic-in |
| 10451 | */ |
| 10452 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10453 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10454 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10455 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10456 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10457 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10458 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10459 | /* 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] | 10460 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10461 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10462 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10463 | */ |
| 10464 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10465 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10466 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10467 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10468 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10469 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10470 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10471 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10472 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10473 | /* |
| 10474 | * Set up output mixers (0x0c - 0x0e) |
| 10475 | */ |
| 10476 | /* set vol=0 to output mixers */ |
| 10477 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10478 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10479 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10480 | |
| 10481 | /* set up input amps for analog loopback */ |
| 10482 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10483 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10484 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10485 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10486 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10487 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10488 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10489 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10490 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10491 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10492 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10493 | |
| 10494 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10495 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10496 | |
| 10497 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10498 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10499 | |
| 10500 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10501 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10502 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10503 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10504 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10505 | |
| 10506 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10507 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10508 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10509 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10510 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10511 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10512 | |
| 10513 | |
| 10514 | /* FIXME: use matrix-type input source selection */ |
| 10515 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10516 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10517 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10518 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10519 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10520 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10521 | /* Input mixer2 */ |
| 10522 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10523 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10524 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10525 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10526 | /* Input mixer3 */ |
| 10527 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10528 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10529 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10530 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10531 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10532 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10533 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10534 | { } |
| 10535 | }; |
| 10536 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10537 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10538 | /* |
| 10539 | * Unmute ADC0-2 and set the default input to mic-in |
| 10540 | */ |
| 10541 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10542 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10543 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10544 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10545 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10546 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10547 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10548 | /* 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] | 10549 | * mixer widget |
| 10550 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10551 | * panel mic (mic 2) |
| 10552 | */ |
| 10553 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10554 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10555 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10556 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10557 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10558 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10559 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10560 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10561 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10562 | /* |
| 10563 | * Set up output mixers (0x0c - 0x0e) |
| 10564 | */ |
| 10565 | /* set vol=0 to output mixers */ |
| 10566 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10567 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10568 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10569 | |
| 10570 | /* set up input amps for analog loopback */ |
| 10571 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10572 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10573 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10574 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10575 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10576 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10577 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10578 | |
| 10579 | |
| 10580 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10581 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10582 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10583 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10584 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10585 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10586 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10587 | |
| 10588 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10589 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10590 | |
| 10591 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10592 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10593 | |
| 10594 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10595 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10596 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10597 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10598 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10599 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10600 | |
| 10601 | /* FIXME: use matrix-type input source selection */ |
| 10602 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10603 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10604 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10605 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10606 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10607 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10608 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10609 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10610 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10611 | /* Input mixer2 */ |
| 10612 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10613 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10614 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10615 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10616 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10617 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10618 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10619 | /* Input mixer3 */ |
| 10620 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10621 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10622 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10623 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10625 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10626 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10627 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10628 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10629 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10630 | { } |
| 10631 | }; |
| 10632 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10633 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10634 | |
| 10635 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10636 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10637 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10638 | |
| 10639 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10640 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10641 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10642 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10643 | |
| 10644 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10645 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10646 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10647 | {} |
| 10648 | }; |
| 10649 | |
| 10650 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10651 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10652 | #define alc262_loopbacks alc880_loopbacks |
| 10653 | #endif |
| 10654 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10655 | /* pcm configuration: identiacal with ALC880 */ |
| 10656 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10657 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10658 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10659 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10660 | |
| 10661 | /* |
| 10662 | * BIOS auto configuration |
| 10663 | */ |
| 10664 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10665 | { |
| 10666 | struct alc_spec *spec = codec->spec; |
| 10667 | int err; |
| 10668 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10669 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10670 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10671 | alc262_ignore); |
| 10672 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10673 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10674 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10675 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10676 | spec->multiout.max_channels = 2; |
| 10677 | spec->no_analog = 1; |
| 10678 | goto dig_only; |
| 10679 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10680 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10681 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10682 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10683 | if (err < 0) |
| 10684 | return err; |
| 10685 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10686 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10687 | return err; |
| 10688 | |
| 10689 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10690 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10691 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10692 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10693 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10694 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10695 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10696 | if (spec->autocfg.dig_in_pin) |
| 10697 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10698 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10699 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10700 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10701 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10702 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10703 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10704 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10705 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10706 | err = alc_auto_add_mic_boost(codec); |
| 10707 | if (err < 0) |
| 10708 | return err; |
| 10709 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 10710 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 10711 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10712 | return 1; |
| 10713 | } |
| 10714 | |
| 10715 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10716 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10717 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10718 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10719 | |
| 10720 | |
| 10721 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10722 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10723 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10724 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10725 | alc262_auto_init_multi_out(codec); |
| 10726 | alc262_auto_init_hp_out(codec); |
| 10727 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10728 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10729 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10730 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10731 | } |
| 10732 | |
| 10733 | /* |
| 10734 | * configuration and preset |
| 10735 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10736 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10737 | [ALC262_BASIC] = "basic", |
| 10738 | [ALC262_HIPPO] = "hippo", |
| 10739 | [ALC262_HIPPO_1] = "hippo_1", |
| 10740 | [ALC262_FUJITSU] = "fujitsu", |
| 10741 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10742 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10743 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10744 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10745 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10746 | [ALC262_BENQ_T31] = "benq-t31", |
| 10747 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10748 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10749 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10750 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10751 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10752 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10753 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10754 | [ALC262_AUTO] = "auto", |
| 10755 | }; |
| 10756 | |
| 10757 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10758 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10759 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10760 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 10761 | ALC262_HP_BPC), |
| 10762 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 10763 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 10764 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 10765 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10766 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10767 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10768 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10769 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10770 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10771 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10772 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10773 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10774 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10775 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10776 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10777 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10778 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10779 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10780 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10781 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10782 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 10783 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 10784 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 10785 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10786 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10787 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10788 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10789 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10790 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10791 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10792 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 10793 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 10794 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10795 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10796 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10797 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10798 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10799 | {} |
| 10800 | }; |
| 10801 | |
| 10802 | static struct alc_config_preset alc262_presets[] = { |
| 10803 | [ALC262_BASIC] = { |
| 10804 | .mixers = { alc262_base_mixer }, |
| 10805 | .init_verbs = { alc262_init_verbs }, |
| 10806 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10807 | .dac_nids = alc262_dac_nids, |
| 10808 | .hp_nid = 0x03, |
| 10809 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10810 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10811 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10812 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10813 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10814 | .mixers = { alc262_hippo_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10815 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10816 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10817 | .dac_nids = alc262_dac_nids, |
| 10818 | .hp_nid = 0x03, |
| 10819 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10820 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10821 | .channel_mode = alc262_modes, |
| 10822 | .input_mux = &alc262_capture_source, |
| 10823 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10824 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10825 | }, |
| 10826 | [ALC262_HIPPO_1] = { |
| 10827 | .mixers = { alc262_hippo1_mixer }, |
| 10828 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10829 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10830 | .dac_nids = alc262_dac_nids, |
| 10831 | .hp_nid = 0x02, |
| 10832 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10833 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10834 | .channel_mode = alc262_modes, |
| 10835 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10836 | .unsol_event = alc262_hippo_unsol_event, |
| 10837 | .init_hook = alc262_hippo1_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10838 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10839 | [ALC262_FUJITSU] = { |
| 10840 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10841 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10842 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10843 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10844 | .dac_nids = alc262_dac_nids, |
| 10845 | .hp_nid = 0x03, |
| 10846 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10847 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10848 | .channel_mode = alc262_modes, |
| 10849 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10850 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10851 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10852 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10853 | [ALC262_HP_BPC] = { |
| 10854 | .mixers = { alc262_HP_BPC_mixer }, |
| 10855 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10856 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10857 | .dac_nids = alc262_dac_nids, |
| 10858 | .hp_nid = 0x03, |
| 10859 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10860 | .channel_mode = alc262_modes, |
| 10861 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10862 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10863 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10864 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10865 | [ALC262_HP_BPC_D7000_WF] = { |
| 10866 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10867 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10868 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10869 | .dac_nids = alc262_dac_nids, |
| 10870 | .hp_nid = 0x03, |
| 10871 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10872 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10873 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10874 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10875 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10876 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10877 | [ALC262_HP_BPC_D7000_WL] = { |
| 10878 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10879 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10880 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10881 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10882 | .dac_nids = alc262_dac_nids, |
| 10883 | .hp_nid = 0x03, |
| 10884 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10885 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10886 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10887 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10888 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10889 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10890 | [ALC262_HP_TC_T5735] = { |
| 10891 | .mixers = { alc262_hp_t5735_mixer }, |
| 10892 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 10893 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10894 | .dac_nids = alc262_dac_nids, |
| 10895 | .hp_nid = 0x03, |
| 10896 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10897 | .channel_mode = alc262_modes, |
| 10898 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10899 | .unsol_event = alc_automute_amp_unsol_event, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10900 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10901 | }, |
| 10902 | [ALC262_HP_RP5700] = { |
| 10903 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10904 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 10905 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10906 | .dac_nids = alc262_dac_nids, |
| 10907 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10908 | .channel_mode = alc262_modes, |
| 10909 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10910 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10911 | [ALC262_BENQ_ED8] = { |
| 10912 | .mixers = { alc262_base_mixer }, |
| 10913 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 10914 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10915 | .dac_nids = alc262_dac_nids, |
| 10916 | .hp_nid = 0x03, |
| 10917 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10918 | .channel_mode = alc262_modes, |
| 10919 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10920 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10921 | [ALC262_SONY_ASSAMD] = { |
| 10922 | .mixers = { alc262_sony_mixer }, |
| 10923 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 10924 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10925 | .dac_nids = alc262_dac_nids, |
| 10926 | .hp_nid = 0x02, |
| 10927 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10928 | .channel_mode = alc262_modes, |
| 10929 | .input_mux = &alc262_capture_source, |
| 10930 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10931 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10932 | }, |
| 10933 | [ALC262_BENQ_T31] = { |
| 10934 | .mixers = { alc262_benq_t31_mixer }, |
| 10935 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 10936 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10937 | .dac_nids = alc262_dac_nids, |
| 10938 | .hp_nid = 0x03, |
| 10939 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10940 | .channel_mode = alc262_modes, |
| 10941 | .input_mux = &alc262_capture_source, |
| 10942 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10943 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10944 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10945 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10946 | .mixers = { alc262_ultra_mixer }, |
| 10947 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10948 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10949 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10950 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10951 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10952 | .channel_mode = alc262_modes, |
| 10953 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10954 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 10955 | .capsrc_nids = alc262_capsrc_nids, |
| 10956 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10957 | .unsol_event = alc262_ultra_unsol_event, |
| 10958 | .init_hook = alc262_ultra_automute, |
| 10959 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10960 | [ALC262_LENOVO_3000] = { |
| 10961 | .mixers = { alc262_lenovo_3000_mixer }, |
| 10962 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10963 | alc262_lenovo_3000_unsol_verbs }, |
| 10964 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10965 | .dac_nids = alc262_dac_nids, |
| 10966 | .hp_nid = 0x03, |
| 10967 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10968 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10969 | .channel_mode = alc262_modes, |
| 10970 | .input_mux = &alc262_fujitsu_capture_source, |
| 10971 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 10972 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10973 | [ALC262_NEC] = { |
| 10974 | .mixers = { alc262_nec_mixer }, |
| 10975 | .init_verbs = { alc262_nec_verbs }, |
| 10976 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10977 | .dac_nids = alc262_dac_nids, |
| 10978 | .hp_nid = 0x03, |
| 10979 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10980 | .channel_mode = alc262_modes, |
| 10981 | .input_mux = &alc262_capture_source, |
| 10982 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10983 | [ALC262_TOSHIBA_S06] = { |
| 10984 | .mixers = { alc262_toshiba_s06_mixer }, |
| 10985 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 10986 | alc262_eapd_verbs }, |
| 10987 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10988 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 10989 | .dac_nids = alc262_dac_nids, |
| 10990 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 10991 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10992 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10993 | .channel_mode = alc262_modes, |
| 10994 | .input_mux = &alc262_dmic_capture_source, |
| 10995 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 10996 | .init_hook = alc262_toshiba_s06_init_hook, |
| 10997 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10998 | [ALC262_TOSHIBA_RX1] = { |
| 10999 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11000 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11001 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11002 | .dac_nids = alc262_dac_nids, |
| 11003 | .hp_nid = 0x03, |
| 11004 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11005 | .channel_mode = alc262_modes, |
| 11006 | .input_mux = &alc262_capture_source, |
| 11007 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11008 | .init_hook = alc262_hippo_init_hook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11009 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11010 | [ALC262_TYAN] = { |
| 11011 | .mixers = { alc262_tyan_mixer }, |
| 11012 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11013 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11014 | .dac_nids = alc262_dac_nids, |
| 11015 | .hp_nid = 0x02, |
| 11016 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11017 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11018 | .channel_mode = alc262_modes, |
| 11019 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11020 | .unsol_event = alc_automute_amp_unsol_event, |
| 11021 | .init_hook = alc262_tyan_init_hook, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11022 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11023 | }; |
| 11024 | |
| 11025 | static int patch_alc262(struct hda_codec *codec) |
| 11026 | { |
| 11027 | struct alc_spec *spec; |
| 11028 | int board_config; |
| 11029 | int err; |
| 11030 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11031 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11032 | if (spec == NULL) |
| 11033 | return -ENOMEM; |
| 11034 | |
| 11035 | codec->spec = spec; |
| 11036 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11037 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11038 | * under-run |
| 11039 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11040 | { |
| 11041 | int tmp; |
| 11042 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11043 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11044 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11045 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11046 | } |
| 11047 | #endif |
| 11048 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11049 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11050 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11051 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11052 | alc262_models, |
| 11053 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11054 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11055 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11056 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 11057 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11058 | board_config = ALC262_AUTO; |
| 11059 | } |
| 11060 | |
| 11061 | if (board_config == ALC262_AUTO) { |
| 11062 | /* automatic parse from the BIOS config */ |
| 11063 | err = alc262_parse_auto_config(codec); |
| 11064 | if (err < 0) { |
| 11065 | alc_free(codec); |
| 11066 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11067 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11068 | printk(KERN_INFO |
| 11069 | "hda_codec: Cannot set up configuration " |
| 11070 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11071 | board_config = ALC262_BASIC; |
| 11072 | } |
| 11073 | } |
| 11074 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11075 | if (!spec->no_analog) { |
| 11076 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11077 | if (err < 0) { |
| 11078 | alc_free(codec); |
| 11079 | return err; |
| 11080 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11081 | } |
| 11082 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11083 | if (board_config != ALC262_AUTO) |
| 11084 | setup_preset(spec, &alc262_presets[board_config]); |
| 11085 | |
| 11086 | spec->stream_name_analog = "ALC262 Analog"; |
| 11087 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11088 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11089 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11090 | spec->stream_name_digital = "ALC262 Digital"; |
| 11091 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11092 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11093 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11094 | spec->capture_style = CAPT_MIX; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11095 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11096 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11097 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11098 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11099 | /* get type */ |
| 11100 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11101 | if (wcap != AC_WID_AUD_IN) { |
| 11102 | spec->adc_nids = alc262_adc_nids_alt; |
| 11103 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11104 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11105 | } else { |
| 11106 | spec->adc_nids = alc262_adc_nids; |
| 11107 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11108 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11109 | } |
| 11110 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11111 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11112 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11113 | if (!spec->no_analog) |
| 11114 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11115 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11116 | spec->vmaster_nid = 0x0c; |
| 11117 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11118 | codec->patch_ops = alc_patch_ops; |
| 11119 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11120 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11121 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11122 | if (!spec->loopback.amplist) |
| 11123 | spec->loopback.amplist = alc262_loopbacks; |
| 11124 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11125 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11126 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11127 | return 0; |
| 11128 | } |
| 11129 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11130 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11131 | * ALC268 channel source setting (2 channel) |
| 11132 | */ |
| 11133 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11134 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11135 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11136 | static hda_nid_t alc268_dac_nids[2] = { |
| 11137 | /* front, hp */ |
| 11138 | 0x02, 0x03 |
| 11139 | }; |
| 11140 | |
| 11141 | static hda_nid_t alc268_adc_nids[2] = { |
| 11142 | /* ADC0-1 */ |
| 11143 | 0x08, 0x07 |
| 11144 | }; |
| 11145 | |
| 11146 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11147 | /* ADC0 */ |
| 11148 | 0x08 |
| 11149 | }; |
| 11150 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11151 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11152 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11153 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11154 | /* output mixer control */ |
| 11155 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11156 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11157 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11158 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11159 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11160 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11161 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11162 | { } |
| 11163 | }; |
| 11164 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11165 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11166 | /* output mixer control */ |
| 11167 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11168 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11169 | ALC262_HIPPO_MASTER_SWITCH, |
| 11170 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11171 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11172 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11173 | { } |
| 11174 | }; |
| 11175 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11176 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11177 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11178 | .ops = &snd_hda_bind_sw, |
| 11179 | .values = { |
| 11180 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11181 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11182 | 0 |
| 11183 | }, |
| 11184 | }; |
| 11185 | |
| 11186 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11187 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11188 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11189 | { } |
| 11190 | }; |
| 11191 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11192 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11193 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11194 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11195 | { } |
| 11196 | }; |
| 11197 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11198 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11199 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11200 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11201 | { } /* end */ |
| 11202 | }; |
| 11203 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11204 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11205 | .num_items = 2, |
| 11206 | .items = { |
| 11207 | { "i-Mic", 0x6 }, |
| 11208 | { "E-Mic", 0x0 }, |
| 11209 | }, |
| 11210 | }; |
| 11211 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11212 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11213 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11214 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11215 | .ops = &snd_hda_bind_vol, |
| 11216 | .values = { |
| 11217 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11218 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11219 | 0 |
| 11220 | }, |
| 11221 | }; |
| 11222 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11223 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11224 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11225 | { |
| 11226 | struct alc_spec *spec = codec->spec; |
| 11227 | unsigned int mute; |
| 11228 | |
| 11229 | if (force || !spec->sense_updated) { |
| 11230 | unsigned int present; |
| 11231 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11232 | AC_VERB_GET_PIN_SENSE, 0); |
| 11233 | spec->jack_present = (present & 0x80000000) != 0; |
| 11234 | spec->sense_updated = 1; |
| 11235 | } |
| 11236 | if (spec->jack_present) |
| 11237 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11238 | else /* unmute internal speaker if necessary */ |
| 11239 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11240 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11241 | HDA_AMP_MUTE, mute); |
| 11242 | } |
| 11243 | |
| 11244 | |
| 11245 | /* bind hp and internal speaker mute (with plug check) */ |
| 11246 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11247 | struct snd_ctl_elem_value *ucontrol) |
| 11248 | { |
| 11249 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11250 | long *valp = ucontrol->value.integer.value; |
| 11251 | int change; |
| 11252 | |
| 11253 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11254 | HDA_AMP_MUTE, |
| 11255 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11256 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11257 | HDA_AMP_MUTE, |
| 11258 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11259 | if (change) |
| 11260 | alc268_acer_automute(codec, 0); |
| 11261 | return change; |
| 11262 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11263 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11264 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11265 | /* output mixer control */ |
| 11266 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11267 | { |
| 11268 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11269 | .name = "Master Playback Switch", |
| 11270 | .info = snd_hda_mixer_amp_switch_info, |
| 11271 | .get = snd_hda_mixer_amp_switch_get, |
| 11272 | .put = alc268_acer_master_sw_put, |
| 11273 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11274 | }, |
| 11275 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11276 | { } |
| 11277 | }; |
| 11278 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11279 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11280 | /* output mixer control */ |
| 11281 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11282 | { |
| 11283 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11284 | .name = "Master Playback Switch", |
| 11285 | .info = snd_hda_mixer_amp_switch_info, |
| 11286 | .get = snd_hda_mixer_amp_switch_get, |
| 11287 | .put = alc268_acer_master_sw_put, |
| 11288 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11289 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11290 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11291 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11292 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11293 | { } |
| 11294 | }; |
| 11295 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11296 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11297 | /* output mixer control */ |
| 11298 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11299 | { |
| 11300 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11301 | .name = "Master Playback Switch", |
| 11302 | .info = snd_hda_mixer_amp_switch_info, |
| 11303 | .get = snd_hda_mixer_amp_switch_get, |
| 11304 | .put = alc268_acer_master_sw_put, |
| 11305 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11306 | }, |
| 11307 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11308 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11309 | { } |
| 11310 | }; |
| 11311 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11312 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11313 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11314 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11315 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11316 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11317 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11318 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11319 | { } |
| 11320 | }; |
| 11321 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11322 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11323 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11324 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11325 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11326 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11327 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11328 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11329 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11330 | { } |
| 11331 | }; |
| 11332 | |
| 11333 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11334 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
| 11335 | #define alc268_toshiba_init_hook alc262_hippo_init_hook |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11336 | |
| 11337 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11338 | unsigned int res) |
| 11339 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11340 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11341 | return; |
| 11342 | alc268_acer_automute(codec, 1); |
| 11343 | } |
| 11344 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11345 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11346 | { |
| 11347 | alc268_acer_automute(codec, 1); |
| 11348 | } |
| 11349 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11350 | /* toggle speaker-output according to the hp-jack state */ |
| 11351 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11352 | { |
| 11353 | unsigned int present; |
| 11354 | unsigned char bits; |
| 11355 | |
| 11356 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11357 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11358 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11359 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11360 | AMP_IN_MUTE(0), bits); |
| 11361 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11362 | AMP_IN_MUTE(0), bits); |
| 11363 | } |
| 11364 | |
| 11365 | |
| 11366 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11367 | { |
| 11368 | unsigned int present; |
| 11369 | |
| 11370 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11371 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11372 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11373 | present ? 0x0 : 0x6); |
| 11374 | } |
| 11375 | |
| 11376 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11377 | unsigned int res) |
| 11378 | { |
| 11379 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11380 | alc268_aspire_one_speaker_automute(codec); |
| 11381 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11382 | alc268_acer_mic_automute(codec); |
| 11383 | } |
| 11384 | |
| 11385 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11386 | { |
| 11387 | alc268_aspire_one_speaker_automute(codec); |
| 11388 | alc268_acer_mic_automute(codec); |
| 11389 | } |
| 11390 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11391 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11392 | /* output mixer control */ |
| 11393 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11394 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11395 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11396 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11397 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11398 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11399 | { } |
| 11400 | }; |
| 11401 | |
| 11402 | static struct hda_verb alc268_dell_verbs[] = { |
| 11403 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11404 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11405 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11406 | { } |
| 11407 | }; |
| 11408 | |
| 11409 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11410 | static void alc268_dell_init_hook(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11411 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11412 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11413 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11414 | spec->autocfg.hp_pins[0] = 0x15; |
| 11415 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11416 | alc_automute_pin(codec); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11417 | } |
| 11418 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11419 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11420 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11421 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11422 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11423 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11424 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11425 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11426 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11427 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11428 | { } |
| 11429 | }; |
| 11430 | |
| 11431 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11432 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11433 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11434 | { } |
| 11435 | }; |
| 11436 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11437 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11438 | { |
| 11439 | unsigned int present; |
| 11440 | |
| 11441 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11442 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11443 | snd_hda_codec_write(codec, 0x23, 0, |
| 11444 | AC_VERB_SET_CONNECT_SEL, |
| 11445 | present ? 0x00 : 0x01); |
| 11446 | } |
| 11447 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11448 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11449 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11450 | struct alc_spec *spec = codec->spec; |
| 11451 | |
| 11452 | spec->autocfg.hp_pins[0] = 0x15; |
| 11453 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11454 | alc_automute_pin(codec); |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11455 | alc267_quanta_il1_mic_automute(codec); |
| 11456 | } |
| 11457 | |
| 11458 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11459 | unsigned int res) |
| 11460 | { |
| 11461 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11462 | case ALC880_MIC_EVENT: |
| 11463 | alc267_quanta_il1_mic_automute(codec); |
| 11464 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11465 | default: |
| 11466 | alc_sku_unsol_event(codec, res); |
| 11467 | break; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11468 | } |
| 11469 | } |
| 11470 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11471 | /* |
| 11472 | * generic initialization of ADC, input mixers and output mixers |
| 11473 | */ |
| 11474 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11475 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11476 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11477 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11478 | |
| 11479 | /* |
| 11480 | * Set up output mixers (0x0c - 0x0e) |
| 11481 | */ |
| 11482 | /* set vol=0 to output mixers */ |
| 11483 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11484 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11485 | |
| 11486 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11487 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11488 | |
| 11489 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11490 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11491 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11492 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11493 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11494 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11495 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11496 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11497 | |
| 11498 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11499 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11500 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11501 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11502 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11503 | |
| 11504 | /* set PCBEEP vol = 0, mute connections */ |
| 11505 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11506 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11507 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11508 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11509 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11510 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11511 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11512 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11513 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11514 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11515 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11516 | { } |
| 11517 | }; |
| 11518 | |
| 11519 | /* |
| 11520 | * generic initialization of ADC, input mixers and output mixers |
| 11521 | */ |
| 11522 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11523 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11524 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11525 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11526 | |
| 11527 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11528 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11529 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11530 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11531 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11532 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11533 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11534 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11535 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11536 | |
| 11537 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11538 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11539 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11540 | /* set PCBEEP vol = 0, mute connections */ |
| 11541 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11542 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11543 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11544 | |
| 11545 | { } |
| 11546 | }; |
| 11547 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11548 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11549 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11550 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11551 | { |
| 11552 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11553 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11554 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11555 | */ |
| 11556 | /* .name = "Capture Source", */ |
| 11557 | .name = "Input Source", |
| 11558 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11559 | .info = alc_mux_enum_info, |
| 11560 | .get = alc_mux_enum_get, |
| 11561 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11562 | }, |
| 11563 | { } /* end */ |
| 11564 | }; |
| 11565 | |
| 11566 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11567 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11568 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11569 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11570 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11571 | { |
| 11572 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11573 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11574 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11575 | */ |
| 11576 | /* .name = "Capture Source", */ |
| 11577 | .name = "Input Source", |
| 11578 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11579 | .info = alc_mux_enum_info, |
| 11580 | .get = alc_mux_enum_get, |
| 11581 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11582 | }, |
| 11583 | { } /* end */ |
| 11584 | }; |
| 11585 | |
| 11586 | static struct hda_input_mux alc268_capture_source = { |
| 11587 | .num_items = 4, |
| 11588 | .items = { |
| 11589 | { "Mic", 0x0 }, |
| 11590 | { "Front Mic", 0x1 }, |
| 11591 | { "Line", 0x2 }, |
| 11592 | { "CD", 0x3 }, |
| 11593 | }, |
| 11594 | }; |
| 11595 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11596 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11597 | .num_items = 3, |
| 11598 | .items = { |
| 11599 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11600 | { "Internal Mic", 0x1 }, |
| 11601 | { "Line", 0x2 }, |
| 11602 | }, |
| 11603 | }; |
| 11604 | |
| 11605 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11606 | .num_items = 3, |
| 11607 | .items = { |
| 11608 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11609 | { "Internal Mic", 0x6 }, |
| 11610 | { "Line", 0x2 }, |
| 11611 | }, |
| 11612 | }; |
| 11613 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11614 | #ifdef CONFIG_SND_DEBUG |
| 11615 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11616 | /* Volume widgets */ |
| 11617 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11618 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11619 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11620 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11621 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11622 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11623 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11624 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11625 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11626 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11627 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11628 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11629 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11630 | /* The below appears problematic on some hardwares */ |
| 11631 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11632 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11633 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11634 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11635 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11636 | |
| 11637 | /* Modes for retasking pin widgets */ |
| 11638 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11639 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11640 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11641 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11642 | |
| 11643 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11644 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11645 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11646 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11647 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11648 | |
| 11649 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11650 | * The ALC268 does not have an SPDIF input. |
| 11651 | */ |
| 11652 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11653 | |
| 11654 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11655 | * this output to turn on an external amplifier. |
| 11656 | */ |
| 11657 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11658 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11659 | |
| 11660 | { } /* end */ |
| 11661 | }; |
| 11662 | #endif |
| 11663 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11664 | /* create input playback/capture controls for the given pin */ |
| 11665 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11666 | const char *ctlname, int idx) |
| 11667 | { |
| 11668 | char name[32]; |
| 11669 | int err; |
| 11670 | |
| 11671 | sprintf(name, "%s Playback Volume", ctlname); |
| 11672 | if (nid == 0x14) { |
| 11673 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11674 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11675 | HDA_OUTPUT)); |
| 11676 | if (err < 0) |
| 11677 | return err; |
| 11678 | } else if (nid == 0x15) { |
| 11679 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11680 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11681 | HDA_OUTPUT)); |
| 11682 | if (err < 0) |
| 11683 | return err; |
| 11684 | } else |
| 11685 | return -1; |
| 11686 | sprintf(name, "%s Playback Switch", ctlname); |
| 11687 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11688 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11689 | if (err < 0) |
| 11690 | return err; |
| 11691 | return 0; |
| 11692 | } |
| 11693 | |
| 11694 | /* add playback controls from the parsed DAC table */ |
| 11695 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11696 | const struct auto_pin_cfg *cfg) |
| 11697 | { |
| 11698 | hda_nid_t nid; |
| 11699 | int err; |
| 11700 | |
| 11701 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11702 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11703 | spec->multiout.dac_nids[0] = 2; |
| 11704 | spec->multiout.dac_nids[1] = 3; |
| 11705 | |
| 11706 | nid = cfg->line_out_pins[0]; |
| 11707 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11708 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11709 | |
| 11710 | nid = cfg->speaker_pins[0]; |
| 11711 | if (nid == 0x1d) { |
| 11712 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11713 | "Speaker Playback Volume", |
| 11714 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11715 | if (err < 0) |
| 11716 | return err; |
| 11717 | } |
| 11718 | nid = cfg->hp_pins[0]; |
| 11719 | if (nid) |
| 11720 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11721 | |
| 11722 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11723 | if (nid == 0x16) { |
| 11724 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11725 | "Mono Playback Switch", |
| 11726 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11727 | if (err < 0) |
| 11728 | return err; |
| 11729 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11730 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11731 | } |
| 11732 | |
| 11733 | /* create playback/capture controls for input pins */ |
| 11734 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11735 | const struct auto_pin_cfg *cfg) |
| 11736 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11737 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11738 | int i, idx1; |
| 11739 | |
| 11740 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11741 | switch(cfg->input_pins[i]) { |
| 11742 | case 0x18: |
| 11743 | idx1 = 0; /* Mic 1 */ |
| 11744 | break; |
| 11745 | case 0x19: |
| 11746 | idx1 = 1; /* Mic 2 */ |
| 11747 | break; |
| 11748 | case 0x1a: |
| 11749 | idx1 = 2; /* Line In */ |
| 11750 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11751 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11752 | idx1 = 3; /* CD */ |
| 11753 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11754 | case 0x12: |
| 11755 | case 0x13: |
| 11756 | idx1 = 6; /* digital mics */ |
| 11757 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11758 | default: |
| 11759 | continue; |
| 11760 | } |
| 11761 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11762 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11763 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11764 | } |
| 11765 | return 0; |
| 11766 | } |
| 11767 | |
| 11768 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11769 | { |
| 11770 | struct alc_spec *spec = codec->spec; |
| 11771 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11772 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11773 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11774 | unsigned int dac_vol1, dac_vol2; |
| 11775 | |
| 11776 | if (speaker_nid) { |
| 11777 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11778 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11779 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11780 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11781 | AMP_IN_UNMUTE(1)); |
| 11782 | snd_hda_codec_write(codec, 0x10, 0, |
| 11783 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11784 | AMP_IN_UNMUTE(1)); |
| 11785 | } else { |
| 11786 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11787 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11788 | snd_hda_codec_write(codec, 0x10, 0, |
| 11789 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11790 | } |
| 11791 | |
| 11792 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11793 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11794 | dac_vol2 = AMP_OUT_ZERO; |
| 11795 | else if (line_nid == 0x15) |
| 11796 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11797 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11798 | dac_vol2 = AMP_OUT_ZERO; |
| 11799 | else if (hp_nid == 0x15) |
| 11800 | dac_vol1 = AMP_OUT_ZERO; |
| 11801 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11802 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11803 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11804 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11805 | |
| 11806 | snd_hda_codec_write(codec, 0x02, 0, |
| 11807 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11808 | snd_hda_codec_write(codec, 0x03, 0, |
| 11809 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11810 | } |
| 11811 | |
| 11812 | /* pcm configuration: identiacal with ALC880 */ |
| 11813 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11814 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11815 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11816 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11817 | |
| 11818 | /* |
| 11819 | * BIOS auto configuration |
| 11820 | */ |
| 11821 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11822 | { |
| 11823 | struct alc_spec *spec = codec->spec; |
| 11824 | int err; |
| 11825 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11826 | |
| 11827 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11828 | alc268_ignore); |
| 11829 | if (err < 0) |
| 11830 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11831 | if (!spec->autocfg.line_outs) { |
| 11832 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 11833 | spec->multiout.max_channels = 2; |
| 11834 | spec->no_analog = 1; |
| 11835 | goto dig_only; |
| 11836 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11837 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11838 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11839 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11840 | if (err < 0) |
| 11841 | return err; |
| 11842 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11843 | if (err < 0) |
| 11844 | return err; |
| 11845 | |
| 11846 | spec->multiout.max_channels = 2; |
| 11847 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11848 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11849 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11850 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11851 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11852 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 11853 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11854 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11855 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11856 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 11857 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11858 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11859 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11860 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11861 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11862 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11863 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11864 | err = alc_auto_add_mic_boost(codec); |
| 11865 | if (err < 0) |
| 11866 | return err; |
| 11867 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11868 | return 1; |
| 11869 | } |
| 11870 | |
| 11871 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11872 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 11873 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 11874 | |
| 11875 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11876 | static void alc268_auto_init(struct hda_codec *codec) |
| 11877 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11878 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11879 | alc268_auto_init_multi_out(codec); |
| 11880 | alc268_auto_init_hp_out(codec); |
| 11881 | alc268_auto_init_mono_speaker_out(codec); |
| 11882 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11883 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11884 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11885 | } |
| 11886 | |
| 11887 | /* |
| 11888 | * configuration and preset |
| 11889 | */ |
| 11890 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11891 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11892 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11893 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11894 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11895 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11896 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11897 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11898 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11899 | #ifdef CONFIG_SND_DEBUG |
| 11900 | [ALC268_TEST] = "test", |
| 11901 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11902 | [ALC268_AUTO] = "auto", |
| 11903 | }; |
| 11904 | |
| 11905 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 11906 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11907 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 11908 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11909 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 11910 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11911 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 11912 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11913 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 11914 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11915 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11916 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11917 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 11918 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 11919 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 11920 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 11921 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11922 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11923 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11924 | {} |
| 11925 | }; |
| 11926 | |
| 11927 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11928 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 11929 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11930 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11931 | alc267_quanta_il1_verbs }, |
| 11932 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11933 | .dac_nids = alc268_dac_nids, |
| 11934 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11935 | .adc_nids = alc268_adc_nids_alt, |
| 11936 | .hp_nid = 0x03, |
| 11937 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11938 | .channel_mode = alc268_modes, |
| 11939 | .input_mux = &alc268_capture_source, |
| 11940 | .unsol_event = alc267_quanta_il1_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11941 | .init_hook = alc267_quanta_il1_init_hook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11942 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11943 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11944 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11945 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11946 | .init_verbs = { alc268_base_init_verbs }, |
| 11947 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11948 | .dac_nids = alc268_dac_nids, |
| 11949 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11950 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11951 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11952 | .hp_nid = 0x03, |
| 11953 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11954 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11955 | .channel_mode = alc268_modes, |
| 11956 | .input_mux = &alc268_capture_source, |
| 11957 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11958 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11959 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11960 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11961 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11962 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11963 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11964 | .dac_nids = alc268_dac_nids, |
| 11965 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11966 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11967 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11968 | .hp_nid = 0x03, |
| 11969 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11970 | .channel_mode = alc268_modes, |
| 11971 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11972 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11973 | .init_hook = alc268_toshiba_init_hook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11974 | }, |
| 11975 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11976 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 11977 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11978 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11979 | alc268_acer_verbs }, |
| 11980 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11981 | .dac_nids = alc268_dac_nids, |
| 11982 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11983 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11984 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11985 | .hp_nid = 0x02, |
| 11986 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11987 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11988 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11989 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11990 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11991 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11992 | [ALC268_ACER_DMIC] = { |
| 11993 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 11994 | alc268_beep_mixer }, |
| 11995 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11996 | alc268_acer_verbs }, |
| 11997 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11998 | .dac_nids = alc268_dac_nids, |
| 11999 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12000 | .adc_nids = alc268_adc_nids_alt, |
| 12001 | .capsrc_nids = alc268_capsrc_nids, |
| 12002 | .hp_nid = 0x02, |
| 12003 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12004 | .channel_mode = alc268_modes, |
| 12005 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12006 | .unsol_event = alc268_acer_unsol_event, |
| 12007 | .init_hook = alc268_acer_init_hook, |
| 12008 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12009 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12010 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12011 | alc268_beep_mixer, |
| 12012 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12013 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12014 | alc268_acer_aspire_one_verbs }, |
| 12015 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12016 | .dac_nids = alc268_dac_nids, |
| 12017 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12018 | .adc_nids = alc268_adc_nids_alt, |
| 12019 | .capsrc_nids = alc268_capsrc_nids, |
| 12020 | .hp_nid = 0x03, |
| 12021 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12022 | .channel_mode = alc268_modes, |
| 12023 | .input_mux = &alc268_acer_lc_capture_source, |
| 12024 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12025 | .init_hook = alc268_acer_lc_init_hook, |
| 12026 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12027 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12028 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12029 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12030 | alc268_dell_verbs }, |
| 12031 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12032 | .dac_nids = alc268_dac_nids, |
| 12033 | .hp_nid = 0x02, |
| 12034 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12035 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12036 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12037 | .init_hook = alc268_dell_init_hook, |
| 12038 | .input_mux = &alc268_capture_source, |
| 12039 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12040 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12041 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12042 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12043 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12044 | alc268_toshiba_verbs }, |
| 12045 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12046 | .dac_nids = alc268_dac_nids, |
| 12047 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12048 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12049 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12050 | .hp_nid = 0x03, |
| 12051 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12052 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12053 | .channel_mode = alc268_modes, |
| 12054 | .input_mux = &alc268_capture_source, |
| 12055 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12056 | .init_hook = alc268_toshiba_init_hook |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12057 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12058 | #ifdef CONFIG_SND_DEBUG |
| 12059 | [ALC268_TEST] = { |
| 12060 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12061 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12062 | alc268_volume_init_verbs }, |
| 12063 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12064 | .dac_nids = alc268_dac_nids, |
| 12065 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12066 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12067 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12068 | .hp_nid = 0x03, |
| 12069 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12070 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12071 | .channel_mode = alc268_modes, |
| 12072 | .input_mux = &alc268_capture_source, |
| 12073 | }, |
| 12074 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12075 | }; |
| 12076 | |
| 12077 | static int patch_alc268(struct hda_codec *codec) |
| 12078 | { |
| 12079 | struct alc_spec *spec; |
| 12080 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12081 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12082 | |
| 12083 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12084 | if (spec == NULL) |
| 12085 | return -ENOMEM; |
| 12086 | |
| 12087 | codec->spec = spec; |
| 12088 | |
| 12089 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12090 | alc268_models, |
| 12091 | alc268_cfg_tbl); |
| 12092 | |
| 12093 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 12094 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 12095 | "trying auto-probe from BIOS...\n"); |
| 12096 | board_config = ALC268_AUTO; |
| 12097 | } |
| 12098 | |
| 12099 | if (board_config == ALC268_AUTO) { |
| 12100 | /* automatic parse from the BIOS config */ |
| 12101 | err = alc268_parse_auto_config(codec); |
| 12102 | if (err < 0) { |
| 12103 | alc_free(codec); |
| 12104 | return err; |
| 12105 | } else if (!err) { |
| 12106 | printk(KERN_INFO |
| 12107 | "hda_codec: Cannot set up configuration " |
| 12108 | "from BIOS. Using base mode...\n"); |
| 12109 | board_config = ALC268_3ST; |
| 12110 | } |
| 12111 | } |
| 12112 | |
| 12113 | if (board_config != ALC268_AUTO) |
| 12114 | setup_preset(spec, &alc268_presets[board_config]); |
| 12115 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 12116 | if (codec->vendor_id == 0x10ec0267) { |
| 12117 | spec->stream_name_analog = "ALC267 Analog"; |
| 12118 | spec->stream_name_digital = "ALC267 Digital"; |
| 12119 | } else { |
| 12120 | spec->stream_name_analog = "ALC268 Analog"; |
| 12121 | spec->stream_name_digital = "ALC268 Digital"; |
| 12122 | } |
| 12123 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12124 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12125 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12126 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12127 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12128 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12129 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12130 | has_beep = 0; |
| 12131 | for (i = 0; i < spec->num_mixers; i++) { |
| 12132 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12133 | has_beep = 1; |
| 12134 | break; |
| 12135 | } |
| 12136 | } |
| 12137 | |
| 12138 | if (has_beep) { |
| 12139 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12140 | if (err < 0) { |
| 12141 | alc_free(codec); |
| 12142 | return err; |
| 12143 | } |
| 12144 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12145 | /* override the amp caps for beep generator */ |
| 12146 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12147 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12148 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12149 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12150 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12151 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12152 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12153 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12154 | /* check whether NID 0x07 is valid */ |
| 12155 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12156 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12157 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12158 | /* get type */ |
| 12159 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12160 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12161 | spec->adc_nids = alc268_adc_nids_alt; |
| 12162 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12163 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12164 | } else { |
| 12165 | spec->adc_nids = alc268_adc_nids; |
| 12166 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12167 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12168 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12169 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12170 | /* set default input source */ |
| 12171 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12172 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12173 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12174 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12175 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12176 | |
| 12177 | spec->vmaster_nid = 0x02; |
| 12178 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12179 | codec->patch_ops = alc_patch_ops; |
| 12180 | if (board_config == ALC268_AUTO) |
| 12181 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12182 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12183 | codec->proc_widget_hook = print_realtek_coef; |
| 12184 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12185 | return 0; |
| 12186 | } |
| 12187 | |
| 12188 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12189 | * ALC269 channel source setting (2 channel) |
| 12190 | */ |
| 12191 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12192 | |
| 12193 | #define alc269_dac_nids alc260_dac_nids |
| 12194 | |
| 12195 | static hda_nid_t alc269_adc_nids[1] = { |
| 12196 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12197 | 0x08, |
| 12198 | }; |
| 12199 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12200 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12201 | 0x23, |
| 12202 | }; |
| 12203 | |
| 12204 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12205 | * not a mux! |
| 12206 | */ |
| 12207 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12208 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12209 | .num_items = 2, |
| 12210 | .items = { |
| 12211 | { "i-Mic", 0x5 }, |
| 12212 | { "e-Mic", 0x0 }, |
| 12213 | }, |
| 12214 | }; |
| 12215 | |
| 12216 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12217 | .num_items = 2, |
| 12218 | .items = { |
| 12219 | { "i-Mic", 0x1 }, |
| 12220 | { "e-Mic", 0x0 }, |
| 12221 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12222 | }; |
| 12223 | |
| 12224 | #define alc269_modes alc260_modes |
| 12225 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12226 | |
| 12227 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12228 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12229 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12230 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12231 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12232 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12233 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12234 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12235 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12236 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12237 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12238 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12239 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12240 | { } /* end */ |
| 12241 | }; |
| 12242 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12243 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12244 | /* output mixer control */ |
| 12245 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12246 | { |
| 12247 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12248 | .name = "Master Playback Switch", |
| 12249 | .info = snd_hda_mixer_amp_switch_info, |
| 12250 | .get = snd_hda_mixer_amp_switch_get, |
| 12251 | .put = alc268_acer_master_sw_put, |
| 12252 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12253 | }, |
| 12254 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12255 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12256 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12257 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12258 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12259 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12260 | { } |
| 12261 | }; |
| 12262 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12263 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12264 | /* output mixer control */ |
| 12265 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12266 | { |
| 12267 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12268 | .name = "Master Playback Switch", |
| 12269 | .info = snd_hda_mixer_amp_switch_info, |
| 12270 | .get = snd_hda_mixer_amp_switch_get, |
| 12271 | .put = alc268_acer_master_sw_put, |
| 12272 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12273 | }, |
| 12274 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12275 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12276 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12277 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12278 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12279 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12280 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12281 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12282 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12283 | { } |
| 12284 | }; |
| 12285 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12286 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12287 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12288 | .ops = &snd_hda_bind_vol, |
| 12289 | .values = { |
| 12290 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12291 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12292 | 0 |
| 12293 | }, |
| 12294 | }; |
| 12295 | |
| 12296 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12297 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12298 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12299 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12300 | { } /* end */ |
| 12301 | }; |
| 12302 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12303 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12304 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12305 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12306 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12307 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12308 | { } /* end */ |
| 12309 | }; |
| 12310 | |
| 12311 | /* FSC amilo */ |
| 12312 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12313 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12314 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12315 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12316 | { } /* end */ |
| 12317 | }; |
| 12318 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12319 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12320 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12321 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12322 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12323 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12324 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12325 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12326 | { } |
| 12327 | }; |
| 12328 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12329 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12330 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12331 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12332 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12333 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12334 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12335 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12336 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12337 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12338 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12339 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12340 | { } |
| 12341 | }; |
| 12342 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12343 | /* toggle speaker-output according to the hp-jack state */ |
| 12344 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12345 | { |
| 12346 | unsigned int present; |
| 12347 | unsigned char bits; |
| 12348 | |
| 12349 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12350 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12351 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12352 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12353 | AMP_IN_MUTE(0), bits); |
| 12354 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12355 | AMP_IN_MUTE(0), bits); |
| 12356 | |
| 12357 | snd_hda_codec_write(codec, 0x20, 0, |
| 12358 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12359 | snd_hda_codec_write(codec, 0x20, 0, |
| 12360 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12361 | |
| 12362 | snd_hda_codec_write(codec, 0x20, 0, |
| 12363 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12364 | snd_hda_codec_write(codec, 0x20, 0, |
| 12365 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12366 | } |
| 12367 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12368 | /* toggle speaker-output according to the hp-jacks state */ |
| 12369 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12370 | { |
| 12371 | unsigned int present; |
| 12372 | unsigned char bits; |
| 12373 | |
| 12374 | /* Check laptop headphone socket */ |
| 12375 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12376 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12377 | |
| 12378 | /* Check port replicator headphone socket */ |
| 12379 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12380 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12381 | |
| 12382 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12383 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12384 | AMP_IN_MUTE(0), bits); |
| 12385 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12386 | AMP_IN_MUTE(0), bits); |
| 12387 | |
| 12388 | snd_hda_codec_write(codec, 0x20, 0, |
| 12389 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12390 | snd_hda_codec_write(codec, 0x20, 0, |
| 12391 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12392 | |
| 12393 | snd_hda_codec_write(codec, 0x20, 0, |
| 12394 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12395 | snd_hda_codec_write(codec, 0x20, 0, |
| 12396 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12397 | } |
| 12398 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12399 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12400 | { |
| 12401 | unsigned int present; |
| 12402 | |
| 12403 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12404 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12405 | snd_hda_codec_write(codec, 0x23, 0, |
| 12406 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12407 | } |
| 12408 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12409 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12410 | { |
| 12411 | unsigned int present_laptop; |
| 12412 | unsigned int present_dock; |
| 12413 | |
| 12414 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12415 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12416 | |
| 12417 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12418 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12419 | |
| 12420 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12421 | if (present_dock) |
| 12422 | snd_hda_codec_write(codec, 0x23, 0, |
| 12423 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12424 | if (present_laptop) |
| 12425 | snd_hda_codec_write(codec, 0x23, 0, |
| 12426 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12427 | if (!present_dock && !present_laptop) |
| 12428 | snd_hda_codec_write(codec, 0x23, 0, |
| 12429 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12430 | } |
| 12431 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12432 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12433 | unsigned int res) |
| 12434 | { |
| 12435 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12436 | alc269_quanta_fl1_speaker_automute(codec); |
| 12437 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12438 | alc269_quanta_fl1_mic_automute(codec); |
| 12439 | } |
| 12440 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12441 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12442 | unsigned int res) |
| 12443 | { |
| 12444 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12445 | alc269_lifebook_speaker_automute(codec); |
| 12446 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12447 | alc269_lifebook_mic_autoswitch(codec); |
| 12448 | } |
| 12449 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12450 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12451 | { |
| 12452 | alc269_quanta_fl1_speaker_automute(codec); |
| 12453 | alc269_quanta_fl1_mic_automute(codec); |
| 12454 | } |
| 12455 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12456 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12457 | { |
| 12458 | alc269_lifebook_speaker_automute(codec); |
| 12459 | alc269_lifebook_mic_autoswitch(codec); |
| 12460 | } |
| 12461 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12462 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12463 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12464 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12465 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12466 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12467 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12468 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12469 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12470 | {} |
| 12471 | }; |
| 12472 | |
| 12473 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12474 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12475 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12476 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12477 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12478 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12479 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12480 | {} |
| 12481 | }; |
| 12482 | |
| 12483 | /* toggle speaker-output according to the hp-jack state */ |
| 12484 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12485 | { |
| 12486 | unsigned int present; |
| 12487 | unsigned char bits; |
| 12488 | |
| 12489 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12490 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12491 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12492 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12493 | AMP_IN_MUTE(0), bits); |
| 12494 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12495 | AMP_IN_MUTE(0), bits); |
| 12496 | } |
| 12497 | |
| 12498 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12499 | { |
| 12500 | unsigned int present; |
| 12501 | |
| 12502 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12503 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12504 | snd_hda_codec_write(codec, 0x23, 0, |
| 12505 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12506 | } |
| 12507 | |
| 12508 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12509 | { |
| 12510 | unsigned int present; |
| 12511 | |
| 12512 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12513 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12514 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12515 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12516 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12517 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12518 | } |
| 12519 | |
| 12520 | /* unsolicited event for HP jack sensing */ |
| 12521 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12522 | unsigned int res) |
| 12523 | { |
| 12524 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12525 | alc269_speaker_automute(codec); |
| 12526 | |
| 12527 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12528 | alc269_eeepc_dmic_automute(codec); |
| 12529 | } |
| 12530 | |
| 12531 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12532 | { |
| 12533 | alc269_speaker_automute(codec); |
| 12534 | alc269_eeepc_dmic_automute(codec); |
| 12535 | } |
| 12536 | |
| 12537 | /* unsolicited event for HP jack sensing */ |
| 12538 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12539 | unsigned int res) |
| 12540 | { |
| 12541 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12542 | alc269_speaker_automute(codec); |
| 12543 | |
| 12544 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12545 | alc269_eeepc_amic_automute(codec); |
| 12546 | } |
| 12547 | |
| 12548 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12549 | { |
| 12550 | alc269_speaker_automute(codec); |
| 12551 | alc269_eeepc_amic_automute(codec); |
| 12552 | } |
| 12553 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12554 | /* |
| 12555 | * generic initialization of ADC, input mixers and output mixers |
| 12556 | */ |
| 12557 | static struct hda_verb alc269_init_verbs[] = { |
| 12558 | /* |
| 12559 | * Unmute ADC0 and set the default input to mic-in |
| 12560 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12561 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12562 | |
| 12563 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12564 | * analog-loopback mixer widget |
| 12565 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12566 | * front panel mic (mic 2) |
| 12567 | */ |
| 12568 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12569 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12570 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12571 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12572 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12573 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12574 | |
| 12575 | /* |
| 12576 | * Set up output mixers (0x0c - 0x0e) |
| 12577 | */ |
| 12578 | /* set vol=0 to output mixers */ |
| 12579 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12580 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12581 | |
| 12582 | /* set up input amps for analog loopback */ |
| 12583 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12584 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12585 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12588 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12589 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12590 | |
| 12591 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12592 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12593 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12594 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12595 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12596 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12597 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12598 | |
| 12599 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12600 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12601 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12602 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12603 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12604 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12605 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12606 | |
| 12607 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12608 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12609 | |
| 12610 | /* FIXME: use matrix-type input source selection */ |
| 12611 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12612 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12613 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12614 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12615 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12616 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12617 | |
| 12618 | /* set EAPD */ |
| 12619 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12620 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12621 | { } |
| 12622 | }; |
| 12623 | |
| 12624 | /* add playback controls from the parsed DAC table */ |
| 12625 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12626 | const struct auto_pin_cfg *cfg) |
| 12627 | { |
| 12628 | hda_nid_t nid; |
| 12629 | int err; |
| 12630 | |
| 12631 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12632 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12633 | spec->multiout.dac_nids[0] = 2; |
| 12634 | |
| 12635 | nid = cfg->line_out_pins[0]; |
| 12636 | if (nid) { |
| 12637 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12638 | "Front Playback Volume", |
| 12639 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12640 | if (err < 0) |
| 12641 | return err; |
| 12642 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12643 | "Front Playback Switch", |
| 12644 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12645 | if (err < 0) |
| 12646 | return err; |
| 12647 | } |
| 12648 | |
| 12649 | nid = cfg->speaker_pins[0]; |
| 12650 | if (nid) { |
| 12651 | if (!cfg->line_out_pins[0]) { |
| 12652 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12653 | "Speaker Playback Volume", |
| 12654 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12655 | HDA_OUTPUT)); |
| 12656 | if (err < 0) |
| 12657 | return err; |
| 12658 | } |
| 12659 | if (nid == 0x16) { |
| 12660 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12661 | "Speaker Playback Switch", |
| 12662 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12663 | HDA_OUTPUT)); |
| 12664 | if (err < 0) |
| 12665 | return err; |
| 12666 | } else { |
| 12667 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12668 | "Speaker Playback Switch", |
| 12669 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12670 | HDA_OUTPUT)); |
| 12671 | if (err < 0) |
| 12672 | return err; |
| 12673 | } |
| 12674 | } |
| 12675 | nid = cfg->hp_pins[0]; |
| 12676 | if (nid) { |
| 12677 | /* spec->multiout.hp_nid = 2; */ |
| 12678 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12679 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12680 | "Headphone Playback Volume", |
| 12681 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12682 | HDA_OUTPUT)); |
| 12683 | if (err < 0) |
| 12684 | return err; |
| 12685 | } |
| 12686 | if (nid == 0x16) { |
| 12687 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12688 | "Headphone Playback Switch", |
| 12689 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12690 | HDA_OUTPUT)); |
| 12691 | if (err < 0) |
| 12692 | return err; |
| 12693 | } else { |
| 12694 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12695 | "Headphone Playback Switch", |
| 12696 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12697 | HDA_OUTPUT)); |
| 12698 | if (err < 0) |
| 12699 | return err; |
| 12700 | } |
| 12701 | } |
| 12702 | return 0; |
| 12703 | } |
| 12704 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12705 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12706 | const struct auto_pin_cfg *cfg) |
| 12707 | { |
| 12708 | int err; |
| 12709 | |
| 12710 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 12711 | if (err < 0) |
| 12712 | return err; |
| 12713 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 12714 | * because it's under 0x18 |
| 12715 | */ |
| 12716 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 12717 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12718 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12719 | imux->items[imux->num_items].label = "Int Mic"; |
| 12720 | imux->items[imux->num_items].index = 0x05; |
| 12721 | imux->num_items++; |
| 12722 | } |
| 12723 | return 0; |
| 12724 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12725 | |
| 12726 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12727 | #define alc269_loopbacks alc880_loopbacks |
| 12728 | #endif |
| 12729 | |
| 12730 | /* pcm configuration: identiacal with ALC880 */ |
| 12731 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12732 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12733 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12734 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12735 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 12736 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 12737 | .substreams = 1, |
| 12738 | .channels_min = 2, |
| 12739 | .channels_max = 8, |
| 12740 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 12741 | /* NID is set in alc_build_pcms */ |
| 12742 | .ops = { |
| 12743 | .open = alc880_playback_pcm_open, |
| 12744 | .prepare = alc880_playback_pcm_prepare, |
| 12745 | .cleanup = alc880_playback_pcm_cleanup |
| 12746 | }, |
| 12747 | }; |
| 12748 | |
| 12749 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 12750 | .substreams = 1, |
| 12751 | .channels_min = 2, |
| 12752 | .channels_max = 2, |
| 12753 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 12754 | /* NID is set in alc_build_pcms */ |
| 12755 | }; |
| 12756 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12757 | /* |
| 12758 | * BIOS auto configuration |
| 12759 | */ |
| 12760 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12761 | { |
| 12762 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 12763 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12764 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12765 | |
| 12766 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12767 | alc269_ignore); |
| 12768 | if (err < 0) |
| 12769 | return err; |
| 12770 | |
| 12771 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12772 | if (err < 0) |
| 12773 | return err; |
| 12774 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12775 | if (err < 0) |
| 12776 | return err; |
| 12777 | |
| 12778 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12779 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12780 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12781 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12782 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12783 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12784 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12785 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12786 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12787 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12788 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12789 | /* set default input source */ |
| 12790 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12791 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12792 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12793 | |
| 12794 | err = alc_auto_add_mic_boost(codec); |
| 12795 | if (err < 0) |
| 12796 | return err; |
| 12797 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12798 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12799 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12800 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12801 | return 1; |
| 12802 | } |
| 12803 | |
| 12804 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12805 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12806 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12807 | |
| 12808 | |
| 12809 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12810 | static void alc269_auto_init(struct hda_codec *codec) |
| 12811 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12812 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12813 | alc269_auto_init_multi_out(codec); |
| 12814 | alc269_auto_init_hp_out(codec); |
| 12815 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12816 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12817 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12818 | } |
| 12819 | |
| 12820 | /* |
| 12821 | * configuration and preset |
| 12822 | */ |
| 12823 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12824 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12825 | [ALC269_QUANTA_FL1] = "quanta", |
| 12826 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12827 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12828 | [ALC269_FUJITSU] = "fujitsu", |
| 12829 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12830 | }; |
| 12831 | |
| 12832 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12833 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12834 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12835 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 12836 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 12837 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 12838 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 12839 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 12840 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 12841 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12842 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12843 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12844 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12845 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 12846 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12847 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12848 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12849 | {} |
| 12850 | }; |
| 12851 | |
| 12852 | static struct alc_config_preset alc269_presets[] = { |
| 12853 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12854 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12855 | .init_verbs = { alc269_init_verbs }, |
| 12856 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12857 | .dac_nids = alc269_dac_nids, |
| 12858 | .hp_nid = 0x03, |
| 12859 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12860 | .channel_mode = alc269_modes, |
| 12861 | .input_mux = &alc269_capture_source, |
| 12862 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12863 | [ALC269_QUANTA_FL1] = { |
| 12864 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12865 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12866 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12867 | .dac_nids = alc269_dac_nids, |
| 12868 | .hp_nid = 0x03, |
| 12869 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12870 | .channel_mode = alc269_modes, |
| 12871 | .input_mux = &alc269_capture_source, |
| 12872 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12873 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12874 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12875 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12876 | .mixers = { alc269_eeepc_mixer }, |
| 12877 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12878 | .init_verbs = { alc269_init_verbs, |
| 12879 | alc269_eeepc_amic_init_verbs }, |
| 12880 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12881 | .dac_nids = alc269_dac_nids, |
| 12882 | .hp_nid = 0x03, |
| 12883 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12884 | .channel_mode = alc269_modes, |
| 12885 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 12886 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 12887 | .init_hook = alc269_eeepc_amic_inithook, |
| 12888 | }, |
| 12889 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12890 | .mixers = { alc269_eeepc_mixer }, |
| 12891 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12892 | .init_verbs = { alc269_init_verbs, |
| 12893 | alc269_eeepc_dmic_init_verbs }, |
| 12894 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12895 | .dac_nids = alc269_dac_nids, |
| 12896 | .hp_nid = 0x03, |
| 12897 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12898 | .channel_mode = alc269_modes, |
| 12899 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12900 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12901 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12902 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12903 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 12904 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12905 | .cap_mixer = alc269_epc_capture_mixer, |
| 12906 | .init_verbs = { alc269_init_verbs, |
| 12907 | alc269_eeepc_dmic_init_verbs }, |
| 12908 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12909 | .dac_nids = alc269_dac_nids, |
| 12910 | .hp_nid = 0x03, |
| 12911 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12912 | .channel_mode = alc269_modes, |
| 12913 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12914 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12915 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12916 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12917 | [ALC269_LIFEBOOK] = { |
| 12918 | .mixers = { alc269_lifebook_mixer }, |
| 12919 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 12920 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12921 | .dac_nids = alc269_dac_nids, |
| 12922 | .hp_nid = 0x03, |
| 12923 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12924 | .channel_mode = alc269_modes, |
| 12925 | .input_mux = &alc269_capture_source, |
| 12926 | .unsol_event = alc269_lifebook_unsol_event, |
| 12927 | .init_hook = alc269_lifebook_init_hook, |
| 12928 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12929 | }; |
| 12930 | |
| 12931 | static int patch_alc269(struct hda_codec *codec) |
| 12932 | { |
| 12933 | struct alc_spec *spec; |
| 12934 | int board_config; |
| 12935 | int err; |
| 12936 | |
| 12937 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12938 | if (spec == NULL) |
| 12939 | return -ENOMEM; |
| 12940 | |
| 12941 | codec->spec = spec; |
| 12942 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12943 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 12944 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12945 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 12946 | alc269_models, |
| 12947 | alc269_cfg_tbl); |
| 12948 | |
| 12949 | if (board_config < 0) { |
| 12950 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 12951 | "trying auto-probe from BIOS...\n"); |
| 12952 | board_config = ALC269_AUTO; |
| 12953 | } |
| 12954 | |
| 12955 | if (board_config == ALC269_AUTO) { |
| 12956 | /* automatic parse from the BIOS config */ |
| 12957 | err = alc269_parse_auto_config(codec); |
| 12958 | if (err < 0) { |
| 12959 | alc_free(codec); |
| 12960 | return err; |
| 12961 | } else if (!err) { |
| 12962 | printk(KERN_INFO |
| 12963 | "hda_codec: Cannot set up configuration " |
| 12964 | "from BIOS. Using base mode...\n"); |
| 12965 | board_config = ALC269_BASIC; |
| 12966 | } |
| 12967 | } |
| 12968 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12969 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12970 | if (err < 0) { |
| 12971 | alc_free(codec); |
| 12972 | return err; |
| 12973 | } |
| 12974 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12975 | if (board_config != ALC269_AUTO) |
| 12976 | setup_preset(spec, &alc269_presets[board_config]); |
| 12977 | |
| 12978 | spec->stream_name_analog = "ALC269 Analog"; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 12979 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 12980 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 12981 | * fix the sample rate of analog I/O to 44.1kHz |
| 12982 | */ |
| 12983 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 12984 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 12985 | } else { |
| 12986 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 12987 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 12988 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12989 | spec->stream_name_digital = "ALC269 Digital"; |
| 12990 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 12991 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 12992 | |
| 12993 | spec->adc_nids = alc269_adc_nids; |
| 12994 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12995 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12996 | if (!spec->cap_mixer) |
| 12997 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 12998 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12999 | |
| 13000 | codec->patch_ops = alc_patch_ops; |
| 13001 | if (board_config == ALC269_AUTO) |
| 13002 | spec->init_hook = alc269_auto_init; |
| 13003 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13004 | if (!spec->loopback.amplist) |
| 13005 | spec->loopback.amplist = alc269_loopbacks; |
| 13006 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13007 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13008 | |
| 13009 | return 0; |
| 13010 | } |
| 13011 | |
| 13012 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13013 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13014 | */ |
| 13015 | |
| 13016 | /* |
| 13017 | * set the path ways for 2 channel output |
| 13018 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13019 | */ |
| 13020 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13021 | /* set pin widget 1Ah (line in) for input */ |
| 13022 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13023 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13024 | * the vref |
| 13025 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13026 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13027 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13028 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13029 | #if 0 |
| 13030 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13031 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13032 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13033 | { } /* end */ |
| 13034 | }; |
| 13035 | /* |
| 13036 | * 6ch mode |
| 13037 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13038 | */ |
| 13039 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13040 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13041 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13042 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13043 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13044 | |
| 13045 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13046 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13047 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13048 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13049 | #if 0 |
| 13050 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13051 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13052 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13053 | { } /* end */ |
| 13054 | }; |
| 13055 | |
| 13056 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13057 | { 2, alc861_threestack_ch2_init }, |
| 13058 | { 6, alc861_threestack_ch6_init }, |
| 13059 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13060 | /* Set mic1 as input and unmute the mixer */ |
| 13061 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13062 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13063 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13064 | { } /* end */ |
| 13065 | }; |
| 13066 | /* Set mic1 as output and mute mixer */ |
| 13067 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13068 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13069 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13070 | { } /* end */ |
| 13071 | }; |
| 13072 | |
| 13073 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13074 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13075 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13076 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13077 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13078 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13079 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13080 | /* set pin widget 1Ah (line in) for input */ |
| 13081 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13082 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13083 | * the vref |
| 13084 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13085 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13086 | |
| 13087 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13088 | #if 0 |
| 13089 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13090 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13091 | #endif |
| 13092 | { } /* end */ |
| 13093 | }; |
| 13094 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13095 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13096 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13097 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13098 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13099 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13100 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13101 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13102 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13103 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13104 | |
| 13105 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13106 | #if 0 |
| 13107 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13108 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13109 | #endif |
| 13110 | { } /* end */ |
| 13111 | }; |
| 13112 | |
| 13113 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13114 | { 2, alc861_asus_ch2_init }, |
| 13115 | { 6, alc861_asus_ch6_init }, |
| 13116 | }; |
| 13117 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13118 | /* patch-ALC861 */ |
| 13119 | |
| 13120 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13121 | /* output mixer control */ |
| 13122 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13123 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13124 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13125 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13126 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13127 | |
| 13128 | /*Input mixer control */ |
| 13129 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13130 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13131 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13132 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13133 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13134 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13137 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13138 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13139 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13140 | { } /* end */ |
| 13141 | }; |
| 13142 | |
| 13143 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13144 | /* output mixer control */ |
| 13145 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13146 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13147 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13148 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13149 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13150 | |
| 13151 | /* Input mixer control */ |
| 13152 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13153 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13154 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13155 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13156 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13157 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13158 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13159 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13160 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13161 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13162 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13163 | { |
| 13164 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13165 | .name = "Channel Mode", |
| 13166 | .info = alc_ch_mode_info, |
| 13167 | .get = alc_ch_mode_get, |
| 13168 | .put = alc_ch_mode_put, |
| 13169 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13170 | }, |
| 13171 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13172 | }; |
| 13173 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13174 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13175 | /* output mixer control */ |
| 13176 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13177 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13178 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13179 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13180 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13181 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13182 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13183 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13184 | /* output mixer control */ |
| 13185 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13186 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13187 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13188 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13189 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13190 | |
| 13191 | /* Input mixer control */ |
| 13192 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13193 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13194 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13195 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13196 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13197 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13200 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13201 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13202 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13203 | { |
| 13204 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13205 | .name = "Channel Mode", |
| 13206 | .info = alc_ch_mode_info, |
| 13207 | .get = alc_ch_mode_get, |
| 13208 | .put = alc_ch_mode_put, |
| 13209 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13210 | }, |
| 13211 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13212 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13213 | |
| 13214 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13215 | /* output mixer control */ |
| 13216 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13217 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13218 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13219 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13220 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13221 | |
| 13222 | /* Input mixer control */ |
| 13223 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13224 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13225 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13226 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13227 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13228 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13229 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13230 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13231 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13232 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13233 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13234 | { |
| 13235 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13236 | .name = "Channel Mode", |
| 13237 | .info = alc_ch_mode_info, |
| 13238 | .get = alc_ch_mode_get, |
| 13239 | .put = alc_ch_mode_put, |
| 13240 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13241 | }, |
| 13242 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13243 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13244 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13245 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13246 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13247 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13248 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13249 | { } |
| 13250 | }; |
| 13251 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13252 | /* |
| 13253 | * generic initialization of ADC, input mixers and output mixers |
| 13254 | */ |
| 13255 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13256 | /* |
| 13257 | * Unmute ADC0 and set the default input to mic-in |
| 13258 | */ |
| 13259 | /* port-A for surround (rear panel) */ |
| 13260 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13261 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13262 | /* port-B for mic-in (rear panel) with vref */ |
| 13263 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13264 | /* port-C for line-in (rear panel) */ |
| 13265 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13266 | /* port-D for Front */ |
| 13267 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13268 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13269 | /* port-E for HP out (front panel) */ |
| 13270 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13271 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13272 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13273 | /* port-F for mic-in (front panel) with vref */ |
| 13274 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13275 | /* port-G for CLFE (rear panel) */ |
| 13276 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13277 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13278 | /* port-H for side (rear panel) */ |
| 13279 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13280 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13281 | /* CD-in */ |
| 13282 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13283 | /* route front mic to ADC1*/ |
| 13284 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13285 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13286 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13287 | /* Unmute DAC0~3 & spdif out*/ |
| 13288 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13289 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13290 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13291 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13292 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13293 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13294 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13295 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13296 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13297 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13298 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13299 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13300 | /* Unmute Stereo Mixer 15 */ |
| 13301 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13302 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13303 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13304 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13305 | |
| 13306 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13307 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13308 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13309 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13310 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13311 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13312 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13313 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13314 | /* hp used DAC 3 (Front) */ |
| 13315 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13316 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13317 | |
| 13318 | { } |
| 13319 | }; |
| 13320 | |
| 13321 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13322 | /* |
| 13323 | * Unmute ADC0 and set the default input to mic-in |
| 13324 | */ |
| 13325 | /* port-A for surround (rear panel) */ |
| 13326 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13327 | /* port-B for mic-in (rear panel) with vref */ |
| 13328 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13329 | /* port-C for line-in (rear panel) */ |
| 13330 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13331 | /* port-D for Front */ |
| 13332 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13333 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13334 | /* port-E for HP out (front panel) */ |
| 13335 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13336 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13337 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13338 | /* port-F for mic-in (front panel) with vref */ |
| 13339 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13340 | /* port-G for CLFE (rear panel) */ |
| 13341 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13342 | /* port-H for side (rear panel) */ |
| 13343 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13344 | /* CD-in */ |
| 13345 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13346 | /* route front mic to ADC1*/ |
| 13347 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13348 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13349 | /* Unmute DAC0~3 & spdif out*/ |
| 13350 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13351 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13352 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13353 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13354 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13355 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13356 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13357 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13358 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13359 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13360 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13361 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13362 | /* Unmute Stereo Mixer 15 */ |
| 13363 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13364 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13365 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13366 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13367 | |
| 13368 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13369 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13370 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13371 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13372 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13373 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13374 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13375 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13376 | /* hp used DAC 3 (Front) */ |
| 13377 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13378 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13379 | { } |
| 13380 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13381 | |
| 13382 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13383 | /* |
| 13384 | * Unmute ADC0 and set the default input to mic-in |
| 13385 | */ |
| 13386 | /* port-A for surround (rear panel) */ |
| 13387 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13388 | /* port-B for mic-in (rear panel) with vref */ |
| 13389 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13390 | /* port-C for line-in (rear panel) */ |
| 13391 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13392 | /* port-D for Front */ |
| 13393 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13394 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13395 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13396 | /* this has to be set to VREF80 */ |
| 13397 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13398 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13399 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13400 | /* port-F for mic-in (front panel) with vref */ |
| 13401 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13402 | /* port-G for CLFE (rear panel) */ |
| 13403 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13404 | /* port-H for side (rear panel) */ |
| 13405 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13406 | /* CD-in */ |
| 13407 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13408 | /* route front mic to ADC1*/ |
| 13409 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13410 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13411 | /* Unmute DAC0~3 & spdif out*/ |
| 13412 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13413 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13414 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13415 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13416 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13417 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13418 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13419 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13420 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13421 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13422 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13423 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13424 | /* Unmute Stereo Mixer 15 */ |
| 13425 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13426 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13427 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13428 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13429 | |
| 13430 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13431 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13432 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13433 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13434 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13435 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13436 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13437 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13438 | /* hp used DAC 3 (Front) */ |
| 13439 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13440 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13441 | { } |
| 13442 | }; |
| 13443 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13444 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13445 | /* |
| 13446 | * Unmute ADC0 and set the default input to mic-in |
| 13447 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13448 | /* port-A for surround (rear panel) |
| 13449 | * according to codec#0 this is the HP jack |
| 13450 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13451 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13452 | /* route front PCM to HP */ |
| 13453 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13454 | /* port-B for mic-in (rear panel) with vref */ |
| 13455 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13456 | /* port-C for line-in (rear panel) */ |
| 13457 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13458 | /* port-D for Front */ |
| 13459 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13460 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13461 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13462 | /* this has to be set to VREF80 */ |
| 13463 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13464 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13465 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13466 | /* port-F for mic-in (front panel) with vref */ |
| 13467 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13468 | /* port-G for CLFE (rear panel) */ |
| 13469 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13470 | /* port-H for side (rear panel) */ |
| 13471 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13472 | /* CD-in */ |
| 13473 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13474 | /* route front mic to ADC1*/ |
| 13475 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13476 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13477 | /* Unmute DAC0~3 & spdif out*/ |
| 13478 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13479 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13480 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13481 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13482 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13483 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13484 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13485 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13486 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13487 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13488 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13489 | /* Unmute Stereo Mixer 15 */ |
| 13490 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13491 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13492 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13493 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13494 | |
| 13495 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13496 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13497 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13498 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13499 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13500 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13501 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13502 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13503 | /* hp used DAC 3 (Front) */ |
| 13504 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13505 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13506 | { } |
| 13507 | }; |
| 13508 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13509 | /* additional init verbs for ASUS laptops */ |
| 13510 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13511 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13512 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13513 | { } |
| 13514 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13515 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13516 | /* |
| 13517 | * generic initialization of ADC, input mixers and output mixers |
| 13518 | */ |
| 13519 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13520 | /* |
| 13521 | * Unmute ADC0 and set the default input to mic-in |
| 13522 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13523 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13524 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13525 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13526 | /* Unmute DAC0~3 & spdif out*/ |
| 13527 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13528 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13529 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13530 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13531 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13532 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13533 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13534 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13535 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13536 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13537 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13538 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13539 | /* Unmute Stereo Mixer 15 */ |
| 13540 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13541 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13542 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13543 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13544 | |
| 13545 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13546 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13547 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13548 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13549 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13550 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13551 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13552 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13553 | |
| 13554 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13555 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13556 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13557 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13558 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13559 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13560 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13561 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13562 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13563 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13564 | |
| 13565 | { } |
| 13566 | }; |
| 13567 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13568 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13569 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13570 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13571 | { } |
| 13572 | }; |
| 13573 | |
| 13574 | /* toggle speaker-output according to the hp-jack state */ |
| 13575 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13576 | { |
| 13577 | unsigned int present; |
| 13578 | |
| 13579 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13580 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13581 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13582 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13583 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13584 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13585 | } |
| 13586 | |
| 13587 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13588 | unsigned int res) |
| 13589 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13590 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13591 | alc861_toshiba_automute(codec); |
| 13592 | } |
| 13593 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13594 | /* pcm configuration: identiacal with ALC880 */ |
| 13595 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13596 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13597 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13598 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13599 | |
| 13600 | |
| 13601 | #define ALC861_DIGOUT_NID 0x07 |
| 13602 | |
| 13603 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13604 | { 8, NULL } |
| 13605 | }; |
| 13606 | |
| 13607 | static hda_nid_t alc861_dac_nids[4] = { |
| 13608 | /* front, surround, clfe, side */ |
| 13609 | 0x03, 0x06, 0x05, 0x04 |
| 13610 | }; |
| 13611 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13612 | static hda_nid_t alc660_dac_nids[3] = { |
| 13613 | /* front, clfe, surround */ |
| 13614 | 0x03, 0x05, 0x06 |
| 13615 | }; |
| 13616 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13617 | static hda_nid_t alc861_adc_nids[1] = { |
| 13618 | /* ADC0-2 */ |
| 13619 | 0x08, |
| 13620 | }; |
| 13621 | |
| 13622 | static struct hda_input_mux alc861_capture_source = { |
| 13623 | .num_items = 5, |
| 13624 | .items = { |
| 13625 | { "Mic", 0x0 }, |
| 13626 | { "Front Mic", 0x3 }, |
| 13627 | { "Line", 0x1 }, |
| 13628 | { "CD", 0x4 }, |
| 13629 | { "Mixer", 0x5 }, |
| 13630 | }, |
| 13631 | }; |
| 13632 | |
| 13633 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13634 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13635 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13636 | { |
| 13637 | int i; |
| 13638 | hda_nid_t nid; |
| 13639 | |
| 13640 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13641 | for (i = 0; i < cfg->line_outs; i++) { |
| 13642 | nid = cfg->line_out_pins[i]; |
| 13643 | if (nid) { |
| 13644 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13645 | continue; |
| 13646 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13647 | } |
| 13648 | } |
| 13649 | spec->multiout.num_dacs = cfg->line_outs; |
| 13650 | return 0; |
| 13651 | } |
| 13652 | |
| 13653 | /* add playback controls from the parsed DAC table */ |
| 13654 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13655 | const struct auto_pin_cfg *cfg) |
| 13656 | { |
| 13657 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13658 | static const char *chname[4] = { |
| 13659 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13660 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13661 | hda_nid_t nid; |
| 13662 | int i, idx, err; |
| 13663 | |
| 13664 | for (i = 0; i < cfg->line_outs; i++) { |
| 13665 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13666 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13667 | continue; |
| 13668 | if (nid == 0x05) { |
| 13669 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13670 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13671 | "Center Playback Switch", |
| 13672 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13673 | HDA_OUTPUT)); |
| 13674 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13675 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13676 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13677 | "LFE Playback Switch", |
| 13678 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13679 | HDA_OUTPUT)); |
| 13680 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13681 | return err; |
| 13682 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13683 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13684 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13685 | if (nid == alc861_dac_nids[idx]) |
| 13686 | break; |
| 13687 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13688 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13689 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13690 | HDA_OUTPUT)); |
| 13691 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13692 | return err; |
| 13693 | } |
| 13694 | } |
| 13695 | return 0; |
| 13696 | } |
| 13697 | |
| 13698 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13699 | { |
| 13700 | int err; |
| 13701 | hda_nid_t nid; |
| 13702 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13703 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13704 | return 0; |
| 13705 | |
| 13706 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13707 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13708 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13709 | "Headphone Playback Switch", |
| 13710 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13711 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13712 | return err; |
| 13713 | spec->multiout.hp_nid = nid; |
| 13714 | } |
| 13715 | return 0; |
| 13716 | } |
| 13717 | |
| 13718 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13719 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13720 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13721 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13722 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13723 | int i, err, idx, idx1; |
| 13724 | |
| 13725 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13726 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13727 | case 0x0c: |
| 13728 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13729 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13730 | break; |
| 13731 | case 0x0f: |
| 13732 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13733 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13734 | break; |
| 13735 | case 0x0d: |
| 13736 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13737 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13738 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13739 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13740 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13741 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13742 | break; |
| 13743 | case 0x11: |
| 13744 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13745 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13746 | break; |
| 13747 | default: |
| 13748 | continue; |
| 13749 | } |
| 13750 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13751 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13752 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13753 | if (err < 0) |
| 13754 | return err; |
| 13755 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13756 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13757 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13758 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13759 | } |
| 13760 | return 0; |
| 13761 | } |
| 13762 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13763 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13764 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13765 | int pin_type, int dac_idx) |
| 13766 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13767 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13768 | pin_type); |
| 13769 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13770 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13771 | } |
| 13772 | |
| 13773 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13774 | { |
| 13775 | struct alc_spec *spec = codec->spec; |
| 13776 | int i; |
| 13777 | |
| 13778 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13779 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13780 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13781 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13782 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13783 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13784 | } |
| 13785 | } |
| 13786 | |
| 13787 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13788 | { |
| 13789 | struct alc_spec *spec = codec->spec; |
| 13790 | hda_nid_t pin; |
| 13791 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13792 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13793 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13794 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13795 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13796 | pin = spec->autocfg.speaker_pins[0]; |
| 13797 | if (pin) |
| 13798 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13799 | } |
| 13800 | |
| 13801 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13802 | { |
| 13803 | struct alc_spec *spec = codec->spec; |
| 13804 | int i; |
| 13805 | |
| 13806 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13807 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 13808 | if (nid >= 0x0c && nid <= 0x11) |
| 13809 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13810 | } |
| 13811 | } |
| 13812 | |
| 13813 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13814 | /* return 1 if successful, 0 if the proper config is not found, |
| 13815 | * or a negative error code |
| 13816 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13817 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13818 | { |
| 13819 | struct alc_spec *spec = codec->spec; |
| 13820 | int err; |
| 13821 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13822 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13823 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13824 | alc861_ignore); |
| 13825 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13826 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13827 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13828 | return 0; /* can't find valid BIOS pin config */ |
| 13829 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13830 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13831 | if (err < 0) |
| 13832 | return err; |
| 13833 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13834 | if (err < 0) |
| 13835 | return err; |
| 13836 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13837 | if (err < 0) |
| 13838 | return err; |
| 13839 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13840 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13841 | return err; |
| 13842 | |
| 13843 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13844 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13845 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13846 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13847 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13848 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13849 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13850 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13851 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13852 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13853 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13854 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13855 | |
| 13856 | spec->adc_nids = alc861_adc_nids; |
| 13857 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13858 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13859 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 13860 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 13861 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13862 | return 1; |
| 13863 | } |
| 13864 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13865 | /* additional initialization for auto-configuration model */ |
| 13866 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13867 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13868 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13869 | alc861_auto_init_multi_out(codec); |
| 13870 | alc861_auto_init_hp_out(codec); |
| 13871 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13872 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13873 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13874 | } |
| 13875 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13876 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13877 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13878 | { 0x15, HDA_INPUT, 0 }, |
| 13879 | { 0x15, HDA_INPUT, 1 }, |
| 13880 | { 0x15, HDA_INPUT, 2 }, |
| 13881 | { 0x15, HDA_INPUT, 3 }, |
| 13882 | { } /* end */ |
| 13883 | }; |
| 13884 | #endif |
| 13885 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13886 | |
| 13887 | /* |
| 13888 | * configuration and preset |
| 13889 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13890 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 13891 | [ALC861_3ST] = "3stack", |
| 13892 | [ALC660_3ST] = "3stack-660", |
| 13893 | [ALC861_3ST_DIG] = "3stack-dig", |
| 13894 | [ALC861_6ST_DIG] = "6stack-dig", |
| 13895 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 13896 | [ALC861_TOSHIBA] = "toshiba", |
| 13897 | [ALC861_ASUS] = "asus", |
| 13898 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 13899 | [ALC861_AUTO] = "auto", |
| 13900 | }; |
| 13901 | |
| 13902 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 13903 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13904 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13905 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13906 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13907 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 13908 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 13909 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 13910 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 13911 | * Any other models that need this preset? |
| 13912 | */ |
| 13913 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 13914 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 13915 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13916 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 13917 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 13918 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 13919 | /* FIXME: the below seems conflict */ |
| 13920 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 13921 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 13922 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13923 | {} |
| 13924 | }; |
| 13925 | |
| 13926 | static struct alc_config_preset alc861_presets[] = { |
| 13927 | [ALC861_3ST] = { |
| 13928 | .mixers = { alc861_3ST_mixer }, |
| 13929 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13930 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13931 | .dac_nids = alc861_dac_nids, |
| 13932 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13933 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13934 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13935 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13936 | .adc_nids = alc861_adc_nids, |
| 13937 | .input_mux = &alc861_capture_source, |
| 13938 | }, |
| 13939 | [ALC861_3ST_DIG] = { |
| 13940 | .mixers = { alc861_base_mixer }, |
| 13941 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13942 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13943 | .dac_nids = alc861_dac_nids, |
| 13944 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13945 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13946 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13947 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13948 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13949 | .adc_nids = alc861_adc_nids, |
| 13950 | .input_mux = &alc861_capture_source, |
| 13951 | }, |
| 13952 | [ALC861_6ST_DIG] = { |
| 13953 | .mixers = { alc861_base_mixer }, |
| 13954 | .init_verbs = { alc861_base_init_verbs }, |
| 13955 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13956 | .dac_nids = alc861_dac_nids, |
| 13957 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13958 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 13959 | .channel_mode = alc861_8ch_modes, |
| 13960 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13961 | .adc_nids = alc861_adc_nids, |
| 13962 | .input_mux = &alc861_capture_source, |
| 13963 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13964 | [ALC660_3ST] = { |
| 13965 | .mixers = { alc861_3ST_mixer }, |
| 13966 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13967 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 13968 | .dac_nids = alc660_dac_nids, |
| 13969 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13970 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13971 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13972 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13973 | .adc_nids = alc861_adc_nids, |
| 13974 | .input_mux = &alc861_capture_source, |
| 13975 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13976 | [ALC861_UNIWILL_M31] = { |
| 13977 | .mixers = { alc861_uniwill_m31_mixer }, |
| 13978 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 13979 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13980 | .dac_nids = alc861_dac_nids, |
| 13981 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13982 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13983 | .channel_mode = alc861_uniwill_m31_modes, |
| 13984 | .need_dac_fix = 1, |
| 13985 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13986 | .adc_nids = alc861_adc_nids, |
| 13987 | .input_mux = &alc861_capture_source, |
| 13988 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13989 | [ALC861_TOSHIBA] = { |
| 13990 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13991 | .init_verbs = { alc861_base_init_verbs, |
| 13992 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13993 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13994 | .dac_nids = alc861_dac_nids, |
| 13995 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13996 | .channel_mode = alc883_3ST_2ch_modes, |
| 13997 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13998 | .adc_nids = alc861_adc_nids, |
| 13999 | .input_mux = &alc861_capture_source, |
| 14000 | .unsol_event = alc861_toshiba_unsol_event, |
| 14001 | .init_hook = alc861_toshiba_automute, |
| 14002 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14003 | [ALC861_ASUS] = { |
| 14004 | .mixers = { alc861_asus_mixer }, |
| 14005 | .init_verbs = { alc861_asus_init_verbs }, |
| 14006 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14007 | .dac_nids = alc861_dac_nids, |
| 14008 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14009 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14010 | .channel_mode = alc861_asus_modes, |
| 14011 | .need_dac_fix = 1, |
| 14012 | .hp_nid = 0x06, |
| 14013 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14014 | .adc_nids = alc861_adc_nids, |
| 14015 | .input_mux = &alc861_capture_source, |
| 14016 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14017 | [ALC861_ASUS_LAPTOP] = { |
| 14018 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14019 | .init_verbs = { alc861_asus_init_verbs, |
| 14020 | alc861_asus_laptop_init_verbs }, |
| 14021 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14022 | .dac_nids = alc861_dac_nids, |
| 14023 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14024 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14025 | .channel_mode = alc883_3ST_2ch_modes, |
| 14026 | .need_dac_fix = 1, |
| 14027 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14028 | .adc_nids = alc861_adc_nids, |
| 14029 | .input_mux = &alc861_capture_source, |
| 14030 | }, |
| 14031 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14032 | |
| 14033 | |
| 14034 | static int patch_alc861(struct hda_codec *codec) |
| 14035 | { |
| 14036 | struct alc_spec *spec; |
| 14037 | int board_config; |
| 14038 | int err; |
| 14039 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14040 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14041 | if (spec == NULL) |
| 14042 | return -ENOMEM; |
| 14043 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14044 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14045 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14046 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14047 | alc861_models, |
| 14048 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14049 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14050 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14051 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 14052 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14053 | board_config = ALC861_AUTO; |
| 14054 | } |
| 14055 | |
| 14056 | if (board_config == ALC861_AUTO) { |
| 14057 | /* automatic parse from the BIOS config */ |
| 14058 | err = alc861_parse_auto_config(codec); |
| 14059 | if (err < 0) { |
| 14060 | alc_free(codec); |
| 14061 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14062 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14063 | printk(KERN_INFO |
| 14064 | "hda_codec: Cannot set up configuration " |
| 14065 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14066 | board_config = ALC861_3ST_DIG; |
| 14067 | } |
| 14068 | } |
| 14069 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14070 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14071 | if (err < 0) { |
| 14072 | alc_free(codec); |
| 14073 | return err; |
| 14074 | } |
| 14075 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14076 | if (board_config != ALC861_AUTO) |
| 14077 | setup_preset(spec, &alc861_presets[board_config]); |
| 14078 | |
| 14079 | spec->stream_name_analog = "ALC861 Analog"; |
| 14080 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14081 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14082 | |
| 14083 | spec->stream_name_digital = "ALC861 Digital"; |
| 14084 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14085 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14086 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14087 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14088 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14089 | spec->vmaster_nid = 0x03; |
| 14090 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14091 | codec->patch_ops = alc_patch_ops; |
| 14092 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14093 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14094 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14095 | if (!spec->loopback.amplist) |
| 14096 | spec->loopback.amplist = alc861_loopbacks; |
| 14097 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14098 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14099 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14100 | return 0; |
| 14101 | } |
| 14102 | |
| 14103 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14104 | * ALC861-VD support |
| 14105 | * |
| 14106 | * Based on ALC882 |
| 14107 | * |
| 14108 | * In addition, an independent DAC |
| 14109 | */ |
| 14110 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14111 | |
| 14112 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14113 | /* front, surr, clfe, side surr */ |
| 14114 | 0x02, 0x03, 0x04, 0x05 |
| 14115 | }; |
| 14116 | |
| 14117 | /* dac_nids for ALC660vd are in a different order - according to |
| 14118 | * Realtek's driver. |
| 14119 | * This should probably tesult in a different mixer for 6stack models |
| 14120 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14121 | * - and it is the same as in 861vd. |
| 14122 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14123 | */ |
| 14124 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14125 | /* front, rear, clfe, rear_surr */ |
| 14126 | 0x02, 0x04, 0x03 |
| 14127 | }; |
| 14128 | |
| 14129 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14130 | /* ADC0 */ |
| 14131 | 0x09, |
| 14132 | }; |
| 14133 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14134 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14135 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14136 | /* input MUX */ |
| 14137 | /* FIXME: should be a matrix-type input source selection */ |
| 14138 | static struct hda_input_mux alc861vd_capture_source = { |
| 14139 | .num_items = 4, |
| 14140 | .items = { |
| 14141 | { "Mic", 0x0 }, |
| 14142 | { "Front Mic", 0x1 }, |
| 14143 | { "Line", 0x2 }, |
| 14144 | { "CD", 0x4 }, |
| 14145 | }, |
| 14146 | }; |
| 14147 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14148 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14149 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14150 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14151 | { "Ext Mic", 0x0 }, |
| 14152 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14153 | }, |
| 14154 | }; |
| 14155 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14156 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14157 | .num_items = 2, |
| 14158 | .items = { |
| 14159 | { "Front Mic", 0x0 }, |
| 14160 | { "ATAPI Mic", 0x1 }, |
| 14161 | }, |
| 14162 | }; |
| 14163 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14164 | /* |
| 14165 | * 2ch mode |
| 14166 | */ |
| 14167 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14168 | { 2, NULL } |
| 14169 | }; |
| 14170 | |
| 14171 | /* |
| 14172 | * 6ch mode |
| 14173 | */ |
| 14174 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14175 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14176 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14177 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14178 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14179 | { } /* end */ |
| 14180 | }; |
| 14181 | |
| 14182 | /* |
| 14183 | * 8ch mode |
| 14184 | */ |
| 14185 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14186 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14187 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14188 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14189 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14190 | { } /* end */ |
| 14191 | }; |
| 14192 | |
| 14193 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14194 | { 6, alc861vd_6stack_ch6_init }, |
| 14195 | { 8, alc861vd_6stack_ch8_init }, |
| 14196 | }; |
| 14197 | |
| 14198 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14199 | { |
| 14200 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14201 | .name = "Channel Mode", |
| 14202 | .info = alc_ch_mode_info, |
| 14203 | .get = alc_ch_mode_get, |
| 14204 | .put = alc_ch_mode_put, |
| 14205 | }, |
| 14206 | { } /* end */ |
| 14207 | }; |
| 14208 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14209 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14210 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14211 | */ |
| 14212 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14213 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14214 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14215 | |
| 14216 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14217 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14218 | |
| 14219 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14220 | HDA_OUTPUT), |
| 14221 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14222 | HDA_OUTPUT), |
| 14223 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14224 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14225 | |
| 14226 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14227 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14228 | |
| 14229 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14230 | |
| 14231 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14232 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14233 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14234 | |
| 14235 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14236 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14237 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14238 | |
| 14239 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14240 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14241 | |
| 14242 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14243 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14244 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14245 | { } /* end */ |
| 14246 | }; |
| 14247 | |
| 14248 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14249 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14250 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14251 | |
| 14252 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14253 | |
| 14254 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14255 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14256 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14257 | |
| 14258 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14259 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14260 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14261 | |
| 14262 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14263 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14264 | |
| 14265 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14266 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14267 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14268 | { } /* end */ |
| 14269 | }; |
| 14270 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14271 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14272 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14273 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14274 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14275 | |
| 14276 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14277 | |
| 14278 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14279 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14280 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14281 | |
| 14282 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14283 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14284 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14285 | |
| 14286 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14287 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14288 | |
| 14289 | { } /* end */ |
| 14290 | }; |
| 14291 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14292 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14293 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14294 | */ |
| 14295 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14296 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14297 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14298 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14299 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14300 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14301 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14302 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14303 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14304 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14305 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14306 | { } /* end */ |
| 14307 | }; |
| 14308 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14309 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14310 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14311 | */ |
| 14312 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14313 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14314 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14315 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14316 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14317 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14318 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14319 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14320 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14321 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14322 | { } /* end */ |
| 14323 | }; |
| 14324 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14325 | /* |
| 14326 | * generic initialization of ADC, input mixers and output mixers |
| 14327 | */ |
| 14328 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14329 | /* |
| 14330 | * Unmute ADC0 and set the default input to mic-in |
| 14331 | */ |
| 14332 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14333 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14334 | |
| 14335 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14336 | * the analog-loopback mixer widget |
| 14337 | */ |
| 14338 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14339 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14340 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14341 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14342 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14343 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14344 | |
| 14345 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14346 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14347 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14348 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14349 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14350 | |
| 14351 | /* |
| 14352 | * Set up output mixers (0x02 - 0x05) |
| 14353 | */ |
| 14354 | /* set vol=0 to output mixers */ |
| 14355 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14356 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14357 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14358 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14359 | |
| 14360 | /* set up input amps for analog loopback */ |
| 14361 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14362 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14364 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14365 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14366 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14367 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14368 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14369 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14370 | |
| 14371 | { } |
| 14372 | }; |
| 14373 | |
| 14374 | /* |
| 14375 | * 3-stack pin configuration: |
| 14376 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14377 | */ |
| 14378 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14379 | /* |
| 14380 | * Set pin mode and muting |
| 14381 | */ |
| 14382 | /* set front pin widgets 0x14 for output */ |
| 14383 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14384 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14385 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14386 | |
| 14387 | /* Mic (rear) pin: input vref at 80% */ |
| 14388 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14389 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14390 | /* Front Mic pin: input vref at 80% */ |
| 14391 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14392 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14393 | /* Line In pin: input */ |
| 14394 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14395 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14396 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14397 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14398 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14399 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14400 | /* CD pin widget for input */ |
| 14401 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14402 | |
| 14403 | { } |
| 14404 | }; |
| 14405 | |
| 14406 | /* |
| 14407 | * 6-stack pin configuration: |
| 14408 | */ |
| 14409 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14410 | /* |
| 14411 | * Set pin mode and muting |
| 14412 | */ |
| 14413 | /* set front pin widgets 0x14 for output */ |
| 14414 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14415 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14416 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14417 | |
| 14418 | /* Rear Pin: output 1 (0x0d) */ |
| 14419 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14420 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14421 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14422 | /* CLFE Pin: output 2 (0x0e) */ |
| 14423 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14424 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14425 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14426 | /* Side Pin: output 3 (0x0f) */ |
| 14427 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14428 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14429 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14430 | |
| 14431 | /* Mic (rear) pin: input vref at 80% */ |
| 14432 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14433 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14434 | /* Front Mic pin: input vref at 80% */ |
| 14435 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14436 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14437 | /* Line In pin: input */ |
| 14438 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14439 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14440 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14441 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14442 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14443 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14444 | /* CD pin widget for input */ |
| 14445 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14446 | |
| 14447 | { } |
| 14448 | }; |
| 14449 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14450 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14451 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14452 | { } |
| 14453 | }; |
| 14454 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14455 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14456 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14457 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14458 | { } |
| 14459 | }; |
| 14460 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14461 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14463 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14464 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14465 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14466 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14467 | {} |
| 14468 | }; |
| 14469 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14470 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14471 | { |
| 14472 | unsigned int present; |
| 14473 | unsigned char bits; |
| 14474 | |
| 14475 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14476 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14477 | bits = present ? HDA_AMP_MUTE : 0; |
| 14478 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14479 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14480 | } |
| 14481 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14482 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14483 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14484 | struct alc_spec *spec = codec->spec; |
| 14485 | |
| 14486 | spec->autocfg.hp_pins[0] = 0x1b; |
| 14487 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14488 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14489 | alc861vd_lenovo_mic_automute(codec); |
| 14490 | } |
| 14491 | |
| 14492 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14493 | unsigned int res) |
| 14494 | { |
| 14495 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14496 | case ALC880_MIC_EVENT: |
| 14497 | alc861vd_lenovo_mic_automute(codec); |
| 14498 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14499 | default: |
| 14500 | alc_automute_amp_unsol_event(codec, res); |
| 14501 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14502 | } |
| 14503 | } |
| 14504 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14505 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14506 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14507 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14508 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14509 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14510 | |
| 14511 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14512 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14513 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14514 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14515 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14516 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14517 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14518 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14519 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14520 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14521 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14522 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14523 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14524 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14525 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14526 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14527 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14528 | |
| 14529 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14530 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14531 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14532 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14533 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14534 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14535 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14536 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14537 | |
| 14538 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14539 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14540 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14541 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14542 | |
| 14543 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14544 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14545 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14546 | |
| 14547 | { } /* end */ |
| 14548 | }; |
| 14549 | |
| 14550 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14551 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14552 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14553 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14554 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14555 | spec->autocfg.hp_pins[0] = 0x15; |
| 14556 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14557 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14558 | } |
| 14559 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14560 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14561 | #define alc861vd_loopbacks alc880_loopbacks |
| 14562 | #endif |
| 14563 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14564 | /* pcm configuration: identiacal with ALC880 */ |
| 14565 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14566 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14567 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14568 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14569 | |
| 14570 | /* |
| 14571 | * configuration and preset |
| 14572 | */ |
| 14573 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14574 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14575 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14576 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14577 | [ALC861VD_3ST] = "3stack", |
| 14578 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14579 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14580 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14581 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14582 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14583 | [ALC861VD_AUTO] = "auto", |
| 14584 | }; |
| 14585 | |
| 14586 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14587 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14588 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14589 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14590 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14591 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14592 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14593 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14594 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14595 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14596 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14597 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14598 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14599 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 14600 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14601 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14602 | {} |
| 14603 | }; |
| 14604 | |
| 14605 | static struct alc_config_preset alc861vd_presets[] = { |
| 14606 | [ALC660VD_3ST] = { |
| 14607 | .mixers = { alc861vd_3st_mixer }, |
| 14608 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14609 | alc861vd_3stack_init_verbs }, |
| 14610 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14611 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14612 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14613 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14614 | .input_mux = &alc861vd_capture_source, |
| 14615 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14616 | [ALC660VD_3ST_DIG] = { |
| 14617 | .mixers = { alc861vd_3st_mixer }, |
| 14618 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14619 | alc861vd_3stack_init_verbs }, |
| 14620 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14621 | .dac_nids = alc660vd_dac_nids, |
| 14622 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14623 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14624 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14625 | .input_mux = &alc861vd_capture_source, |
| 14626 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14627 | [ALC861VD_3ST] = { |
| 14628 | .mixers = { alc861vd_3st_mixer }, |
| 14629 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14630 | alc861vd_3stack_init_verbs }, |
| 14631 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14632 | .dac_nids = alc861vd_dac_nids, |
| 14633 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14634 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14635 | .input_mux = &alc861vd_capture_source, |
| 14636 | }, |
| 14637 | [ALC861VD_3ST_DIG] = { |
| 14638 | .mixers = { alc861vd_3st_mixer }, |
| 14639 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14640 | alc861vd_3stack_init_verbs }, |
| 14641 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14642 | .dac_nids = alc861vd_dac_nids, |
| 14643 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14644 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14645 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14646 | .input_mux = &alc861vd_capture_source, |
| 14647 | }, |
| 14648 | [ALC861VD_6ST_DIG] = { |
| 14649 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14650 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14651 | alc861vd_6stack_init_verbs }, |
| 14652 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14653 | .dac_nids = alc861vd_dac_nids, |
| 14654 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14655 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14656 | .channel_mode = alc861vd_6stack_modes, |
| 14657 | .input_mux = &alc861vd_capture_source, |
| 14658 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14659 | [ALC861VD_LENOVO] = { |
| 14660 | .mixers = { alc861vd_lenovo_mixer }, |
| 14661 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14662 | alc861vd_3stack_init_verbs, |
| 14663 | alc861vd_eapd_verbs, |
| 14664 | alc861vd_lenovo_unsol_verbs }, |
| 14665 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14666 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14667 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14668 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14669 | .input_mux = &alc861vd_capture_source, |
| 14670 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14671 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14672 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14673 | [ALC861VD_DALLAS] = { |
| 14674 | .mixers = { alc861vd_dallas_mixer }, |
| 14675 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14676 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14677 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14678 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14679 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14680 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14681 | .unsol_event = alc_automute_amp_unsol_event, |
| 14682 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14683 | }, |
| 14684 | [ALC861VD_HP] = { |
| 14685 | .mixers = { alc861vd_hp_mixer }, |
| 14686 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14687 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14688 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14689 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14690 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14691 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14692 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14693 | .unsol_event = alc_automute_amp_unsol_event, |
| 14694 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14695 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14696 | [ALC660VD_ASUS_V1S] = { |
| 14697 | .mixers = { alc861vd_lenovo_mixer }, |
| 14698 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14699 | alc861vd_3stack_init_verbs, |
| 14700 | alc861vd_eapd_verbs, |
| 14701 | alc861vd_lenovo_unsol_verbs }, |
| 14702 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14703 | .dac_nids = alc660vd_dac_nids, |
| 14704 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14705 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14706 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14707 | .input_mux = &alc861vd_capture_source, |
| 14708 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14709 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14710 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14711 | }; |
| 14712 | |
| 14713 | /* |
| 14714 | * BIOS auto configuration |
| 14715 | */ |
| 14716 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14717 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14718 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14719 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14720 | } |
| 14721 | |
| 14722 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14723 | { |
| 14724 | struct alc_spec *spec = codec->spec; |
| 14725 | int i; |
| 14726 | |
| 14727 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14728 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14729 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14730 | if (nid) |
| 14731 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14732 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14733 | } |
| 14734 | } |
| 14735 | |
| 14736 | |
| 14737 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14738 | { |
| 14739 | struct alc_spec *spec = codec->spec; |
| 14740 | hda_nid_t pin; |
| 14741 | |
| 14742 | pin = spec->autocfg.hp_pins[0]; |
| 14743 | if (pin) /* connect to front and use dac 0 */ |
| 14744 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14745 | pin = spec->autocfg.speaker_pins[0]; |
| 14746 | if (pin) |
| 14747 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14748 | } |
| 14749 | |
| 14750 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14751 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14752 | |
| 14753 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14754 | { |
| 14755 | struct alc_spec *spec = codec->spec; |
| 14756 | int i; |
| 14757 | |
| 14758 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14759 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14760 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14761 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 14762 | if (nid != ALC861VD_PIN_CD_NID && |
| 14763 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14764 | snd_hda_codec_write(codec, nid, 0, |
| 14765 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14766 | AMP_OUT_MUTE); |
| 14767 | } |
| 14768 | } |
| 14769 | } |
| 14770 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14771 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14772 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14773 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14774 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14775 | |
| 14776 | /* add playback controls from the parsed DAC table */ |
| 14777 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14778 | * different NIDs for mute/unmute switch and volume control */ |
| 14779 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14780 | const struct auto_pin_cfg *cfg) |
| 14781 | { |
| 14782 | char name[32]; |
| 14783 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14784 | hda_nid_t nid_v, nid_s; |
| 14785 | int i, err; |
| 14786 | |
| 14787 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14788 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14789 | continue; |
| 14790 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14791 | alc880_dac_to_idx( |
| 14792 | spec->multiout.dac_nids[i])); |
| 14793 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14794 | alc880_dac_to_idx( |
| 14795 | spec->multiout.dac_nids[i])); |
| 14796 | |
| 14797 | if (i == 2) { |
| 14798 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14799 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14800 | "Center Playback Volume", |
| 14801 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14802 | HDA_OUTPUT)); |
| 14803 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14804 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14805 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14806 | "LFE Playback Volume", |
| 14807 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14808 | HDA_OUTPUT)); |
| 14809 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14810 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14811 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14812 | "Center Playback Switch", |
| 14813 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14814 | HDA_INPUT)); |
| 14815 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14816 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14817 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14818 | "LFE Playback Switch", |
| 14819 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14820 | HDA_INPUT)); |
| 14821 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14822 | return err; |
| 14823 | } else { |
| 14824 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14825 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14826 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14827 | HDA_OUTPUT)); |
| 14828 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14829 | return err; |
| 14830 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14831 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14832 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14833 | HDA_INPUT)); |
| 14834 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14835 | return err; |
| 14836 | } |
| 14837 | } |
| 14838 | return 0; |
| 14839 | } |
| 14840 | |
| 14841 | /* add playback controls for speaker and HP outputs */ |
| 14842 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14843 | * different NIDs for mute/unmute switch and volume control */ |
| 14844 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14845 | hda_nid_t pin, const char *pfx) |
| 14846 | { |
| 14847 | hda_nid_t nid_v, nid_s; |
| 14848 | int err; |
| 14849 | char name[32]; |
| 14850 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14851 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14852 | return 0; |
| 14853 | |
| 14854 | if (alc880_is_fixed_pin(pin)) { |
| 14855 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14856 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14857 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14858 | spec->multiout.hp_nid = nid_v; |
| 14859 | else |
| 14860 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14861 | /* control HP volume/switch on the output mixer amp */ |
| 14862 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14863 | alc880_fixed_pin_idx(pin)); |
| 14864 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14865 | alc880_fixed_pin_idx(pin)); |
| 14866 | |
| 14867 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14868 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14869 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14870 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14871 | return err; |
| 14872 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14873 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14874 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14875 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14876 | return err; |
| 14877 | } else if (alc880_is_multi_pin(pin)) { |
| 14878 | /* set manual connection */ |
| 14879 | /* we have only a switch on HP-out PIN */ |
| 14880 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14881 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14882 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14883 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14884 | return err; |
| 14885 | } |
| 14886 | return 0; |
| 14887 | } |
| 14888 | |
| 14889 | /* parse the BIOS configuration and set up the alc_spec |
| 14890 | * return 1 if successful, 0 if the proper config is not found, |
| 14891 | * or a negative error code |
| 14892 | * Based on ALC880 version - had to change it to override |
| 14893 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 14894 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 14895 | { |
| 14896 | struct alc_spec *spec = codec->spec; |
| 14897 | int err; |
| 14898 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 14899 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14900 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14901 | alc861vd_ignore); |
| 14902 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14903 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14904 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14905 | return 0; /* can't find valid BIOS pin config */ |
| 14906 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14907 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14908 | if (err < 0) |
| 14909 | return err; |
| 14910 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14911 | if (err < 0) |
| 14912 | return err; |
| 14913 | err = alc861vd_auto_create_extra_out(spec, |
| 14914 | spec->autocfg.speaker_pins[0], |
| 14915 | "Speaker"); |
| 14916 | if (err < 0) |
| 14917 | return err; |
| 14918 | err = alc861vd_auto_create_extra_out(spec, |
| 14919 | spec->autocfg.hp_pins[0], |
| 14920 | "Headphone"); |
| 14921 | if (err < 0) |
| 14922 | return err; |
| 14923 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14924 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14925 | return err; |
| 14926 | |
| 14927 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14928 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14929 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14930 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 14931 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14932 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14933 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14934 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14935 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14936 | |
| 14937 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14938 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14939 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 14940 | err = alc_auto_add_mic_boost(codec); |
| 14941 | if (err < 0) |
| 14942 | return err; |
| 14943 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14944 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 14945 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14946 | return 1; |
| 14947 | } |
| 14948 | |
| 14949 | /* additional initialization for auto-configuration model */ |
| 14950 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 14951 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14952 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14953 | alc861vd_auto_init_multi_out(codec); |
| 14954 | alc861vd_auto_init_hp_out(codec); |
| 14955 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14956 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14957 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14958 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14959 | } |
| 14960 | |
| 14961 | static int patch_alc861vd(struct hda_codec *codec) |
| 14962 | { |
| 14963 | struct alc_spec *spec; |
| 14964 | int err, board_config; |
| 14965 | |
| 14966 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14967 | if (spec == NULL) |
| 14968 | return -ENOMEM; |
| 14969 | |
| 14970 | codec->spec = spec; |
| 14971 | |
| 14972 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 14973 | alc861vd_models, |
| 14974 | alc861vd_cfg_tbl); |
| 14975 | |
| 14976 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 14977 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 14978 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 14979 | board_config = ALC861VD_AUTO; |
| 14980 | } |
| 14981 | |
| 14982 | if (board_config == ALC861VD_AUTO) { |
| 14983 | /* automatic parse from the BIOS config */ |
| 14984 | err = alc861vd_parse_auto_config(codec); |
| 14985 | if (err < 0) { |
| 14986 | alc_free(codec); |
| 14987 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14988 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14989 | printk(KERN_INFO |
| 14990 | "hda_codec: Cannot set up configuration " |
| 14991 | "from BIOS. Using base mode...\n"); |
| 14992 | board_config = ALC861VD_3ST; |
| 14993 | } |
| 14994 | } |
| 14995 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14996 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14997 | if (err < 0) { |
| 14998 | alc_free(codec); |
| 14999 | return err; |
| 15000 | } |
| 15001 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15002 | if (board_config != ALC861VD_AUTO) |
| 15003 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15004 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15005 | if (codec->vendor_id == 0x10ec0660) { |
| 15006 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 15007 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15008 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15009 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15010 | } else { |
| 15011 | spec->stream_name_analog = "ALC861VD Analog"; |
| 15012 | spec->stream_name_digital = "ALC861VD Digital"; |
| 15013 | } |
| 15014 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15015 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15016 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15017 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15018 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15019 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15020 | |
| 15021 | spec->adc_nids = alc861vd_adc_nids; |
| 15022 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15023 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15024 | spec->capture_style = CAPT_MIX; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15025 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15026 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15027 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15028 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15029 | spec->vmaster_nid = 0x02; |
| 15030 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15031 | codec->patch_ops = alc_patch_ops; |
| 15032 | |
| 15033 | if (board_config == ALC861VD_AUTO) |
| 15034 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15035 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15036 | if (!spec->loopback.amplist) |
| 15037 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15038 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15039 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15040 | |
| 15041 | return 0; |
| 15042 | } |
| 15043 | |
| 15044 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15045 | * ALC662 support |
| 15046 | * |
| 15047 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15048 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15049 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15050 | * 6-channel independent captures. |
| 15051 | * |
| 15052 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15053 | * driver yet). |
| 15054 | */ |
| 15055 | #define ALC662_DIGOUT_NID 0x06 |
| 15056 | #define ALC662_DIGIN_NID 0x0a |
| 15057 | |
| 15058 | static hda_nid_t alc662_dac_nids[4] = { |
| 15059 | /* front, rear, clfe, rear_surr */ |
| 15060 | 0x02, 0x03, 0x04 |
| 15061 | }; |
| 15062 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15063 | static hda_nid_t alc272_dac_nids[2] = { |
| 15064 | 0x02, 0x03 |
| 15065 | }; |
| 15066 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15067 | static hda_nid_t alc662_adc_nids[1] = { |
| 15068 | /* ADC1-2 */ |
| 15069 | 0x09, |
| 15070 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15071 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15072 | static hda_nid_t alc272_adc_nids[1] = { |
| 15073 | /* ADC1-2 */ |
| 15074 | 0x08, |
| 15075 | }; |
| 15076 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15077 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15078 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15079 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15080 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15081 | /* input MUX */ |
| 15082 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15083 | static struct hda_input_mux alc662_capture_source = { |
| 15084 | .num_items = 4, |
| 15085 | .items = { |
| 15086 | { "Mic", 0x0 }, |
| 15087 | { "Front Mic", 0x1 }, |
| 15088 | { "Line", 0x2 }, |
| 15089 | { "CD", 0x4 }, |
| 15090 | }, |
| 15091 | }; |
| 15092 | |
| 15093 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15094 | .num_items = 2, |
| 15095 | .items = { |
| 15096 | { "Mic", 0x1 }, |
| 15097 | { "Line", 0x2 }, |
| 15098 | }, |
| 15099 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15100 | |
| 15101 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15102 | .num_items = 2, |
| 15103 | .items = { |
| 15104 | { "i-Mic", 0x1 }, |
| 15105 | { "e-Mic", 0x0 }, |
| 15106 | }, |
| 15107 | }; |
| 15108 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15109 | static struct hda_input_mux alc663_capture_source = { |
| 15110 | .num_items = 3, |
| 15111 | .items = { |
| 15112 | { "Mic", 0x0 }, |
| 15113 | { "Front Mic", 0x1 }, |
| 15114 | { "Line", 0x2 }, |
| 15115 | }, |
| 15116 | }; |
| 15117 | |
| 15118 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15119 | .num_items = 2, |
| 15120 | .items = { |
| 15121 | { "Ext-Mic", 0x0 }, |
| 15122 | { "D-Mic", 0x9 }, |
| 15123 | }, |
| 15124 | }; |
| 15125 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15126 | #if 1 /* set to 0 for testing other input sources below */ |
| 15127 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15128 | .num_items = 2, |
| 15129 | .items = { |
| 15130 | { "Autoselect Mic", 0x0 }, |
| 15131 | { "Internal Mic", 0x1 }, |
| 15132 | }, |
| 15133 | }; |
| 15134 | #else |
| 15135 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15136 | .num_items = 16, |
| 15137 | .items = { |
| 15138 | { "Autoselect Mic", 0x0 }, |
| 15139 | { "Internal Mic", 0x1 }, |
| 15140 | { "In-0x02", 0x2 }, |
| 15141 | { "In-0x03", 0x3 }, |
| 15142 | { "In-0x04", 0x4 }, |
| 15143 | { "In-0x05", 0x5 }, |
| 15144 | { "In-0x06", 0x6 }, |
| 15145 | { "In-0x07", 0x7 }, |
| 15146 | { "In-0x08", 0x8 }, |
| 15147 | { "In-0x09", 0x9 }, |
| 15148 | { "In-0x0a", 0x0a }, |
| 15149 | { "In-0x0b", 0x0b }, |
| 15150 | { "In-0x0c", 0x0c }, |
| 15151 | { "In-0x0d", 0x0d }, |
| 15152 | { "In-0x0e", 0x0e }, |
| 15153 | { "In-0x0f", 0x0f }, |
| 15154 | }, |
| 15155 | }; |
| 15156 | #endif |
| 15157 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15158 | /* |
| 15159 | * 2ch mode |
| 15160 | */ |
| 15161 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15162 | { 2, NULL } |
| 15163 | }; |
| 15164 | |
| 15165 | /* |
| 15166 | * 2ch mode |
| 15167 | */ |
| 15168 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15169 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15170 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15171 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15172 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15173 | { } /* end */ |
| 15174 | }; |
| 15175 | |
| 15176 | /* |
| 15177 | * 6ch mode |
| 15178 | */ |
| 15179 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15180 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15181 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15182 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15183 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15184 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15185 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15186 | { } /* end */ |
| 15187 | }; |
| 15188 | |
| 15189 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15190 | { 2, alc662_3ST_ch2_init }, |
| 15191 | { 6, alc662_3ST_ch6_init }, |
| 15192 | }; |
| 15193 | |
| 15194 | /* |
| 15195 | * 2ch mode |
| 15196 | */ |
| 15197 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15198 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15199 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15200 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15201 | { } /* end */ |
| 15202 | }; |
| 15203 | |
| 15204 | /* |
| 15205 | * 6ch mode |
| 15206 | */ |
| 15207 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15208 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15209 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15210 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15211 | { } /* end */ |
| 15212 | }; |
| 15213 | |
| 15214 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15215 | { 2, alc662_sixstack_ch6_init }, |
| 15216 | { 6, alc662_sixstack_ch8_init }, |
| 15217 | }; |
| 15218 | |
| 15219 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15220 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15221 | */ |
| 15222 | |
| 15223 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15224 | /* output mixer control */ |
| 15225 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15226 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15227 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15228 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15229 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15230 | 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] | 15231 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15232 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15233 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15234 | |
| 15235 | /*Input mixer control */ |
| 15236 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15237 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15238 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15239 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15240 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15241 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15242 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15243 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15244 | { } /* end */ |
| 15245 | }; |
| 15246 | |
| 15247 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15248 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15249 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15250 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15251 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15252 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15253 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15254 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15255 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15256 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15257 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15258 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15259 | { } /* end */ |
| 15260 | }; |
| 15261 | |
| 15262 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15263 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15264 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15265 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15266 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15267 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15268 | 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] | 15269 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15270 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15271 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15272 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15273 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15274 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15275 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15276 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15277 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15278 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15279 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15280 | { } /* end */ |
| 15281 | }; |
| 15282 | |
| 15283 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15284 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15285 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15286 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15287 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15288 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15289 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15290 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15291 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15292 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15293 | { } /* end */ |
| 15294 | }; |
| 15295 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15296 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15297 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15298 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15299 | |
| 15300 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15301 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15302 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15303 | |
| 15304 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15305 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15306 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15307 | { } /* end */ |
| 15308 | }; |
| 15309 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15310 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15311 | ALC262_HIPPO_MASTER_SWITCH, |
| 15312 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15313 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15314 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15315 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15316 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15317 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15318 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15319 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15320 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15321 | { } /* end */ |
| 15322 | }; |
| 15323 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15324 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15325 | .ops = &snd_hda_bind_vol, |
| 15326 | .values = { |
| 15327 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15328 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15329 | 0 |
| 15330 | }, |
| 15331 | }; |
| 15332 | |
| 15333 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15334 | .ops = &snd_hda_bind_sw, |
| 15335 | .values = { |
| 15336 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15337 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15338 | 0 |
| 15339 | }, |
| 15340 | }; |
| 15341 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15342 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15343 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15344 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15345 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15346 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15347 | { } /* end */ |
| 15348 | }; |
| 15349 | |
| 15350 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15351 | .ops = &snd_hda_bind_sw, |
| 15352 | .values = { |
| 15353 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15354 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15355 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15356 | 0 |
| 15357 | }, |
| 15358 | }; |
| 15359 | |
| 15360 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15361 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15362 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15363 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15364 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15365 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15366 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15367 | |
| 15368 | { } /* end */ |
| 15369 | }; |
| 15370 | |
| 15371 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15372 | .ops = &snd_hda_bind_sw, |
| 15373 | .values = { |
| 15374 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15375 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15376 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15377 | 0 |
| 15378 | }, |
| 15379 | }; |
| 15380 | |
| 15381 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15382 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15383 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15384 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15385 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15386 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15387 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15388 | { } /* end */ |
| 15389 | }; |
| 15390 | |
| 15391 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15392 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15393 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15394 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15395 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15396 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15397 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15398 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15399 | { } /* end */ |
| 15400 | }; |
| 15401 | |
| 15402 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15403 | .ops = &snd_hda_bind_vol, |
| 15404 | .values = { |
| 15405 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15406 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15407 | 0 |
| 15408 | }, |
| 15409 | }; |
| 15410 | |
| 15411 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15412 | .ops = &snd_hda_bind_sw, |
| 15413 | .values = { |
| 15414 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15415 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15416 | 0 |
| 15417 | }, |
| 15418 | }; |
| 15419 | |
| 15420 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15421 | HDA_BIND_VOL("Master Playback Volume", |
| 15422 | &alc663_asus_two_bind_master_vol), |
| 15423 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15424 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15425 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15426 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15427 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15428 | { } /* end */ |
| 15429 | }; |
| 15430 | |
| 15431 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15432 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15433 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15434 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15435 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15436 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15437 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15438 | { } /* end */ |
| 15439 | }; |
| 15440 | |
| 15441 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15442 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15443 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15444 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15445 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15446 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15447 | |
| 15448 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15449 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15450 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15451 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15452 | { } /* end */ |
| 15453 | }; |
| 15454 | |
| 15455 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15456 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15457 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15458 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15459 | |
| 15460 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15461 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15462 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15463 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15464 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15465 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15466 | { } /* end */ |
| 15467 | }; |
| 15468 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15469 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15470 | { |
| 15471 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15472 | .name = "Channel Mode", |
| 15473 | .info = alc_ch_mode_info, |
| 15474 | .get = alc_ch_mode_get, |
| 15475 | .put = alc_ch_mode_put, |
| 15476 | }, |
| 15477 | { } /* end */ |
| 15478 | }; |
| 15479 | |
| 15480 | static struct hda_verb alc662_init_verbs[] = { |
| 15481 | /* ADC: mute amp left and right */ |
| 15482 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15483 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15484 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15485 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15486 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15487 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15488 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15489 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15490 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15491 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15492 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15493 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15494 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15495 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15496 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15497 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15498 | |
| 15499 | /* Front Pin: output 0 (0x0c) */ |
| 15500 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15501 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15502 | |
| 15503 | /* Rear Pin: output 1 (0x0d) */ |
| 15504 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15505 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15506 | |
| 15507 | /* CLFE Pin: output 2 (0x0e) */ |
| 15508 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15509 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15510 | |
| 15511 | /* Mic (rear) pin: input vref at 80% */ |
| 15512 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15513 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15514 | /* Front Mic pin: input vref at 80% */ |
| 15515 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15516 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15517 | /* Line In pin: input */ |
| 15518 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15519 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15520 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15521 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15522 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15523 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15524 | /* CD pin widget for input */ |
| 15525 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15526 | |
| 15527 | /* FIXME: use matrix-type input source selection */ |
| 15528 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15529 | /* Input mixer */ |
| 15530 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15531 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15532 | |
| 15533 | /* always trun on EAPD */ |
| 15534 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15535 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15536 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15537 | { } |
| 15538 | }; |
| 15539 | |
| 15540 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15541 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15542 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15543 | {} |
| 15544 | }; |
| 15545 | |
| 15546 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15547 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15548 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15549 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15550 | }; |
| 15551 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15552 | /* Set Unsolicited Event*/ |
| 15553 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15554 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15555 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15556 | {} |
| 15557 | }; |
| 15558 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15559 | /* |
| 15560 | * generic initialization of ADC, input mixers and output mixers |
| 15561 | */ |
| 15562 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15563 | /* |
| 15564 | * Unmute ADC and set the default input to mic-in |
| 15565 | */ |
| 15566 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15567 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15568 | |
| 15569 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15570 | * mixer widget |
| 15571 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15572 | * panel mic (mic 2) |
| 15573 | */ |
| 15574 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15575 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15576 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15577 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15578 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15579 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15580 | |
| 15581 | /* |
| 15582 | * Set up output mixers (0x0c - 0x0f) |
| 15583 | */ |
| 15584 | /* set vol=0 to output mixers */ |
| 15585 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15586 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15587 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15588 | |
| 15589 | /* set up input amps for analog loopback */ |
| 15590 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15593 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15594 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15595 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15596 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15597 | |
| 15598 | |
| 15599 | /* FIXME: use matrix-type input source selection */ |
| 15600 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15601 | /* Input mixer */ |
| 15602 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15603 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15604 | { } |
| 15605 | }; |
| 15606 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15607 | /* additional verbs for ALC663 */ |
| 15608 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15609 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15610 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15611 | { } |
| 15612 | }; |
| 15613 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15614 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15615 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15616 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15617 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15618 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15619 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15620 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15621 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15622 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15623 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15624 | {} |
| 15625 | }; |
| 15626 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15627 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15628 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15629 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15630 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15631 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15632 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15633 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15634 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15635 | {} |
| 15636 | }; |
| 15637 | |
| 15638 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15639 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15640 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15641 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15642 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15643 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15644 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15645 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15646 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15647 | {} |
| 15648 | }; |
| 15649 | |
| 15650 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15651 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15652 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15653 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15654 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15655 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15656 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15657 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15658 | {} |
| 15659 | }; |
| 15660 | |
| 15661 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15662 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15663 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15664 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15665 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15666 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15667 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15668 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15669 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15670 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15671 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15672 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15673 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15674 | {} |
| 15675 | }; |
| 15676 | |
| 15677 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15678 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15679 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15680 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15681 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15682 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15683 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15684 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15685 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15686 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15687 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15688 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15689 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15690 | {} |
| 15691 | }; |
| 15692 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15693 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15694 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15695 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15696 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15697 | |
| 15698 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15699 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15700 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15701 | |
| 15702 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15703 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15704 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15705 | {} |
| 15706 | }; |
| 15707 | |
| 15708 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15709 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15710 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15711 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15712 | |
| 15713 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15714 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15715 | {} |
| 15716 | }; |
| 15717 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15718 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15719 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15720 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15721 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15722 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15723 | {} |
| 15724 | }; |
| 15725 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15726 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 15727 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15728 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15729 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15730 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15731 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15732 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15733 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15734 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15735 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 15736 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15737 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15738 | {} |
| 15739 | }; |
| 15740 | |
| 15741 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 15742 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15743 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15744 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15745 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15746 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15747 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15748 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15749 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15750 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 15751 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15752 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15753 | {} |
| 15754 | }; |
| 15755 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15756 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15757 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15758 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15759 | { } /* end */ |
| 15760 | }; |
| 15761 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15762 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 15763 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 15764 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 15765 | { } /* end */ |
| 15766 | }; |
| 15767 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15768 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15769 | { |
| 15770 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15771 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15772 | |
| 15773 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15774 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15775 | bits = present ? HDA_AMP_MUTE : 0; |
| 15776 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15777 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15778 | } |
| 15779 | |
| 15780 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15781 | { |
| 15782 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15783 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15784 | |
| 15785 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15786 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15787 | bits = present ? HDA_AMP_MUTE : 0; |
| 15788 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15789 | HDA_AMP_MUTE, bits); |
| 15790 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15791 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15792 | } |
| 15793 | |
| 15794 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15795 | unsigned int res) |
| 15796 | { |
| 15797 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15798 | alc662_lenovo_101e_all_automute(codec); |
| 15799 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15800 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15801 | } |
| 15802 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15803 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15804 | { |
| 15805 | unsigned int present; |
| 15806 | |
| 15807 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15808 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15809 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15810 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15811 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15812 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15813 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15814 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15815 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15816 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15817 | } |
| 15818 | |
| 15819 | /* unsolicited event for HP jack sensing */ |
| 15820 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15821 | unsigned int res) |
| 15822 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15823 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15824 | alc662_eeepc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15825 | else |
| 15826 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15827 | } |
| 15828 | |
| 15829 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15830 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15831 | alc262_hippo1_init_hook(codec); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15832 | alc662_eeepc_mic_automute(codec); |
| 15833 | } |
| 15834 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15835 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15836 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15837 | struct alc_spec *spec = codec->spec; |
| 15838 | |
| 15839 | spec->autocfg.hp_pins[0] = 0x14; |
| 15840 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 15841 | alc262_hippo_master_update(codec); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15842 | } |
| 15843 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15844 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15845 | { |
| 15846 | unsigned int present; |
| 15847 | unsigned char bits; |
| 15848 | |
| 15849 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15850 | AC_VERB_GET_PIN_SENSE, 0) |
| 15851 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15852 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15853 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15854 | AMP_IN_MUTE(0), bits); |
| 15855 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15856 | AMP_IN_MUTE(0), bits); |
| 15857 | } |
| 15858 | |
| 15859 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15860 | { |
| 15861 | unsigned int present; |
| 15862 | unsigned char bits; |
| 15863 | |
| 15864 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15865 | AC_VERB_GET_PIN_SENSE, 0) |
| 15866 | & AC_PINSENSE_PRESENCE; |
| 15867 | bits = present ? HDA_AMP_MUTE : 0; |
| 15868 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15869 | AMP_IN_MUTE(0), bits); |
| 15870 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15871 | AMP_IN_MUTE(0), bits); |
| 15872 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15873 | AMP_IN_MUTE(0), bits); |
| 15874 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15875 | AMP_IN_MUTE(0), bits); |
| 15876 | } |
| 15877 | |
| 15878 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15879 | { |
| 15880 | unsigned int present; |
| 15881 | unsigned char bits; |
| 15882 | |
| 15883 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15884 | AC_VERB_GET_PIN_SENSE, 0) |
| 15885 | & AC_PINSENSE_PRESENCE; |
| 15886 | bits = present ? HDA_AMP_MUTE : 0; |
| 15887 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15888 | AMP_IN_MUTE(0), bits); |
| 15889 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15890 | AMP_IN_MUTE(0), bits); |
| 15891 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15892 | AMP_IN_MUTE(0), bits); |
| 15893 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15894 | AMP_IN_MUTE(0), bits); |
| 15895 | } |
| 15896 | |
| 15897 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 15898 | { |
| 15899 | unsigned int present; |
| 15900 | unsigned char bits; |
| 15901 | |
| 15902 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15903 | AC_VERB_GET_PIN_SENSE, 0) |
| 15904 | & AC_PINSENSE_PRESENCE; |
| 15905 | bits = present ? 0 : PIN_OUT; |
| 15906 | snd_hda_codec_write(codec, 0x14, 0, |
| 15907 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 15908 | } |
| 15909 | |
| 15910 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 15911 | { |
| 15912 | unsigned int present1, present2; |
| 15913 | |
| 15914 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 15915 | AC_VERB_GET_PIN_SENSE, 0) |
| 15916 | & AC_PINSENSE_PRESENCE; |
| 15917 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15918 | AC_VERB_GET_PIN_SENSE, 0) |
| 15919 | & AC_PINSENSE_PRESENCE; |
| 15920 | |
| 15921 | if (present1 || present2) { |
| 15922 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15923 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 15924 | } else { |
| 15925 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15926 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 15927 | } |
| 15928 | } |
| 15929 | |
| 15930 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 15931 | { |
| 15932 | unsigned int present1, present2; |
| 15933 | |
| 15934 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 15935 | AC_VERB_GET_PIN_SENSE, 0) |
| 15936 | & AC_PINSENSE_PRESENCE; |
| 15937 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15938 | AC_VERB_GET_PIN_SENSE, 0) |
| 15939 | & AC_PINSENSE_PRESENCE; |
| 15940 | |
| 15941 | if (present1 || present2) { |
| 15942 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15943 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15944 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15945 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15946 | } else { |
| 15947 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15948 | AMP_IN_MUTE(0), 0); |
| 15949 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15950 | AMP_IN_MUTE(0), 0); |
| 15951 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15952 | } |
| 15953 | |
| 15954 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 15955 | { |
| 15956 | unsigned int present; |
| 15957 | |
| 15958 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15959 | AC_VERB_GET_PIN_SENSE, 0) |
| 15960 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15961 | 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] | 15962 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15963 | 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] | 15964 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15965 | 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] | 15966 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15967 | 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] | 15968 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15969 | } |
| 15970 | |
| 15971 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 15972 | unsigned int res) |
| 15973 | { |
| 15974 | switch (res >> 26) { |
| 15975 | case ALC880_HP_EVENT: |
| 15976 | alc663_m51va_speaker_automute(codec); |
| 15977 | break; |
| 15978 | case ALC880_MIC_EVENT: |
| 15979 | alc663_m51va_mic_automute(codec); |
| 15980 | break; |
| 15981 | } |
| 15982 | } |
| 15983 | |
| 15984 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 15985 | { |
| 15986 | alc663_m51va_speaker_automute(codec); |
| 15987 | alc663_m51va_mic_automute(codec); |
| 15988 | } |
| 15989 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15990 | /* ***************** Mode1 ******************************/ |
| 15991 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 15992 | unsigned int res) |
| 15993 | { |
| 15994 | switch (res >> 26) { |
| 15995 | case ALC880_HP_EVENT: |
| 15996 | alc663_m51va_speaker_automute(codec); |
| 15997 | break; |
| 15998 | case ALC880_MIC_EVENT: |
| 15999 | alc662_eeepc_mic_automute(codec); |
| 16000 | break; |
| 16001 | } |
| 16002 | } |
| 16003 | |
| 16004 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16005 | { |
| 16006 | alc663_m51va_speaker_automute(codec); |
| 16007 | alc662_eeepc_mic_automute(codec); |
| 16008 | } |
| 16009 | /* ***************** Mode2 ******************************/ |
| 16010 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16011 | unsigned int res) |
| 16012 | { |
| 16013 | switch (res >> 26) { |
| 16014 | case ALC880_HP_EVENT: |
| 16015 | alc662_f5z_speaker_automute(codec); |
| 16016 | break; |
| 16017 | case ALC880_MIC_EVENT: |
| 16018 | alc662_eeepc_mic_automute(codec); |
| 16019 | break; |
| 16020 | } |
| 16021 | } |
| 16022 | |
| 16023 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16024 | { |
| 16025 | alc662_f5z_speaker_automute(codec); |
| 16026 | alc662_eeepc_mic_automute(codec); |
| 16027 | } |
| 16028 | /* ***************** Mode3 ******************************/ |
| 16029 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16030 | unsigned int res) |
| 16031 | { |
| 16032 | switch (res >> 26) { |
| 16033 | case ALC880_HP_EVENT: |
| 16034 | alc663_two_hp_m1_speaker_automute(codec); |
| 16035 | break; |
| 16036 | case ALC880_MIC_EVENT: |
| 16037 | alc662_eeepc_mic_automute(codec); |
| 16038 | break; |
| 16039 | } |
| 16040 | } |
| 16041 | |
| 16042 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16043 | { |
| 16044 | alc663_two_hp_m1_speaker_automute(codec); |
| 16045 | alc662_eeepc_mic_automute(codec); |
| 16046 | } |
| 16047 | /* ***************** Mode4 ******************************/ |
| 16048 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16049 | unsigned int res) |
| 16050 | { |
| 16051 | switch (res >> 26) { |
| 16052 | case ALC880_HP_EVENT: |
| 16053 | alc663_21jd_two_speaker_automute(codec); |
| 16054 | break; |
| 16055 | case ALC880_MIC_EVENT: |
| 16056 | alc662_eeepc_mic_automute(codec); |
| 16057 | break; |
| 16058 | } |
| 16059 | } |
| 16060 | |
| 16061 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16062 | { |
| 16063 | alc663_21jd_two_speaker_automute(codec); |
| 16064 | alc662_eeepc_mic_automute(codec); |
| 16065 | } |
| 16066 | /* ***************** Mode5 ******************************/ |
| 16067 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16068 | unsigned int res) |
| 16069 | { |
| 16070 | switch (res >> 26) { |
| 16071 | case ALC880_HP_EVENT: |
| 16072 | alc663_15jd_two_speaker_automute(codec); |
| 16073 | break; |
| 16074 | case ALC880_MIC_EVENT: |
| 16075 | alc662_eeepc_mic_automute(codec); |
| 16076 | break; |
| 16077 | } |
| 16078 | } |
| 16079 | |
| 16080 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16081 | { |
| 16082 | alc663_15jd_two_speaker_automute(codec); |
| 16083 | alc662_eeepc_mic_automute(codec); |
| 16084 | } |
| 16085 | /* ***************** Mode6 ******************************/ |
| 16086 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16087 | unsigned int res) |
| 16088 | { |
| 16089 | switch (res >> 26) { |
| 16090 | case ALC880_HP_EVENT: |
| 16091 | alc663_two_hp_m2_speaker_automute(codec); |
| 16092 | break; |
| 16093 | case ALC880_MIC_EVENT: |
| 16094 | alc662_eeepc_mic_automute(codec); |
| 16095 | break; |
| 16096 | } |
| 16097 | } |
| 16098 | |
| 16099 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16100 | { |
| 16101 | alc663_two_hp_m2_speaker_automute(codec); |
| 16102 | alc662_eeepc_mic_automute(codec); |
| 16103 | } |
| 16104 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16105 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16106 | { |
| 16107 | unsigned int present; |
| 16108 | unsigned char bits; |
| 16109 | |
| 16110 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16111 | AC_VERB_GET_PIN_SENSE, 0) |
| 16112 | & AC_PINSENSE_PRESENCE; |
| 16113 | bits = present ? HDA_AMP_MUTE : 0; |
| 16114 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16115 | HDA_AMP_MUTE, bits); |
| 16116 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16117 | HDA_AMP_MUTE, bits); |
| 16118 | } |
| 16119 | |
| 16120 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16121 | { |
| 16122 | unsigned int present; |
| 16123 | unsigned char bits; |
| 16124 | |
| 16125 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16126 | AC_VERB_GET_PIN_SENSE, 0) |
| 16127 | & AC_PINSENSE_PRESENCE; |
| 16128 | bits = present ? HDA_AMP_MUTE : 0; |
| 16129 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16130 | HDA_AMP_MUTE, bits); |
| 16131 | } |
| 16132 | |
| 16133 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16134 | unsigned int res) |
| 16135 | { |
| 16136 | switch (res >> 26) { |
| 16137 | case ALC880_HP_EVENT: |
| 16138 | alc663_g71v_hp_automute(codec); |
| 16139 | break; |
| 16140 | case ALC880_FRONT_EVENT: |
| 16141 | alc663_g71v_front_automute(codec); |
| 16142 | break; |
| 16143 | case ALC880_MIC_EVENT: |
| 16144 | alc662_eeepc_mic_automute(codec); |
| 16145 | break; |
| 16146 | } |
| 16147 | } |
| 16148 | |
| 16149 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16150 | { |
| 16151 | alc663_g71v_front_automute(codec); |
| 16152 | alc663_g71v_hp_automute(codec); |
| 16153 | alc662_eeepc_mic_automute(codec); |
| 16154 | } |
| 16155 | |
| 16156 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16157 | unsigned int res) |
| 16158 | { |
| 16159 | switch (res >> 26) { |
| 16160 | case ALC880_HP_EVENT: |
| 16161 | alc663_m51va_speaker_automute(codec); |
| 16162 | break; |
| 16163 | case ALC880_MIC_EVENT: |
| 16164 | alc662_eeepc_mic_automute(codec); |
| 16165 | break; |
| 16166 | } |
| 16167 | } |
| 16168 | |
| 16169 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16170 | { |
| 16171 | alc663_m51va_speaker_automute(codec); |
| 16172 | alc662_eeepc_mic_automute(codec); |
| 16173 | } |
| 16174 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16175 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16176 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16177 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16178 | |
| 16179 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16180 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16181 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16182 | |
| 16183 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16184 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16185 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16186 | { } /* end */ |
| 16187 | }; |
| 16188 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16189 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16190 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16191 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16192 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16193 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16194 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16195 | |
| 16196 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16197 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16198 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16199 | |
| 16200 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16201 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16202 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16203 | { } /* end */ |
| 16204 | }; |
| 16205 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16206 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16207 | #define alc662_loopbacks alc880_loopbacks |
| 16208 | #endif |
| 16209 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16210 | |
| 16211 | /* pcm configuration: identiacal with ALC880 */ |
| 16212 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16213 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16214 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16215 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16216 | |
| 16217 | /* |
| 16218 | * configuration and preset |
| 16219 | */ |
| 16220 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16221 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16222 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16223 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16224 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16225 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16226 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16227 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16228 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16229 | [ALC663_ASUS_M51VA] = "m51va", |
| 16230 | [ALC663_ASUS_G71V] = "g71v", |
| 16231 | [ALC663_ASUS_H13] = "h13", |
| 16232 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16233 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16234 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16235 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16236 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16237 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16238 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16239 | [ALC272_DELL] = "dell", |
| 16240 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16241 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16242 | [ALC662_AUTO] = "auto", |
| 16243 | }; |
| 16244 | |
| 16245 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16246 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16247 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16248 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16249 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16250 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16251 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16252 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16253 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16254 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16255 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16256 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16257 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16258 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16259 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16260 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16261 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16262 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16263 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16264 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16265 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16266 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16267 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16268 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16269 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16270 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16271 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16272 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16273 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16274 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16275 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16276 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16277 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16278 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16279 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16280 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16281 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16282 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16283 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16284 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16285 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16286 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16287 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16288 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16289 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16290 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16291 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16292 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16293 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16294 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16295 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16296 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16297 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16298 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16299 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16300 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16301 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16302 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16303 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16304 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16305 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16306 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16307 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16308 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16309 | {} |
| 16310 | }; |
| 16311 | |
| 16312 | static struct alc_config_preset alc662_presets[] = { |
| 16313 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16314 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16315 | .init_verbs = { alc662_init_verbs }, |
| 16316 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16317 | .dac_nids = alc662_dac_nids, |
| 16318 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16319 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16320 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16321 | .channel_mode = alc662_3ST_2ch_modes, |
| 16322 | .input_mux = &alc662_capture_source, |
| 16323 | }, |
| 16324 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16325 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16326 | .init_verbs = { alc662_init_verbs }, |
| 16327 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16328 | .dac_nids = alc662_dac_nids, |
| 16329 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16330 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16331 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16332 | .channel_mode = alc662_3ST_6ch_modes, |
| 16333 | .need_dac_fix = 1, |
| 16334 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16335 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16336 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16337 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16338 | .init_verbs = { alc662_init_verbs }, |
| 16339 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16340 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16341 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16342 | .channel_mode = alc662_3ST_6ch_modes, |
| 16343 | .need_dac_fix = 1, |
| 16344 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16345 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16346 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16347 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16348 | .init_verbs = { alc662_init_verbs }, |
| 16349 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16350 | .dac_nids = alc662_dac_nids, |
| 16351 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16352 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16353 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16354 | .channel_mode = alc662_5stack_modes, |
| 16355 | .input_mux = &alc662_capture_source, |
| 16356 | }, |
| 16357 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16358 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16359 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16360 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16361 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16362 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16363 | .channel_mode = alc662_3ST_2ch_modes, |
| 16364 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16365 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16366 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16367 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16368 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16369 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16370 | .init_verbs = { alc662_init_verbs, |
| 16371 | alc662_eeepc_sue_init_verbs }, |
| 16372 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16373 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16374 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16375 | .channel_mode = alc662_3ST_2ch_modes, |
| 16376 | .input_mux = &alc662_eeepc_capture_source, |
| 16377 | .unsol_event = alc662_eeepc_unsol_event, |
| 16378 | .init_hook = alc662_eeepc_inithook, |
| 16379 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16380 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16381 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16382 | alc662_chmode_mixer }, |
| 16383 | .init_verbs = { alc662_init_verbs, |
| 16384 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16385 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16386 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16387 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16388 | .channel_mode = alc662_3ST_6ch_modes, |
| 16389 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16390 | .unsol_event = alc662_eeepc_unsol_event, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16391 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16392 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16393 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16394 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16395 | .init_verbs = { alc662_init_verbs, |
| 16396 | alc662_ecs_init_verbs }, |
| 16397 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16398 | .dac_nids = alc662_dac_nids, |
| 16399 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16400 | .channel_mode = alc662_3ST_2ch_modes, |
| 16401 | .input_mux = &alc662_eeepc_capture_source, |
| 16402 | .unsol_event = alc662_eeepc_unsol_event, |
| 16403 | .init_hook = alc662_eeepc_inithook, |
| 16404 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16405 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16406 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16407 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16408 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16409 | .dac_nids = alc662_dac_nids, |
| 16410 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16411 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16412 | .channel_mode = alc662_3ST_2ch_modes, |
| 16413 | .input_mux = &alc663_m51va_capture_source, |
| 16414 | .unsol_event = alc663_m51va_unsol_event, |
| 16415 | .init_hook = alc663_m51va_inithook, |
| 16416 | }, |
| 16417 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16418 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16419 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16420 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16421 | .dac_nids = alc662_dac_nids, |
| 16422 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16423 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16424 | .channel_mode = alc662_3ST_2ch_modes, |
| 16425 | .input_mux = &alc662_eeepc_capture_source, |
| 16426 | .unsol_event = alc663_g71v_unsol_event, |
| 16427 | .init_hook = alc663_g71v_inithook, |
| 16428 | }, |
| 16429 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16430 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16431 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16432 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16433 | .dac_nids = alc662_dac_nids, |
| 16434 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16435 | .channel_mode = alc662_3ST_2ch_modes, |
| 16436 | .input_mux = &alc663_m51va_capture_source, |
| 16437 | .unsol_event = alc663_m51va_unsol_event, |
| 16438 | .init_hook = alc663_m51va_inithook, |
| 16439 | }, |
| 16440 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16441 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16442 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16443 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16444 | .dac_nids = alc662_dac_nids, |
| 16445 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16446 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16447 | .channel_mode = alc662_3ST_6ch_modes, |
| 16448 | .input_mux = &alc663_capture_source, |
| 16449 | .unsol_event = alc663_g50v_unsol_event, |
| 16450 | .init_hook = alc663_g50v_inithook, |
| 16451 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16452 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16453 | .mixers = { alc663_m51va_mixer }, |
| 16454 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16455 | .init_verbs = { alc662_init_verbs, |
| 16456 | alc663_21jd_amic_init_verbs }, |
| 16457 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16458 | .hp_nid = 0x03, |
| 16459 | .dac_nids = alc662_dac_nids, |
| 16460 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16461 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16462 | .channel_mode = alc662_3ST_2ch_modes, |
| 16463 | .input_mux = &alc662_eeepc_capture_source, |
| 16464 | .unsol_event = alc663_mode1_unsol_event, |
| 16465 | .init_hook = alc663_mode1_inithook, |
| 16466 | }, |
| 16467 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16468 | .mixers = { alc662_1bjd_mixer }, |
| 16469 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16470 | .init_verbs = { alc662_init_verbs, |
| 16471 | alc662_1bjd_amic_init_verbs }, |
| 16472 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16473 | .dac_nids = alc662_dac_nids, |
| 16474 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16475 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16476 | .channel_mode = alc662_3ST_2ch_modes, |
| 16477 | .input_mux = &alc662_eeepc_capture_source, |
| 16478 | .unsol_event = alc662_mode2_unsol_event, |
| 16479 | .init_hook = alc662_mode2_inithook, |
| 16480 | }, |
| 16481 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16482 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16483 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16484 | .init_verbs = { alc662_init_verbs, |
| 16485 | alc663_two_hp_amic_m1_init_verbs }, |
| 16486 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16487 | .hp_nid = 0x03, |
| 16488 | .dac_nids = alc662_dac_nids, |
| 16489 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16490 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16491 | .channel_mode = alc662_3ST_2ch_modes, |
| 16492 | .input_mux = &alc662_eeepc_capture_source, |
| 16493 | .unsol_event = alc663_mode3_unsol_event, |
| 16494 | .init_hook = alc663_mode3_inithook, |
| 16495 | }, |
| 16496 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16497 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16498 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16499 | .init_verbs = { alc662_init_verbs, |
| 16500 | alc663_21jd_amic_init_verbs}, |
| 16501 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16502 | .hp_nid = 0x03, |
| 16503 | .dac_nids = alc662_dac_nids, |
| 16504 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16505 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16506 | .channel_mode = alc662_3ST_2ch_modes, |
| 16507 | .input_mux = &alc662_eeepc_capture_source, |
| 16508 | .unsol_event = alc663_mode4_unsol_event, |
| 16509 | .init_hook = alc663_mode4_inithook, |
| 16510 | }, |
| 16511 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16512 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16513 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16514 | .init_verbs = { alc662_init_verbs, |
| 16515 | alc663_15jd_amic_init_verbs }, |
| 16516 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16517 | .hp_nid = 0x03, |
| 16518 | .dac_nids = alc662_dac_nids, |
| 16519 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16520 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16521 | .channel_mode = alc662_3ST_2ch_modes, |
| 16522 | .input_mux = &alc662_eeepc_capture_source, |
| 16523 | .unsol_event = alc663_mode5_unsol_event, |
| 16524 | .init_hook = alc663_mode5_inithook, |
| 16525 | }, |
| 16526 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16527 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16528 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16529 | .init_verbs = { alc662_init_verbs, |
| 16530 | alc663_two_hp_amic_m2_init_verbs }, |
| 16531 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16532 | .hp_nid = 0x03, |
| 16533 | .dac_nids = alc662_dac_nids, |
| 16534 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16535 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16536 | .channel_mode = alc662_3ST_2ch_modes, |
| 16537 | .input_mux = &alc662_eeepc_capture_source, |
| 16538 | .unsol_event = alc663_mode6_unsol_event, |
| 16539 | .init_hook = alc663_mode6_inithook, |
| 16540 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16541 | [ALC272_DELL] = { |
| 16542 | .mixers = { alc663_m51va_mixer }, |
| 16543 | .cap_mixer = alc272_auto_capture_mixer, |
| 16544 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 16545 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16546 | .dac_nids = alc662_dac_nids, |
| 16547 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16548 | .adc_nids = alc272_adc_nids, |
| 16549 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 16550 | .capsrc_nids = alc272_capsrc_nids, |
| 16551 | .channel_mode = alc662_3ST_2ch_modes, |
| 16552 | .input_mux = &alc663_m51va_capture_source, |
| 16553 | .unsol_event = alc663_m51va_unsol_event, |
| 16554 | .init_hook = alc663_m51va_inithook, |
| 16555 | }, |
| 16556 | [ALC272_DELL_ZM1] = { |
| 16557 | .mixers = { alc663_m51va_mixer }, |
| 16558 | .cap_mixer = alc662_auto_capture_mixer, |
| 16559 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 16560 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16561 | .dac_nids = alc662_dac_nids, |
| 16562 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16563 | .adc_nids = alc662_adc_nids, |
| 16564 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 16565 | .capsrc_nids = alc662_capsrc_nids, |
| 16566 | .channel_mode = alc662_3ST_2ch_modes, |
| 16567 | .input_mux = &alc663_m51va_capture_source, |
| 16568 | .unsol_event = alc663_m51va_unsol_event, |
| 16569 | .init_hook = alc663_m51va_inithook, |
| 16570 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16571 | [ALC272_SAMSUNG_NC10] = { |
| 16572 | .mixers = { alc272_nc10_mixer }, |
| 16573 | .init_verbs = { alc662_init_verbs, |
| 16574 | alc663_21jd_amic_init_verbs }, |
| 16575 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16576 | .dac_nids = alc272_dac_nids, |
| 16577 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16578 | .channel_mode = alc662_3ST_2ch_modes, |
| 16579 | .input_mux = &alc272_nc10_capture_source, |
| 16580 | .unsol_event = alc663_mode4_unsol_event, |
| 16581 | .init_hook = alc663_mode4_inithook, |
| 16582 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16583 | }; |
| 16584 | |
| 16585 | |
| 16586 | /* |
| 16587 | * BIOS auto configuration |
| 16588 | */ |
| 16589 | |
| 16590 | /* add playback controls from the parsed DAC table */ |
| 16591 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16592 | const struct auto_pin_cfg *cfg) |
| 16593 | { |
| 16594 | char name[32]; |
| 16595 | static const char *chname[4] = { |
| 16596 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16597 | }; |
| 16598 | hda_nid_t nid; |
| 16599 | int i, err; |
| 16600 | |
| 16601 | for (i = 0; i < cfg->line_outs; i++) { |
| 16602 | if (!spec->multiout.dac_nids[i]) |
| 16603 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16604 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16605 | if (i == 2) { |
| 16606 | /* Center/LFE */ |
| 16607 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16608 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16609 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 16610 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16611 | if (err < 0) |
| 16612 | return err; |
| 16613 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16614 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16615 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 16616 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16617 | if (err < 0) |
| 16618 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16619 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16620 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16621 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16622 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16623 | if (err < 0) |
| 16624 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16625 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16626 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16627 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16628 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16629 | if (err < 0) |
| 16630 | return err; |
| 16631 | } else { |
| 16632 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16633 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16634 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16635 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16636 | if (err < 0) |
| 16637 | return err; |
| 16638 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16639 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16640 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16641 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16642 | if (err < 0) |
| 16643 | return err; |
| 16644 | } |
| 16645 | } |
| 16646 | return 0; |
| 16647 | } |
| 16648 | |
| 16649 | /* add playback controls for speaker and HP outputs */ |
| 16650 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16651 | const char *pfx) |
| 16652 | { |
| 16653 | hda_nid_t nid; |
| 16654 | int err; |
| 16655 | char name[32]; |
| 16656 | |
| 16657 | if (!pin) |
| 16658 | return 0; |
| 16659 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16660 | if (pin == 0x17) { |
| 16661 | /* ALC663 has a mono output pin on 0x17 */ |
| 16662 | sprintf(name, "%s Playback Switch", pfx); |
| 16663 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16664 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16665 | return err; |
| 16666 | } |
| 16667 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16668 | if (alc880_is_fixed_pin(pin)) { |
| 16669 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 16670 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16671 | /* specify the DAC as the extra output */ |
| 16672 | if (!spec->multiout.hp_nid) |
| 16673 | spec->multiout.hp_nid = nid; |
| 16674 | else |
| 16675 | spec->multiout.extra_out_nid[0] = nid; |
| 16676 | /* control HP volume/switch on the output mixer amp */ |
| 16677 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16678 | sprintf(name, "%s Playback Volume", pfx); |
| 16679 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16680 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16681 | if (err < 0) |
| 16682 | return err; |
| 16683 | sprintf(name, "%s Playback Switch", pfx); |
| 16684 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16685 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16686 | if (err < 0) |
| 16687 | return err; |
| 16688 | } else if (alc880_is_multi_pin(pin)) { |
| 16689 | /* set manual connection */ |
| 16690 | /* we have only a switch on HP-out PIN */ |
| 16691 | sprintf(name, "%s Playback Switch", pfx); |
| 16692 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16693 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16694 | if (err < 0) |
| 16695 | return err; |
| 16696 | } |
| 16697 | return 0; |
| 16698 | } |
| 16699 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16700 | /* return the index of the src widget from the connection list of the nid. |
| 16701 | * return -1 if not found |
| 16702 | */ |
| 16703 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 16704 | hda_nid_t src) |
| 16705 | { |
| 16706 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 16707 | int i, conns; |
| 16708 | |
| 16709 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 16710 | ARRAY_SIZE(conn_list)); |
| 16711 | if (conns < 0) |
| 16712 | return -1; |
| 16713 | for (i = 0; i < conns; i++) |
| 16714 | if (conn_list[i] == src) |
| 16715 | return i; |
| 16716 | return -1; |
| 16717 | } |
| 16718 | |
| 16719 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 16720 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 16721 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16722 | return (pincap & AC_PINCAP_IN) != 0; |
| 16723 | } |
| 16724 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16725 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16726 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16727 | const struct auto_pin_cfg *cfg) |
| 16728 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16729 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16730 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16731 | int i, err, idx; |
| 16732 | |
| 16733 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16734 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 16735 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 16736 | cfg->input_pins[i]); |
| 16737 | if (idx >= 0) { |
| 16738 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16739 | auto_pin_cfg_labels[i], |
| 16740 | idx, 0x0b); |
| 16741 | if (err < 0) |
| 16742 | return err; |
| 16743 | } |
| 16744 | idx = alc662_input_pin_idx(codec, 0x22, |
| 16745 | cfg->input_pins[i]); |
| 16746 | if (idx >= 0) { |
| 16747 | imux->items[imux->num_items].label = |
| 16748 | auto_pin_cfg_labels[i]; |
| 16749 | imux->items[imux->num_items].index = idx; |
| 16750 | imux->num_items++; |
| 16751 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16752 | } |
| 16753 | } |
| 16754 | return 0; |
| 16755 | } |
| 16756 | |
| 16757 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16758 | hda_nid_t nid, int pin_type, |
| 16759 | int dac_idx) |
| 16760 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16761 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16762 | /* need the manual connection? */ |
| 16763 | if (alc880_is_multi_pin(nid)) { |
| 16764 | struct alc_spec *spec = codec->spec; |
| 16765 | int idx = alc880_multi_pin_idx(nid); |
| 16766 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16767 | AC_VERB_SET_CONNECT_SEL, |
| 16768 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16769 | } |
| 16770 | } |
| 16771 | |
| 16772 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16773 | { |
| 16774 | struct alc_spec *spec = codec->spec; |
| 16775 | int i; |
| 16776 | |
| 16777 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16778 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16779 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16780 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16781 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16782 | i); |
| 16783 | } |
| 16784 | } |
| 16785 | |
| 16786 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16787 | { |
| 16788 | struct alc_spec *spec = codec->spec; |
| 16789 | hda_nid_t pin; |
| 16790 | |
| 16791 | pin = spec->autocfg.hp_pins[0]; |
| 16792 | if (pin) /* connect to front */ |
| 16793 | /* use dac 0 */ |
| 16794 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16795 | pin = spec->autocfg.speaker_pins[0]; |
| 16796 | if (pin) |
| 16797 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16798 | } |
| 16799 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16800 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16801 | |
| 16802 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16803 | { |
| 16804 | struct alc_spec *spec = codec->spec; |
| 16805 | int i; |
| 16806 | |
| 16807 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16808 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16809 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16810 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 16811 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16812 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16813 | snd_hda_codec_write(codec, nid, 0, |
| 16814 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16815 | AMP_OUT_MUTE); |
| 16816 | } |
| 16817 | } |
| 16818 | } |
| 16819 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16820 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 16821 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16822 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 16823 | { |
| 16824 | struct alc_spec *spec = codec->spec; |
| 16825 | int err; |
| 16826 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 16827 | |
| 16828 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16829 | alc662_ignore); |
| 16830 | if (err < 0) |
| 16831 | return err; |
| 16832 | if (!spec->autocfg.line_outs) |
| 16833 | return 0; /* can't find valid BIOS pin config */ |
| 16834 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16835 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16836 | if (err < 0) |
| 16837 | return err; |
| 16838 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16839 | if (err < 0) |
| 16840 | return err; |
| 16841 | err = alc662_auto_create_extra_out(spec, |
| 16842 | spec->autocfg.speaker_pins[0], |
| 16843 | "Speaker"); |
| 16844 | if (err < 0) |
| 16845 | return err; |
| 16846 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16847 | "Headphone"); |
| 16848 | if (err < 0) |
| 16849 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16850 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16851 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16852 | return err; |
| 16853 | |
| 16854 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16855 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16856 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16857 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16858 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16859 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16860 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16861 | |
| 16862 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16863 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16864 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16865 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16866 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16867 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16868 | |
| 16869 | err = alc_auto_add_mic_boost(codec); |
| 16870 | if (err < 0) |
| 16871 | return err; |
| 16872 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16873 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 16874 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16875 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16876 | } |
| 16877 | |
| 16878 | /* additional initialization for auto-configuration model */ |
| 16879 | static void alc662_auto_init(struct hda_codec *codec) |
| 16880 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16881 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16882 | alc662_auto_init_multi_out(codec); |
| 16883 | alc662_auto_init_hp_out(codec); |
| 16884 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16885 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16886 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16887 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16888 | } |
| 16889 | |
| 16890 | static int patch_alc662(struct hda_codec *codec) |
| 16891 | { |
| 16892 | struct alc_spec *spec; |
| 16893 | int err, board_config; |
| 16894 | |
| 16895 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16896 | if (!spec) |
| 16897 | return -ENOMEM; |
| 16898 | |
| 16899 | codec->spec = spec; |
| 16900 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 16901 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 16902 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16903 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 16904 | alc662_models, |
| 16905 | alc662_cfg_tbl); |
| 16906 | if (board_config < 0) { |
| 16907 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 16908 | "trying auto-probe from BIOS...\n"); |
| 16909 | board_config = ALC662_AUTO; |
| 16910 | } |
| 16911 | |
| 16912 | if (board_config == ALC662_AUTO) { |
| 16913 | /* automatic parse from the BIOS config */ |
| 16914 | err = alc662_parse_auto_config(codec); |
| 16915 | if (err < 0) { |
| 16916 | alc_free(codec); |
| 16917 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16918 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16919 | printk(KERN_INFO |
| 16920 | "hda_codec: Cannot set up configuration " |
| 16921 | "from BIOS. Using base mode...\n"); |
| 16922 | board_config = ALC662_3ST_2ch_DIG; |
| 16923 | } |
| 16924 | } |
| 16925 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16926 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 16927 | if (err < 0) { |
| 16928 | alc_free(codec); |
| 16929 | return err; |
| 16930 | } |
| 16931 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16932 | if (board_config != ALC662_AUTO) |
| 16933 | setup_preset(spec, &alc662_presets[board_config]); |
| 16934 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16935 | if (codec->vendor_id == 0x10ec0663) { |
| 16936 | spec->stream_name_analog = "ALC663 Analog"; |
| 16937 | spec->stream_name_digital = "ALC663 Digital"; |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16938 | } else if (codec->vendor_id == 0x10ec0272) { |
| 16939 | spec->stream_name_analog = "ALC272 Analog"; |
| 16940 | spec->stream_name_digital = "ALC272 Digital"; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16941 | } else { |
| 16942 | spec->stream_name_analog = "ALC662 Analog"; |
| 16943 | spec->stream_name_digital = "ALC662 Digital"; |
| 16944 | } |
| 16945 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16946 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 16947 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 16948 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16949 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 16950 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 16951 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16952 | spec->adc_nids = alc662_adc_nids; |
| 16953 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 16954 | spec->capsrc_nids = alc662_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16955 | spec->capture_style = CAPT_MIX; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16956 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16957 | if (!spec->cap_mixer) |
| 16958 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 16959 | if (codec->vendor_id == 0x10ec0662) |
| 16960 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 16961 | else |
| 16962 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16963 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16964 | spec->vmaster_nid = 0x02; |
| 16965 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16966 | codec->patch_ops = alc_patch_ops; |
| 16967 | if (board_config == ALC662_AUTO) |
| 16968 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16969 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16970 | if (!spec->loopback.amplist) |
| 16971 | spec->loopback.amplist = alc662_loopbacks; |
| 16972 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 16973 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16974 | |
| 16975 | return 0; |
| 16976 | } |
| 16977 | |
| 16978 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16979 | * patch entries |
| 16980 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 16981 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16982 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16983 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16984 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 16985 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16986 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16987 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16988 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16989 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16990 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 16991 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 16992 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16993 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 16994 | .patch = patch_alc883 }, |
| 16995 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 16996 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16997 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16998 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16999 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 17000 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17001 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 17002 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17003 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 17004 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17005 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 17006 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17007 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 17008 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 17009 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17010 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17011 | {} /* terminator */ |
| 17012 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17013 | |
| 17014 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17015 | |
| 17016 | MODULE_LICENSE("GPL"); |
| 17017 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17018 | |
| 17019 | static struct hda_codec_preset_list realtek_list = { |
| 17020 | .preset = snd_hda_preset_realtek, |
| 17021 | .owner = THIS_MODULE, |
| 17022 | }; |
| 17023 | |
| 17024 | static int __init patch_realtek_init(void) |
| 17025 | { |
| 17026 | return snd_hda_add_codec_preset(&realtek_list); |
| 17027 | } |
| 17028 | |
| 17029 | static void __exit patch_realtek_exit(void) |
| 17030 | { |
| 17031 | snd_hda_delete_codec_preset(&realtek_list); |
| 17032 | } |
| 17033 | |
| 17034 | module_init(patch_realtek_init) |
| 17035 | module_exit(patch_realtek_exit) |