Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 33 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 81 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 82 | #ifdef CONFIG_SND_DEBUG |
| 83 | ALC260_TEST, |
| 84 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 86 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 89 | /* ALC262 models */ |
| 90 | enum { |
| 91 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 92 | ALC262_HIPPO, |
| 93 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 94 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 95 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 96 | ALC262_HP_BPC_D7000_WL, |
| 97 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 98 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 99 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 100 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 101 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 102 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 103 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 104 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 105 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 108 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | ALC262_AUTO, |
| 110 | ALC262_MODEL_LAST /* last tag */ |
| 111 | }; |
| 112 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | /* ALC268 models */ |
| 114 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 115 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 117 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 118 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 119 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 120 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 121 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 122 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_SND_DEBUG |
| 124 | ALC268_TEST, |
| 125 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 126 | ALC268_AUTO, |
| 127 | ALC268_MODEL_LAST /* last tag */ |
| 128 | }; |
| 129 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 130 | /* ALC269 models */ |
| 131 | enum { |
| 132 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 133 | ALC269_QUANTA_FL1, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 134 | ALC269_ASUS_EEEPC_P703, |
| 135 | ALC269_ASUS_EEEPC_P901, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 136 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 137 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 138 | ALC269_AUTO, |
| 139 | ALC269_MODEL_LAST /* last tag */ |
| 140 | }; |
| 141 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 142 | /* ALC861 models */ |
| 143 | enum { |
| 144 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 145 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | ALC861_3ST_DIG, |
| 147 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 148 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 149 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 150 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 151 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 152 | ALC861_AUTO, |
| 153 | ALC861_MODEL_LAST, |
| 154 | }; |
| 155 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 156 | /* ALC861-VD models */ |
| 157 | enum { |
| 158 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 159 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 160 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 161 | ALC861VD_3ST, |
| 162 | ALC861VD_3ST_DIG, |
| 163 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 164 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 165 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 166 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 167 | ALC861VD_AUTO, |
| 168 | ALC861VD_MODEL_LAST, |
| 169 | }; |
| 170 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 171 | /* ALC662 models */ |
| 172 | enum { |
| 173 | ALC662_3ST_2ch_DIG, |
| 174 | ALC662_3ST_6ch_DIG, |
| 175 | ALC662_3ST_6ch, |
| 176 | ALC662_5ST_DIG, |
| 177 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 178 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 179 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 180 | ALC663_ASUS_M51VA, |
| 181 | ALC663_ASUS_G71V, |
| 182 | ALC663_ASUS_H13, |
| 183 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 184 | ALC662_ECS, |
| 185 | ALC663_ASUS_MODE1, |
| 186 | ALC662_ASUS_MODE2, |
| 187 | ALC663_ASUS_MODE3, |
| 188 | ALC663_ASUS_MODE4, |
| 189 | ALC663_ASUS_MODE5, |
| 190 | ALC663_ASUS_MODE6, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 191 | ALC272_DELL, |
| 192 | ALC272_DELL_ZM1, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 193 | ALC662_AUTO, |
| 194 | ALC662_MODEL_LAST, |
| 195 | }; |
| 196 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 197 | /* ALC882 models */ |
| 198 | enum { |
| 199 | ALC882_3ST_DIG, |
| 200 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 201 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 202 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 203 | ALC882_TARGA, |
| 204 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 205 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 206 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 207 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 208 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 209 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 210 | ALC882_MODEL_LAST, |
| 211 | }; |
| 212 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 213 | /* ALC883 models */ |
| 214 | enum { |
| 215 | ALC883_3ST_2ch_DIG, |
| 216 | ALC883_3ST_6ch_DIG, |
| 217 | ALC883_3ST_6ch, |
| 218 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 219 | ALC883_TARGA_DIG, |
| 220 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 221 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 222 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 223 | ALC888_ACER_ASPIRE_4930G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 224 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 225 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 226 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 227 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 228 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 229 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 230 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 231 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 232 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 233 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 234 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 235 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 236 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 237 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 238 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 239 | ALC888_ASUS_M90V, |
| 240 | ALC888_ASUS_EEE1601, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 241 | ALC1200_ASUS_P5Q, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 242 | ALC883_AUTO, |
| 243 | ALC883_MODEL_LAST, |
| 244 | }; |
| 245 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 246 | /* styles of capture selection */ |
| 247 | enum { |
| 248 | CAPT_MUX = 0, /* only mux based */ |
| 249 | CAPT_MIX, /* only mixer based */ |
| 250 | CAPT_1MUX_MIX, /* first mux and other mixers */ |
| 251 | }; |
| 252 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 253 | /* for GPIO Poll */ |
| 254 | #define GPIO_MASK 0x03 |
| 255 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 256 | /* extra amp-initialization sequence types */ |
| 257 | enum { |
| 258 | ALC_INIT_NONE, |
| 259 | ALC_INIT_DEFAULT, |
| 260 | ALC_INIT_GPIO1, |
| 261 | ALC_INIT_GPIO2, |
| 262 | ALC_INIT_GPIO3, |
| 263 | }; |
| 264 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | struct alc_spec { |
| 266 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 269 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 270 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 272 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 273 | * don't forget NULL |
| 274 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 275 | */ |
| 276 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 278 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | struct hda_pcm_stream *stream_analog_playback; |
| 280 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 281 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 282 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 284 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | struct hda_pcm_stream *stream_digital_playback; |
| 286 | struct hda_pcm_stream *stream_digital_capture; |
| 287 | |
| 288 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 289 | struct hda_multi_out multiout; /* playback set-up |
| 290 | * max_channels, dacs must be set |
| 291 | * dig_out_nid and hp_nid are optional |
| 292 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 293 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 294 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 295 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | |
| 297 | /* capture */ |
| 298 | unsigned int num_adc_nids; |
| 299 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 300 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 301 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 302 | int capture_style; /* capture style (CAPT_*) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | |
| 304 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 305 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | const struct hda_input_mux *input_mux; |
| 307 | unsigned int cur_mux[3]; |
| 308 | |
| 309 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 310 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 312 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | |
| 314 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 315 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 316 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 317 | /* dynamic controls, init_verbs and input_mux */ |
| 318 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 319 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 320 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 321 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 322 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 323 | /* hooks */ |
| 324 | void (*init_hook)(struct hda_codec *codec); |
| 325 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 326 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 327 | /* for pin sensing */ |
| 328 | unsigned int sense_updated: 1; |
| 329 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 330 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 331 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 332 | /* other flags */ |
| 333 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 334 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 335 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 336 | /* for virtual master */ |
| 337 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 338 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 339 | struct hda_loopback_check loopback; |
| 340 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 341 | |
| 342 | /* for PLL fix */ |
| 343 | hda_nid_t pll_nid; |
| 344 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 345 | }; |
| 346 | |
| 347 | /* |
| 348 | * configuration template - to be copied to the spec instance |
| 349 | */ |
| 350 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 351 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 352 | * with spec |
| 353 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 354 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 355 | const struct hda_verb *init_verbs[5]; |
| 356 | unsigned int num_dacs; |
| 357 | hda_nid_t *dac_nids; |
| 358 | hda_nid_t dig_out_nid; /* optional */ |
| 359 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 360 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 361 | unsigned int num_adc_nids; |
| 362 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 363 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 364 | hda_nid_t dig_in_nid; |
| 365 | unsigned int num_channel_mode; |
| 366 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 367 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 368 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 369 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 370 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 371 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 372 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 373 | struct hda_amp_list *loopbacks; |
| 374 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | }; |
| 376 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | |
| 378 | /* |
| 379 | * input MUX handling |
| 380 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 381 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 382 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | { |
| 384 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 385 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 386 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 387 | if (mux_idx >= spec->num_mux_defs) |
| 388 | mux_idx = 0; |
| 389 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | } |
| 391 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 392 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 393 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | { |
| 395 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 396 | struct alc_spec *spec = codec->spec; |
| 397 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 398 | |
| 399 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 400 | return 0; |
| 401 | } |
| 402 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 403 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 404 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 405 | { |
| 406 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 407 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 408 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 410 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 411 | hda_nid_t nid = spec->capsrc_nids ? |
| 412 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 414 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 415 | imux = &spec->input_mux[mux_idx]; |
| 416 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 417 | if (spec->capture_style && |
| 418 | !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 419 | /* Matrix-mixer style (e.g. ALC882) */ |
| 420 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 421 | unsigned int i, idx; |
| 422 | |
| 423 | idx = ucontrol->value.enumerated.item[0]; |
| 424 | if (idx >= imux->num_items) |
| 425 | idx = imux->num_items - 1; |
| 426 | if (*cur_val == idx) |
| 427 | return 0; |
| 428 | for (i = 0; i < imux->num_items; i++) { |
| 429 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 430 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 431 | imux->items[i].index, |
| 432 | HDA_AMP_MUTE, v); |
| 433 | } |
| 434 | *cur_val = idx; |
| 435 | return 1; |
| 436 | } else { |
| 437 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 438 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 439 | &spec->cur_mux[adc_idx]); |
| 440 | } |
| 441 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 442 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 443 | /* |
| 444 | * channel mode setting |
| 445 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 446 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 447 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | { |
| 449 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 450 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 451 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 452 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 453 | } |
| 454 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 455 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 456 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | { |
| 458 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 459 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 460 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 461 | spec->num_channel_mode, |
| 462 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | } |
| 464 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 465 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 466 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | { |
| 468 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 469 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 470 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 471 | spec->num_channel_mode, |
| 472 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 473 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 474 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 475 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 476 | } |
| 477 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 479 | * 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] | 480 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 481 | * being part of a format specifier. Maximum allowed length of a value is |
| 482 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 483 | * |
| 484 | * Note: some retasking pin complexes seem to ignore requests for input |
| 485 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 486 | * are requested. Therefore order this list so that this behaviour will not |
| 487 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 488 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 489 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 490 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 491 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 492 | "Mic 50pc bias", "Mic 80pc bias", |
| 493 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 494 | }; |
| 495 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 496 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 497 | }; |
| 498 | /* 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] | 499 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 500 | * addition, "input" pins may or may not process the mic bias option |
| 501 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 502 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 503 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 504 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 505 | #define ALC_PIN_DIR_IN 0x00 |
| 506 | #define ALC_PIN_DIR_OUT 0x01 |
| 507 | #define ALC_PIN_DIR_INOUT 0x02 |
| 508 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 509 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 510 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 511 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 512 | * For each direction the minimum and maximum values are given. |
| 513 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 514 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 515 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 516 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 517 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 518 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 519 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 520 | }; |
| 521 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 522 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 523 | #define alc_pin_mode_n_items(_dir) \ |
| 524 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 525 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 526 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 527 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 528 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 529 | unsigned int item_num = uinfo->value.enumerated.item; |
| 530 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 531 | |
| 532 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 533 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 534 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 535 | |
| 536 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 537 | item_num = alc_pin_mode_min(dir); |
| 538 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 539 | return 0; |
| 540 | } |
| 541 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 542 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 543 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 544 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 545 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 546 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 547 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 548 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 549 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 550 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 551 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 552 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 553 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 554 | /* Find enumerated value for current pinctl setting */ |
| 555 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 556 | 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] | 557 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 558 | *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] | 559 | return 0; |
| 560 | } |
| 561 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 562 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 563 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 564 | { |
| 565 | signed int change; |
| 566 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 567 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 568 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 569 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 570 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 571 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 572 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 573 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 574 | 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] | 575 | val = alc_pin_mode_min(dir); |
| 576 | |
| 577 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 578 | if (change) { |
| 579 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 580 | snd_hda_codec_write_cache(codec, nid, 0, |
| 581 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 582 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 583 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 584 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 585 | * for the requested pin mode. Enum values of 2 or less are |
| 586 | * input modes. |
| 587 | * |
| 588 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 589 | * reduces noise slightly (particularly on input) so we'll |
| 590 | * do it. However, having both input and output buffers |
| 591 | * enabled simultaneously doesn't seem to be problematic if |
| 592 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 593 | */ |
| 594 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 595 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 596 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 597 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 598 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 599 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 600 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 601 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 602 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 603 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 604 | } |
| 605 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 606 | return change; |
| 607 | } |
| 608 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 609 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 610 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 611 | .info = alc_pin_mode_info, \ |
| 612 | .get = alc_pin_mode_get, \ |
| 613 | .put = alc_pin_mode_put, \ |
| 614 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 615 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 616 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 617 | * together using a mask with more than one bit set. This control is |
| 618 | * currently used only by the ALC260 test model. At this stage they are not |
| 619 | * needed for any "production" models. |
| 620 | */ |
| 621 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 622 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 623 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 624 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 625 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 626 | { |
| 627 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 628 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 629 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 630 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 631 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 632 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 633 | |
| 634 | *valp = (val & mask) != 0; |
| 635 | return 0; |
| 636 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 637 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 638 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 639 | { |
| 640 | signed int change; |
| 641 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 642 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 643 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 644 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 645 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 646 | AC_VERB_GET_GPIO_DATA, |
| 647 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 648 | |
| 649 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 650 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 651 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 652 | gpio_data &= ~mask; |
| 653 | else |
| 654 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 655 | snd_hda_codec_write_cache(codec, nid, 0, |
| 656 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 657 | |
| 658 | return change; |
| 659 | } |
| 660 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 661 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 662 | .info = alc_gpio_data_info, \ |
| 663 | .get = alc_gpio_data_get, \ |
| 664 | .put = alc_gpio_data_put, \ |
| 665 | .private_value = nid | (mask<<16) } |
| 666 | #endif /* CONFIG_SND_DEBUG */ |
| 667 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 668 | /* A switch control to allow the enabling of the digital IO pins on the |
| 669 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 670 | * to provide something in the test model allowing digital outputs to be |
| 671 | * identified if present. If models are found which can utilise these |
| 672 | * outputs a more complete mixer control can be devised for those models if |
| 673 | * necessary. |
| 674 | */ |
| 675 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 676 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 677 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 678 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 679 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 680 | { |
| 681 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 682 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 683 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 684 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 685 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 686 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 687 | |
| 688 | *valp = (val & mask) != 0; |
| 689 | return 0; |
| 690 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 691 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 692 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 693 | { |
| 694 | signed int change; |
| 695 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 696 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 697 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 698 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 699 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 700 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 701 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 702 | |
| 703 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 704 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 705 | if (val==0) |
| 706 | ctrl_data &= ~mask; |
| 707 | else |
| 708 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 709 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 710 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 711 | |
| 712 | return change; |
| 713 | } |
| 714 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 715 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 716 | .info = alc_spdif_ctrl_info, \ |
| 717 | .get = alc_spdif_ctrl_get, \ |
| 718 | .put = alc_spdif_ctrl_put, \ |
| 719 | .private_value = nid | (mask<<16) } |
| 720 | #endif /* CONFIG_SND_DEBUG */ |
| 721 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 722 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 723 | * Again, this is only used in the ALC26x test models to help identify when |
| 724 | * the EAPD line must be asserted for features to work. |
| 725 | */ |
| 726 | #ifdef CONFIG_SND_DEBUG |
| 727 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 728 | |
| 729 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 730 | struct snd_ctl_elem_value *ucontrol) |
| 731 | { |
| 732 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 733 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 734 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 735 | long *valp = ucontrol->value.integer.value; |
| 736 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 737 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 738 | |
| 739 | *valp = (val & mask) != 0; |
| 740 | return 0; |
| 741 | } |
| 742 | |
| 743 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 744 | struct snd_ctl_elem_value *ucontrol) |
| 745 | { |
| 746 | int change; |
| 747 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 748 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 749 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 750 | long val = *ucontrol->value.integer.value; |
| 751 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 752 | AC_VERB_GET_EAPD_BTLENABLE, |
| 753 | 0x00); |
| 754 | |
| 755 | /* Set/unset the masked control bit(s) as needed */ |
| 756 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 757 | if (!val) |
| 758 | ctrl_data &= ~mask; |
| 759 | else |
| 760 | ctrl_data |= mask; |
| 761 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 762 | ctrl_data); |
| 763 | |
| 764 | return change; |
| 765 | } |
| 766 | |
| 767 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 768 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 769 | .info = alc_eapd_ctrl_info, \ |
| 770 | .get = alc_eapd_ctrl_get, \ |
| 771 | .put = alc_eapd_ctrl_put, \ |
| 772 | .private_value = nid | (mask<<16) } |
| 773 | #endif /* CONFIG_SND_DEBUG */ |
| 774 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 775 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 776 | * set up the input pin config (depending on the given auto-pin type) |
| 777 | */ |
| 778 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 779 | int auto_pin_type) |
| 780 | { |
| 781 | unsigned int val = PIN_IN; |
| 782 | |
| 783 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 784 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 785 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 786 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 787 | if (pincap & AC_PINCAP_VREF_80) |
| 788 | val = PIN_VREF80; |
| 789 | } |
| 790 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 791 | } |
| 792 | |
| 793 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 794 | */ |
| 795 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 796 | { |
| 797 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 798 | return; |
| 799 | spec->mixers[spec->num_mixers++] = mix; |
| 800 | } |
| 801 | |
| 802 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 803 | { |
| 804 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 805 | return; |
| 806 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 807 | } |
| 808 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 809 | #ifdef CONFIG_PROC_FS |
| 810 | /* |
| 811 | * hook for proc |
| 812 | */ |
| 813 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 814 | struct hda_codec *codec, hda_nid_t nid) |
| 815 | { |
| 816 | int coeff; |
| 817 | |
| 818 | if (nid != 0x20) |
| 819 | return; |
| 820 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 821 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 822 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 823 | AC_VERB_GET_COEF_INDEX, 0); |
| 824 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 825 | } |
| 826 | #else |
| 827 | #define print_realtek_coef NULL |
| 828 | #endif |
| 829 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 830 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 831 | * set up from the preset table |
| 832 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 833 | static void setup_preset(struct alc_spec *spec, |
| 834 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 835 | { |
| 836 | int i; |
| 837 | |
| 838 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 839 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 840 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 841 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 842 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 843 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 844 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 845 | spec->channel_mode = preset->channel_mode; |
| 846 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 847 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 848 | |
| 849 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 850 | |
| 851 | spec->multiout.num_dacs = preset->num_dacs; |
| 852 | spec->multiout.dac_nids = preset->dac_nids; |
| 853 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 854 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 855 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 856 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 857 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 858 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 859 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 860 | spec->input_mux = preset->input_mux; |
| 861 | |
| 862 | spec->num_adc_nids = preset->num_adc_nids; |
| 863 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 864 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 865 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 866 | |
| 867 | spec->unsol_event = preset->unsol_event; |
| 868 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 869 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 870 | spec->loopback.amplist = preset->loopbacks; |
| 871 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 872 | } |
| 873 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 874 | /* Enable GPIO mask and set output */ |
| 875 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 876 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 877 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 878 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 879 | { } |
| 880 | }; |
| 881 | |
| 882 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 883 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 884 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 885 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 886 | { } |
| 887 | }; |
| 888 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 889 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 890 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 891 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 892 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 893 | { } |
| 894 | }; |
| 895 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 896 | /* |
| 897 | * Fix hardware PLL issue |
| 898 | * On some codecs, the analog PLL gating control must be off while |
| 899 | * the default value is 1. |
| 900 | */ |
| 901 | static void alc_fix_pll(struct hda_codec *codec) |
| 902 | { |
| 903 | struct alc_spec *spec = codec->spec; |
| 904 | unsigned int val; |
| 905 | |
| 906 | if (!spec->pll_nid) |
| 907 | return; |
| 908 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 909 | spec->pll_coef_idx); |
| 910 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 911 | AC_VERB_GET_PROC_COEF, 0); |
| 912 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 913 | spec->pll_coef_idx); |
| 914 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 915 | val & ~(1 << spec->pll_coef_bit)); |
| 916 | } |
| 917 | |
| 918 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 919 | unsigned int coef_idx, unsigned int coef_bit) |
| 920 | { |
| 921 | struct alc_spec *spec = codec->spec; |
| 922 | spec->pll_nid = nid; |
| 923 | spec->pll_coef_idx = coef_idx; |
| 924 | spec->pll_coef_bit = coef_bit; |
| 925 | alc_fix_pll(codec); |
| 926 | } |
| 927 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 928 | static void alc_sku_automute(struct hda_codec *codec) |
| 929 | { |
| 930 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 931 | unsigned int present; |
| 932 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 933 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 934 | |
| 935 | /* need to execute and sync at first */ |
| 936 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 937 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 938 | AC_VERB_GET_PIN_SENSE, 0); |
| 939 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 940 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 941 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 942 | } |
| 943 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 944 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 945 | static void alc_mic_automute(struct hda_codec *codec) |
| 946 | { |
| 947 | struct alc_spec *spec = codec->spec; |
| 948 | unsigned int present; |
| 949 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 950 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 951 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 952 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 953 | |
| 954 | capsrc_idx_mic = mic_nid - 0x18; |
| 955 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 956 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 957 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 958 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 959 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 960 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 961 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 962 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 963 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 964 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 965 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 966 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 967 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 968 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 969 | /* unsolicited event for HP jack sensing */ |
| 970 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 971 | { |
| 972 | if (codec->vendor_id == 0x10ec0880) |
| 973 | res >>= 28; |
| 974 | else |
| 975 | res >>= 26; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 976 | if (res == ALC880_HP_EVENT) |
| 977 | alc_sku_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 978 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 979 | if (res == ALC880_MIC_EVENT) |
| 980 | alc_mic_automute(codec); |
| 981 | } |
| 982 | |
| 983 | static void alc_inithook(struct hda_codec *codec) |
| 984 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 985 | alc_sku_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 986 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 987 | } |
| 988 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 989 | /* additional initialization for ALC888 variants */ |
| 990 | static void alc888_coef_init(struct hda_codec *codec) |
| 991 | { |
| 992 | unsigned int tmp; |
| 993 | |
| 994 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 995 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 996 | 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] | 997 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 998 | /* alc888S-VC */ |
| 999 | snd_hda_codec_read(codec, 0x20, 0, |
| 1000 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1001 | else |
| 1002 | /* alc888-VB */ |
| 1003 | snd_hda_codec_read(codec, 0x20, 0, |
| 1004 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1005 | } |
| 1006 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1007 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1008 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1009 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1010 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1011 | switch (type) { |
| 1012 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1013 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1014 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1015 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1016 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1017 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1018 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1019 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1020 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1021 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1022 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1023 | case 0x10ec0260: |
| 1024 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1025 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1026 | snd_hda_codec_write(codec, 0x10, 0, |
| 1027 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1028 | break; |
| 1029 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1030 | case 0x10ec0267: |
| 1031 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1032 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1033 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1034 | case 0x10ec0660: |
| 1035 | case 0x10ec0662: |
| 1036 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1037 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1038 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1039 | snd_hda_codec_write(codec, 0x14, 0, |
| 1040 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1041 | snd_hda_codec_write(codec, 0x15, 0, |
| 1042 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1043 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1044 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1045 | switch (codec->vendor_id) { |
| 1046 | case 0x10ec0260: |
| 1047 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1048 | AC_VERB_SET_COEF_INDEX, 7); |
| 1049 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1050 | AC_VERB_GET_PROC_COEF, 0); |
| 1051 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1052 | AC_VERB_SET_COEF_INDEX, 7); |
| 1053 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1054 | AC_VERB_SET_PROC_COEF, |
| 1055 | tmp | 0x2010); |
| 1056 | break; |
| 1057 | case 0x10ec0262: |
| 1058 | case 0x10ec0880: |
| 1059 | case 0x10ec0882: |
| 1060 | case 0x10ec0883: |
| 1061 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1062 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1063 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1064 | snd_hda_codec_write(codec, 0x20, 0, |
| 1065 | AC_VERB_SET_COEF_INDEX, 7); |
| 1066 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1067 | AC_VERB_GET_PROC_COEF, 0); |
| 1068 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1069 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1070 | snd_hda_codec_write(codec, 0x20, 0, |
| 1071 | AC_VERB_SET_PROC_COEF, |
| 1072 | tmp | 0x2010); |
| 1073 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1074 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1075 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1076 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1077 | case 0x10ec0267: |
| 1078 | case 0x10ec0268: |
| 1079 | snd_hda_codec_write(codec, 0x20, 0, |
| 1080 | AC_VERB_SET_COEF_INDEX, 7); |
| 1081 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1082 | AC_VERB_GET_PROC_COEF, 0); |
| 1083 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1084 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1085 | snd_hda_codec_write(codec, 0x20, 0, |
| 1086 | AC_VERB_SET_PROC_COEF, |
| 1087 | tmp | 0x3000); |
| 1088 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1089 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1090 | break; |
| 1091 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1092 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1093 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1094 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1095 | { |
| 1096 | struct alc_spec *spec = codec->spec; |
| 1097 | |
| 1098 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1099 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1100 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1101 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1102 | if (spec->autocfg.line_out_pins[0] && |
| 1103 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1104 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1105 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1106 | else |
| 1107 | return; |
| 1108 | } |
| 1109 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1110 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1111 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1112 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1113 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1114 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1115 | spec->unsol_event = alc_sku_unsol_event; |
| 1116 | } |
| 1117 | |
| 1118 | /* check subsystem ID and set up device-specific initialization; |
| 1119 | * return 1 if initialized, 0 if invalid SSID |
| 1120 | */ |
| 1121 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1122 | * 31 ~ 16 : Manufacture ID |
| 1123 | * 15 ~ 8 : SKU ID |
| 1124 | * 7 ~ 0 : Assembly ID |
| 1125 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1126 | */ |
| 1127 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1128 | hda_nid_t porta, hda_nid_t porte, |
| 1129 | hda_nid_t portd) |
| 1130 | { |
| 1131 | unsigned int ass, tmp, i; |
| 1132 | unsigned nid; |
| 1133 | struct alc_spec *spec = codec->spec; |
| 1134 | |
| 1135 | ass = codec->subsystem_id & 0xffff; |
| 1136 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1137 | goto do_sku; |
| 1138 | |
| 1139 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1140 | /* |
| 1141 | * 31~30 : port conetcivity |
| 1142 | * 29~21 : reserve |
| 1143 | * 20 : PCBEEP input |
| 1144 | * 19~16 : Check sum (15:1) |
| 1145 | * 15~1 : Custom |
| 1146 | * 0 : override |
| 1147 | */ |
| 1148 | nid = 0x1d; |
| 1149 | if (codec->vendor_id == 0x10ec0260) |
| 1150 | nid = 0x17; |
| 1151 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1152 | snd_printd("realtek: No valid SSID, " |
| 1153 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1154 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1155 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1156 | return 0; |
| 1157 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1158 | return 0; |
| 1159 | |
| 1160 | /* check sum */ |
| 1161 | tmp = 0; |
| 1162 | for (i = 1; i < 16; i++) { |
| 1163 | if ((ass >> i) & 1) |
| 1164 | tmp++; |
| 1165 | } |
| 1166 | if (((ass >> 16) & 0xf) != tmp) |
| 1167 | return 0; |
| 1168 | do_sku: |
| 1169 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1170 | ass & 0xffff, codec->vendor_id); |
| 1171 | /* |
| 1172 | * 0 : override |
| 1173 | * 1 : Swap Jack |
| 1174 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1175 | * 3~5 : External Amplifier control |
| 1176 | * 7~6 : Reserved |
| 1177 | */ |
| 1178 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1179 | switch (tmp) { |
| 1180 | case 1: |
| 1181 | spec->init_amp = ALC_INIT_GPIO1; |
| 1182 | break; |
| 1183 | case 3: |
| 1184 | spec->init_amp = ALC_INIT_GPIO2; |
| 1185 | break; |
| 1186 | case 7: |
| 1187 | spec->init_amp = ALC_INIT_GPIO3; |
| 1188 | break; |
| 1189 | case 5: |
| 1190 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1191 | break; |
| 1192 | } |
| 1193 | |
| 1194 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1195 | * when the external headphone out jack is plugged" |
| 1196 | */ |
| 1197 | if (!(ass & 0x8000)) |
| 1198 | return 1; |
| 1199 | /* |
| 1200 | * 10~8 : Jack location |
| 1201 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1202 | * 14~13: Resvered |
| 1203 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1204 | * when the external headphone out jack is plugged" |
| 1205 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1206 | if (!spec->autocfg.hp_pins[0]) { |
| 1207 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1208 | if (tmp == 0) |
| 1209 | spec->autocfg.hp_pins[0] = porta; |
| 1210 | else if (tmp == 1) |
| 1211 | spec->autocfg.hp_pins[0] = porte; |
| 1212 | else if (tmp == 2) |
| 1213 | spec->autocfg.hp_pins[0] = portd; |
| 1214 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1215 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1216 | } |
| 1217 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1218 | alc_init_auto_hp(codec); |
| 1219 | return 1; |
| 1220 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1221 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1222 | static void alc_ssid_check(struct hda_codec *codec, |
| 1223 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1224 | { |
| 1225 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1226 | struct alc_spec *spec = codec->spec; |
| 1227 | snd_printd("realtek: " |
| 1228 | "Enable default setup for auto mode as fallback\n"); |
| 1229 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1230 | alc_init_auto_hp(codec); |
| 1231 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1232 | } |
| 1233 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1234 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1235 | * Fix-up pin default configurations |
| 1236 | */ |
| 1237 | |
| 1238 | struct alc_pincfg { |
| 1239 | hda_nid_t nid; |
| 1240 | u32 val; |
| 1241 | }; |
| 1242 | |
| 1243 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1244 | const struct snd_pci_quirk *quirk, |
| 1245 | const struct alc_pincfg **pinfix) |
| 1246 | { |
| 1247 | const struct alc_pincfg *cfg; |
| 1248 | |
| 1249 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1250 | if (!quirk) |
| 1251 | return; |
| 1252 | |
| 1253 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1254 | for (; cfg->nid; cfg++) |
| 1255 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1256 | } |
| 1257 | |
| 1258 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1259 | * ALC888 |
| 1260 | */ |
| 1261 | |
| 1262 | /* |
| 1263 | * 2ch mode |
| 1264 | */ |
| 1265 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1266 | /* Mic-in jack as mic in */ |
| 1267 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1268 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1269 | /* Line-in jack as Line in */ |
| 1270 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1271 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1272 | /* Line-Out as Front */ |
| 1273 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1274 | { } /* end */ |
| 1275 | }; |
| 1276 | |
| 1277 | /* |
| 1278 | * 4ch mode |
| 1279 | */ |
| 1280 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1281 | /* Mic-in jack as mic in */ |
| 1282 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1283 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1284 | /* Line-in jack as Surround */ |
| 1285 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1286 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1287 | /* Line-Out as Front */ |
| 1288 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1289 | { } /* end */ |
| 1290 | }; |
| 1291 | |
| 1292 | /* |
| 1293 | * 6ch mode |
| 1294 | */ |
| 1295 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1296 | /* Mic-in jack as CLFE */ |
| 1297 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1298 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1299 | /* Line-in jack as Surround */ |
| 1300 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1301 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1302 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1303 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1304 | { } /* end */ |
| 1305 | }; |
| 1306 | |
| 1307 | /* |
| 1308 | * 8ch mode |
| 1309 | */ |
| 1310 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1311 | /* Mic-in jack as CLFE */ |
| 1312 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1313 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1314 | /* Line-in jack as Surround */ |
| 1315 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1316 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1317 | /* Line-Out as Side */ |
| 1318 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1319 | { } /* end */ |
| 1320 | }; |
| 1321 | |
| 1322 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1323 | { 2, alc888_4ST_ch2_intel_init }, |
| 1324 | { 4, alc888_4ST_ch4_intel_init }, |
| 1325 | { 6, alc888_4ST_ch6_intel_init }, |
| 1326 | { 8, alc888_4ST_ch8_intel_init }, |
| 1327 | }; |
| 1328 | |
| 1329 | /* |
| 1330 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1331 | */ |
| 1332 | |
| 1333 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1334 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1335 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1336 | /* Connect Internal HP to Front */ |
| 1337 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1338 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1339 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1340 | /* Connect Bass HP to Front */ |
| 1341 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1342 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1343 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1344 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1345 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1346 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1347 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1348 | /* Connect Mic jack to CLFE */ |
| 1349 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1350 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1351 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1352 | /* Connect Line-in jack to Surround */ |
| 1353 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1354 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1355 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1356 | /* Connect HP out jack to Front */ |
| 1357 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1358 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1359 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1360 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1361 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1362 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1363 | {} |
| 1364 | }; |
| 1365 | |
| 1366 | static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec) |
| 1367 | { |
| 1368 | unsigned int present; |
| 1369 | unsigned int bits; |
| 1370 | /* Line out presence */ |
| 1371 | present = snd_hda_codec_read(codec, 0x17, 0, |
| 1372 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1373 | /* HP out presence */ |
| 1374 | present = present || snd_hda_codec_read(codec, 0x1b, 0, |
| 1375 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1376 | bits = present ? HDA_AMP_MUTE : 0; |
| 1377 | /* Toggle internal speakers muting */ |
| 1378 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1379 | HDA_AMP_MUTE, bits); |
| 1380 | /* Toggle internal bass muting */ |
| 1381 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1382 | HDA_AMP_MUTE, bits); |
| 1383 | } |
| 1384 | |
| 1385 | static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec, |
| 1386 | unsigned int res) |
| 1387 | { |
| 1388 | if (res >> 26 == ALC880_HP_EVENT) |
| 1389 | alc888_fujitsu_xa3530_automute(codec); |
| 1390 | } |
| 1391 | |
| 1392 | |
| 1393 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1394 | * ALC888 Acer Aspire 4930G model |
| 1395 | */ |
| 1396 | |
| 1397 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1398 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1399 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1400 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1401 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1402 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1403 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1404 | /* Connect Internal HP to front */ |
| 1405 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1406 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1407 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1408 | /* Connect HP out to front */ |
| 1409 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1410 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1411 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1412 | { } |
| 1413 | }; |
| 1414 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1415 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1416 | /* Front mic only available on one ADC */ |
| 1417 | { |
| 1418 | .num_items = 4, |
| 1419 | .items = { |
| 1420 | { "Mic", 0x0 }, |
| 1421 | { "Line", 0x2 }, |
| 1422 | { "CD", 0x4 }, |
| 1423 | { "Front Mic", 0xb }, |
| 1424 | }, |
| 1425 | }, |
| 1426 | { |
| 1427 | .num_items = 3, |
| 1428 | .items = { |
| 1429 | { "Mic", 0x0 }, |
| 1430 | { "Line", 0x2 }, |
| 1431 | { "CD", 0x4 }, |
| 1432 | }, |
| 1433 | } |
| 1434 | }; |
| 1435 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1436 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1437 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1438 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1439 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1440 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1441 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1442 | HDA_OUTPUT), |
| 1443 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1444 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1445 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1446 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1447 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1448 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1449 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1450 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1451 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1452 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1453 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1454 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1455 | { } /* end */ |
| 1456 | }; |
| 1457 | |
| 1458 | static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec) |
| 1459 | { |
| 1460 | unsigned int present; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1461 | unsigned int bits; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1462 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 1463 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1464 | bits = present ? HDA_AMP_MUTE : 0; |
| 1465 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1466 | HDA_AMP_MUTE, bits); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1467 | } |
| 1468 | |
| 1469 | static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, |
| 1470 | unsigned int res) |
| 1471 | { |
| 1472 | if (res >> 26 == ALC880_HP_EVENT) |
| 1473 | alc888_acer_aspire_4930g_automute(codec); |
| 1474 | } |
| 1475 | |
| 1476 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1477 | * ALC880 3-stack model |
| 1478 | * |
| 1479 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1480 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1481 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1482 | */ |
| 1483 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1484 | static hda_nid_t alc880_dac_nids[4] = { |
| 1485 | /* front, rear, clfe, rear_surr */ |
| 1486 | 0x02, 0x05, 0x04, 0x03 |
| 1487 | }; |
| 1488 | |
| 1489 | static hda_nid_t alc880_adc_nids[3] = { |
| 1490 | /* ADC0-2 */ |
| 1491 | 0x07, 0x08, 0x09, |
| 1492 | }; |
| 1493 | |
| 1494 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1495 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1496 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1497 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1498 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1499 | /* ADC1-2 */ |
| 1500 | 0x08, 0x09, |
| 1501 | }; |
| 1502 | |
| 1503 | #define ALC880_DIGOUT_NID 0x06 |
| 1504 | #define ALC880_DIGIN_NID 0x0a |
| 1505 | |
| 1506 | static struct hda_input_mux alc880_capture_source = { |
| 1507 | .num_items = 4, |
| 1508 | .items = { |
| 1509 | { "Mic", 0x0 }, |
| 1510 | { "Front Mic", 0x3 }, |
| 1511 | { "Line", 0x2 }, |
| 1512 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1513 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1514 | }; |
| 1515 | |
| 1516 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1517 | /* 2ch mode */ |
| 1518 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1519 | /* set line-in to input, mute it */ |
| 1520 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1521 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1522 | /* set mic-in to input vref 80%, mute it */ |
| 1523 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1524 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1525 | { } /* end */ |
| 1526 | }; |
| 1527 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1528 | /* 6ch mode */ |
| 1529 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1530 | /* set line-in to output, unmute it */ |
| 1531 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1532 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1533 | /* set mic-in to output, unmute it */ |
| 1534 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1535 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1536 | { } /* end */ |
| 1537 | }; |
| 1538 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1539 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1540 | { 2, alc880_threestack_ch2_init }, |
| 1541 | { 6, alc880_threestack_ch6_init }, |
| 1542 | }; |
| 1543 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1544 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1545 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1546 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1547 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1548 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1549 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1550 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1551 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1552 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1553 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1554 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1555 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1556 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1557 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1558 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1559 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1560 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1561 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1562 | { |
| 1563 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1564 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1565 | .info = alc_ch_mode_info, |
| 1566 | .get = alc_ch_mode_get, |
| 1567 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1568 | }, |
| 1569 | { } /* end */ |
| 1570 | }; |
| 1571 | |
| 1572 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1573 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1574 | struct snd_ctl_elem_info *uinfo) |
| 1575 | { |
| 1576 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1577 | struct alc_spec *spec = codec->spec; |
| 1578 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1579 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1580 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1581 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1582 | HDA_INPUT); |
| 1583 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1584 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1585 | return err; |
| 1586 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1587 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1588 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1589 | unsigned int size, unsigned int __user *tlv) |
| 1590 | { |
| 1591 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1592 | struct alc_spec *spec = codec->spec; |
| 1593 | int err; |
| 1594 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1595 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1596 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1597 | HDA_INPUT); |
| 1598 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1599 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1600 | return err; |
| 1601 | } |
| 1602 | |
| 1603 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1604 | struct snd_ctl_elem_value *ucontrol); |
| 1605 | |
| 1606 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1607 | struct snd_ctl_elem_value *ucontrol, |
| 1608 | getput_call_t func) |
| 1609 | { |
| 1610 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1611 | struct alc_spec *spec = codec->spec; |
| 1612 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1613 | int err; |
| 1614 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1615 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1616 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1617 | 3, 0, HDA_INPUT); |
| 1618 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1619 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1620 | return err; |
| 1621 | } |
| 1622 | |
| 1623 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1624 | struct snd_ctl_elem_value *ucontrol) |
| 1625 | { |
| 1626 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1627 | snd_hda_mixer_amp_volume_get); |
| 1628 | } |
| 1629 | |
| 1630 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1631 | struct snd_ctl_elem_value *ucontrol) |
| 1632 | { |
| 1633 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1634 | snd_hda_mixer_amp_volume_put); |
| 1635 | } |
| 1636 | |
| 1637 | /* capture mixer elements */ |
| 1638 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1639 | |
| 1640 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1641 | struct snd_ctl_elem_value *ucontrol) |
| 1642 | { |
| 1643 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1644 | snd_hda_mixer_amp_switch_get); |
| 1645 | } |
| 1646 | |
| 1647 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1648 | struct snd_ctl_elem_value *ucontrol) |
| 1649 | { |
| 1650 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1651 | snd_hda_mixer_amp_switch_put); |
| 1652 | } |
| 1653 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1654 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1655 | { \ |
| 1656 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1657 | .name = "Capture Switch", \ |
| 1658 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1659 | .count = num, \ |
| 1660 | .info = alc_cap_sw_info, \ |
| 1661 | .get = alc_cap_sw_get, \ |
| 1662 | .put = alc_cap_sw_put, \ |
| 1663 | }, \ |
| 1664 | { \ |
| 1665 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1666 | .name = "Capture Volume", \ |
| 1667 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1668 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1669 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1670 | .count = num, \ |
| 1671 | .info = alc_cap_vol_info, \ |
| 1672 | .get = alc_cap_vol_get, \ |
| 1673 | .put = alc_cap_vol_put, \ |
| 1674 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1675 | } |
| 1676 | |
| 1677 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1678 | { \ |
| 1679 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1680 | /* .name = "Capture Source", */ \ |
| 1681 | .name = "Input Source", \ |
| 1682 | .count = num, \ |
| 1683 | .info = alc_mux_enum_info, \ |
| 1684 | .get = alc_mux_enum_get, \ |
| 1685 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1686 | } |
| 1687 | |
| 1688 | #define DEFINE_CAPMIX(num) \ |
| 1689 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1690 | _DEFINE_CAPMIX(num), \ |
| 1691 | _DEFINE_CAPSRC(num), \ |
| 1692 | { } /* end */ \ |
| 1693 | } |
| 1694 | |
| 1695 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 1696 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 1697 | _DEFINE_CAPMIX(num), \ |
| 1698 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1699 | } |
| 1700 | |
| 1701 | /* up to three ADCs */ |
| 1702 | DEFINE_CAPMIX(1); |
| 1703 | DEFINE_CAPMIX(2); |
| 1704 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1705 | DEFINE_CAPMIX_NOSRC(1); |
| 1706 | DEFINE_CAPMIX_NOSRC(2); |
| 1707 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1708 | |
| 1709 | /* |
| 1710 | * ALC880 5-stack model |
| 1711 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1712 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1713 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1714 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1715 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1716 | */ |
| 1717 | |
| 1718 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1719 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1720 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1721 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1722 | { } /* end */ |
| 1723 | }; |
| 1724 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1725 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1726 | /* 6ch mode */ |
| 1727 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1728 | /* set line-in to input, mute it */ |
| 1729 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1730 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1731 | { } /* end */ |
| 1732 | }; |
| 1733 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1734 | /* 8ch mode */ |
| 1735 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1736 | /* set line-in to output, unmute it */ |
| 1737 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1738 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1739 | { } /* end */ |
| 1740 | }; |
| 1741 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1742 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1743 | { 6, alc880_fivestack_ch6_init }, |
| 1744 | { 8, alc880_fivestack_ch8_init }, |
| 1745 | }; |
| 1746 | |
| 1747 | |
| 1748 | /* |
| 1749 | * ALC880 6-stack model |
| 1750 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1751 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1752 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1753 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1754 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1755 | */ |
| 1756 | |
| 1757 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1758 | /* front, rear, clfe, rear_surr */ |
| 1759 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1760 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1761 | |
| 1762 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1763 | .num_items = 4, |
| 1764 | .items = { |
| 1765 | { "Mic", 0x0 }, |
| 1766 | { "Front Mic", 0x1 }, |
| 1767 | { "Line", 0x2 }, |
| 1768 | { "CD", 0x4 }, |
| 1769 | }, |
| 1770 | }; |
| 1771 | |
| 1772 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1773 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1774 | { 8, NULL }, |
| 1775 | }; |
| 1776 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1777 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1778 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1779 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1780 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1781 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1782 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1783 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1784 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1785 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1786 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1787 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1788 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1789 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1790 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1791 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1792 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1793 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1794 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1795 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1796 | { |
| 1797 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1798 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1799 | .info = alc_ch_mode_info, |
| 1800 | .get = alc_ch_mode_get, |
| 1801 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1802 | }, |
| 1803 | { } /* end */ |
| 1804 | }; |
| 1805 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1806 | |
| 1807 | /* |
| 1808 | * ALC880 W810 model |
| 1809 | * |
| 1810 | * W810 has rear IO for: |
| 1811 | * Front (DAC 02) |
| 1812 | * Surround (DAC 03) |
| 1813 | * Center/LFE (DAC 04) |
| 1814 | * Digital out (06) |
| 1815 | * |
| 1816 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1817 | * 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] | 1818 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1819 | * There is a variable resistor to control the speaker or headphone |
| 1820 | * volume. This is a hardware-only device without a software API. |
| 1821 | * |
| 1822 | * Plugging headphones in will disable the internal speakers. This is |
| 1823 | * implemented in hardware, not via the driver using jack sense. In |
| 1824 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1825 | * disable both the speakers and headphones. |
| 1826 | * |
| 1827 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1828 | * These may not do anything useful with this driver yet, because I |
| 1829 | * haven't setup any initialization verbs for these yet... |
| 1830 | */ |
| 1831 | |
| 1832 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1833 | /* front, rear/surround, clfe */ |
| 1834 | 0x02, 0x03, 0x04 |
| 1835 | }; |
| 1836 | |
| 1837 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1838 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1839 | { 6, NULL } |
| 1840 | }; |
| 1841 | |
| 1842 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1843 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1844 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1845 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1846 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1847 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1848 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1849 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1850 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1851 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1852 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1853 | { } /* end */ |
| 1854 | }; |
| 1855 | |
| 1856 | |
| 1857 | /* |
| 1858 | * Z710V model |
| 1859 | * |
| 1860 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1861 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1862 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1863 | */ |
| 1864 | |
| 1865 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1866 | 0x02 |
| 1867 | }; |
| 1868 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1869 | |
| 1870 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1871 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1872 | { 2, NULL } |
| 1873 | }; |
| 1874 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1875 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1876 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1877 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1878 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1879 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1880 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1881 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1882 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1883 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1884 | { } /* end */ |
| 1885 | }; |
| 1886 | |
| 1887 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1888 | /* |
| 1889 | * ALC880 F1734 model |
| 1890 | * |
| 1891 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1892 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1893 | */ |
| 1894 | |
| 1895 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1896 | 0x03 |
| 1897 | }; |
| 1898 | #define ALC880_F1734_HP_DAC 0x02 |
| 1899 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1900 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1901 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1902 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1903 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1904 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1905 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1906 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1907 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1908 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1909 | { } /* end */ |
| 1910 | }; |
| 1911 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1912 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1913 | .num_items = 2, |
| 1914 | .items = { |
| 1915 | { "Mic", 0x1 }, |
| 1916 | { "CD", 0x4 }, |
| 1917 | }, |
| 1918 | }; |
| 1919 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1920 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1921 | /* |
| 1922 | * ALC880 ASUS model |
| 1923 | * |
| 1924 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1925 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1926 | * Mic = 0x18, Line = 0x1a |
| 1927 | */ |
| 1928 | |
| 1929 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1930 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1931 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1932 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1933 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1934 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1935 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1936 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1937 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1938 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1939 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1940 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1941 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1942 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1943 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1944 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1945 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1946 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1947 | { |
| 1948 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1949 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1950 | .info = alc_ch_mode_info, |
| 1951 | .get = alc_ch_mode_get, |
| 1952 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1953 | }, |
| 1954 | { } /* end */ |
| 1955 | }; |
| 1956 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1957 | /* |
| 1958 | * ALC880 ASUS W1V model |
| 1959 | * |
| 1960 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1961 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1962 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1963 | */ |
| 1964 | |
| 1965 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1966 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1967 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1968 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1969 | { } /* end */ |
| 1970 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1971 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1972 | /* TCL S700 */ |
| 1973 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1974 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1975 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1976 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1977 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1978 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1979 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1980 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1981 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1982 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1983 | { } /* end */ |
| 1984 | }; |
| 1985 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1986 | /* Uniwill */ |
| 1987 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1988 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1989 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1990 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1991 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1992 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1993 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1994 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1995 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1996 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1997 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1998 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1999 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2000 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2001 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2002 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2003 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2004 | { |
| 2005 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2006 | .name = "Channel Mode", |
| 2007 | .info = alc_ch_mode_info, |
| 2008 | .get = alc_ch_mode_get, |
| 2009 | .put = alc_ch_mode_put, |
| 2010 | }, |
| 2011 | { } /* end */ |
| 2012 | }; |
| 2013 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2014 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2015 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2016 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2017 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2018 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2019 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2020 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2021 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2022 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2023 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2024 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2025 | { } /* end */ |
| 2026 | }; |
| 2027 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2028 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2029 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2030 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2031 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2032 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2033 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2034 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2035 | { } /* end */ |
| 2036 | }; |
| 2037 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2038 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2039 | * virtual master controls |
| 2040 | */ |
| 2041 | |
| 2042 | /* |
| 2043 | * slave controls for virtual master |
| 2044 | */ |
| 2045 | static const char *alc_slave_vols[] = { |
| 2046 | "Front Playback Volume", |
| 2047 | "Surround Playback Volume", |
| 2048 | "Center Playback Volume", |
| 2049 | "LFE Playback Volume", |
| 2050 | "Side Playback Volume", |
| 2051 | "Headphone Playback Volume", |
| 2052 | "Speaker Playback Volume", |
| 2053 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2054 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2055 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2056 | NULL, |
| 2057 | }; |
| 2058 | |
| 2059 | static const char *alc_slave_sws[] = { |
| 2060 | "Front Playback Switch", |
| 2061 | "Surround Playback Switch", |
| 2062 | "Center Playback Switch", |
| 2063 | "LFE Playback Switch", |
| 2064 | "Side Playback Switch", |
| 2065 | "Headphone Playback Switch", |
| 2066 | "Speaker Playback Switch", |
| 2067 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2068 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2069 | NULL, |
| 2070 | }; |
| 2071 | |
| 2072 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2073 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2074 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2075 | |
| 2076 | static void alc_free_kctls(struct hda_codec *codec); |
| 2077 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2078 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2079 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2080 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2081 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2082 | { } /* end */ |
| 2083 | }; |
| 2084 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2085 | static int alc_build_controls(struct hda_codec *codec) |
| 2086 | { |
| 2087 | struct alc_spec *spec = codec->spec; |
| 2088 | int err; |
| 2089 | int i; |
| 2090 | |
| 2091 | for (i = 0; i < spec->num_mixers; i++) { |
| 2092 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2093 | if (err < 0) |
| 2094 | return err; |
| 2095 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2096 | if (spec->cap_mixer) { |
| 2097 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2098 | if (err < 0) |
| 2099 | return err; |
| 2100 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2101 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2102 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2103 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2104 | if (err < 0) |
| 2105 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2106 | if (!spec->no_analog) { |
| 2107 | err = snd_hda_create_spdif_share_sw(codec, |
| 2108 | &spec->multiout); |
| 2109 | if (err < 0) |
| 2110 | return err; |
| 2111 | spec->multiout.share_spdif = 1; |
| 2112 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2113 | } |
| 2114 | if (spec->dig_in_nid) { |
| 2115 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2116 | if (err < 0) |
| 2117 | return err; |
| 2118 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2119 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2120 | /* create beep controls if needed */ |
| 2121 | if (spec->beep_amp) { |
| 2122 | struct snd_kcontrol_new *knew; |
| 2123 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2124 | struct snd_kcontrol *kctl; |
| 2125 | kctl = snd_ctl_new1(knew, codec); |
| 2126 | if (!kctl) |
| 2127 | return -ENOMEM; |
| 2128 | kctl->private_value = spec->beep_amp; |
| 2129 | err = snd_hda_ctl_add(codec, kctl); |
| 2130 | if (err < 0) |
| 2131 | return err; |
| 2132 | } |
| 2133 | } |
| 2134 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2135 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2136 | if (!spec->no_analog && |
| 2137 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2138 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2139 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2140 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2141 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2142 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2143 | if (err < 0) |
| 2144 | return err; |
| 2145 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2146 | if (!spec->no_analog && |
| 2147 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2148 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2149 | NULL, alc_slave_sws); |
| 2150 | if (err < 0) |
| 2151 | return err; |
| 2152 | } |
| 2153 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2154 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2155 | return 0; |
| 2156 | } |
| 2157 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2158 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2159 | /* |
| 2160 | * initialize the codec volumes, etc |
| 2161 | */ |
| 2162 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2163 | /* |
| 2164 | * generic initialization of ADC, input mixers and output mixers |
| 2165 | */ |
| 2166 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2167 | /* |
| 2168 | * Unmute ADC0-2 and set the default input to mic-in |
| 2169 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2170 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2171 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2172 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2173 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2174 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2175 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2176 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2177 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2178 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2179 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2180 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2181 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2182 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2183 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2184 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2185 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2186 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2187 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2188 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2189 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2190 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2191 | /* |
| 2192 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2193 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2194 | /* set vol=0 to output mixers */ |
| 2195 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2196 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2197 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2198 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2199 | /* set up input amps for analog loopback */ |
| 2200 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2201 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2202 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2203 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2204 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2205 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2206 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2207 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2208 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2209 | |
| 2210 | { } |
| 2211 | }; |
| 2212 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2213 | /* |
| 2214 | * 3-stack pin configuration: |
| 2215 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2216 | */ |
| 2217 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2218 | /* |
| 2219 | * preset connection lists of input pins |
| 2220 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2221 | */ |
| 2222 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2223 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2224 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2225 | |
| 2226 | /* |
| 2227 | * Set pin mode and muting |
| 2228 | */ |
| 2229 | /* set front pin widgets 0x14 for output */ |
| 2230 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2231 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2232 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2233 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2234 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2235 | /* Mic2 (as headphone out) for HP output */ |
| 2236 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2237 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2238 | /* Line In pin widget for input */ |
| 2239 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2240 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2241 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2242 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2243 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2244 | /* CD pin widget for input */ |
| 2245 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2246 | |
| 2247 | { } |
| 2248 | }; |
| 2249 | |
| 2250 | /* |
| 2251 | * 5-stack pin configuration: |
| 2252 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2253 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2254 | */ |
| 2255 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2256 | /* |
| 2257 | * preset connection lists of input pins |
| 2258 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2259 | */ |
| 2260 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2261 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2262 | |
| 2263 | /* |
| 2264 | * Set pin mode and muting |
| 2265 | */ |
| 2266 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2267 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2268 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2269 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2270 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2271 | /* unmute pins for output (no gain on this amp) */ |
| 2272 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2273 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2274 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2275 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2276 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2277 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2278 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2279 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2280 | /* Mic2 (as headphone out) for HP output */ |
| 2281 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2282 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2283 | /* Line In pin widget for input */ |
| 2284 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2285 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2286 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2287 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2288 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2289 | /* CD pin widget for input */ |
| 2290 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2291 | |
| 2292 | { } |
| 2293 | }; |
| 2294 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2295 | /* |
| 2296 | * W810 pin configuration: |
| 2297 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2298 | */ |
| 2299 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2300 | /* hphone/speaker input selector: front DAC */ |
| 2301 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2302 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2303 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2304 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2305 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2306 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2307 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2308 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2309 | |
| 2310 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2311 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2312 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2313 | { } |
| 2314 | }; |
| 2315 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2316 | /* |
| 2317 | * Z71V pin configuration: |
| 2318 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2319 | */ |
| 2320 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2321 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2322 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2323 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2324 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2325 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2326 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2327 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2328 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2329 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2330 | |
| 2331 | { } |
| 2332 | }; |
| 2333 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2334 | /* |
| 2335 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2336 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2337 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2338 | */ |
| 2339 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2340 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2341 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2342 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2343 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2344 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2345 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2346 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2347 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2348 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2349 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2350 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2351 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2352 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2353 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2354 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2355 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2356 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2357 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2358 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2359 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2360 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2361 | { } |
| 2362 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2363 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2364 | /* |
| 2365 | * Uniwill pin configuration: |
| 2366 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2367 | * line = 0x1a |
| 2368 | */ |
| 2369 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2370 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2371 | |
| 2372 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2373 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2374 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2375 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2376 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2377 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2378 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2379 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2381 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2382 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2383 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2384 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2385 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2386 | |
| 2387 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2388 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2389 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2390 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2391 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2392 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2393 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2394 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2395 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2396 | |
| 2397 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2398 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2399 | |
| 2400 | { } |
| 2401 | }; |
| 2402 | |
| 2403 | /* |
| 2404 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2405 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2406 | */ |
| 2407 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2408 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2409 | |
| 2410 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2411 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2412 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2413 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2414 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2415 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2416 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2417 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2418 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2419 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2420 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2421 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2422 | |
| 2423 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2424 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2425 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2426 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2427 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2428 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2429 | |
| 2430 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2431 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2432 | |
| 2433 | { } |
| 2434 | }; |
| 2435 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2436 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2437 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2438 | { } |
| 2439 | }; |
| 2440 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2441 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2442 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2443 | { |
| 2444 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2445 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2446 | |
| 2447 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2448 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2449 | bits = present ? HDA_AMP_MUTE : 0; |
| 2450 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 2451 | HDA_AMP_MUTE, bits); |
| 2452 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 2453 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2454 | } |
| 2455 | |
| 2456 | /* auto-toggle front mic */ |
| 2457 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2458 | { |
| 2459 | unsigned int present; |
| 2460 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2461 | |
| 2462 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2463 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2464 | bits = present ? HDA_AMP_MUTE : 0; |
| 2465 | 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] | 2466 | } |
| 2467 | |
| 2468 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 2469 | { |
| 2470 | alc880_uniwill_hp_automute(codec); |
| 2471 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2472 | } |
| 2473 | |
| 2474 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2475 | unsigned int res) |
| 2476 | { |
| 2477 | /* Looks like the unsol event is incompatible with the standard |
| 2478 | * definition. 4bit tag is placed at 28 bit! |
| 2479 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2480 | switch (res >> 28) { |
| 2481 | case ALC880_HP_EVENT: |
| 2482 | alc880_uniwill_hp_automute(codec); |
| 2483 | break; |
| 2484 | case ALC880_MIC_EVENT: |
| 2485 | alc880_uniwill_mic_automute(codec); |
| 2486 | break; |
| 2487 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2488 | } |
| 2489 | |
| 2490 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 2491 | { |
| 2492 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2493 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2494 | |
| 2495 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2496 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2497 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 2498 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2499 | } |
| 2500 | |
| 2501 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2502 | { |
| 2503 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2504 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2505 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2506 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2507 | present &= HDA_AMP_VOLMASK; |
| 2508 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2509 | HDA_AMP_VOLMASK, present); |
| 2510 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2511 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2512 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2513 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2514 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2515 | unsigned int res) |
| 2516 | { |
| 2517 | /* Looks like the unsol event is incompatible with the standard |
| 2518 | * definition. 4bit tag is placed at 28 bit! |
| 2519 | */ |
| 2520 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2521 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2522 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2523 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2524 | } |
| 2525 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2526 | /* |
| 2527 | * F1734 pin configuration: |
| 2528 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2529 | */ |
| 2530 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2531 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2532 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2533 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2534 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2535 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2536 | |
| 2537 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2538 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2539 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2540 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2541 | |
| 2542 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2543 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2544 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2545 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2546 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2547 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2548 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2549 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2550 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2551 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2552 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2553 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2554 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2555 | { } |
| 2556 | }; |
| 2557 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2558 | /* |
| 2559 | * ASUS pin configuration: |
| 2560 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2561 | */ |
| 2562 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2563 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2564 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2565 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2566 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2567 | |
| 2568 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2569 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2570 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2571 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2572 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2573 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2574 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2575 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2576 | |
| 2577 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2578 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2579 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2580 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2581 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2582 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2583 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2584 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2585 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2586 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2587 | { } |
| 2588 | }; |
| 2589 | |
| 2590 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2591 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2592 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2593 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2594 | /* Clevo m520g init */ |
| 2595 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2596 | /* headphone output */ |
| 2597 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2598 | /* line-out */ |
| 2599 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2600 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2601 | /* Line-in */ |
| 2602 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2603 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2604 | /* CD */ |
| 2605 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2606 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2607 | /* Mic1 (rear panel) */ |
| 2608 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2609 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2610 | /* Mic2 (front panel) */ |
| 2611 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2612 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2613 | /* headphone */ |
| 2614 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2615 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2616 | /* change to EAPD mode */ |
| 2617 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2618 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2619 | |
| 2620 | { } |
| 2621 | }; |
| 2622 | |
| 2623 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2624 | /* change to EAPD mode */ |
| 2625 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2626 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2627 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2628 | /* Headphone output */ |
| 2629 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2630 | /* Front output*/ |
| 2631 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2632 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2633 | |
| 2634 | /* Line In pin widget for input */ |
| 2635 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2636 | /* CD pin widget for input */ |
| 2637 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2638 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2639 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2640 | |
| 2641 | /* change to EAPD mode */ |
| 2642 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2643 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2644 | |
| 2645 | { } |
| 2646 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2647 | |
| 2648 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2649 | * LG m1 express dual |
| 2650 | * |
| 2651 | * Pin assignment: |
| 2652 | * Rear Line-In/Out (blue): 0x14 |
| 2653 | * Build-in Mic-In: 0x15 |
| 2654 | * Speaker-out: 0x17 |
| 2655 | * HP-Out (green): 0x1b |
| 2656 | * Mic-In/Out (red): 0x19 |
| 2657 | * SPDIF-Out: 0x1e |
| 2658 | */ |
| 2659 | |
| 2660 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2661 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2662 | 0x05, 0x02, 0x03 |
| 2663 | }; |
| 2664 | |
| 2665 | /* seems analog CD is not working */ |
| 2666 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2667 | .num_items = 3, |
| 2668 | .items = { |
| 2669 | { "Mic", 0x1 }, |
| 2670 | { "Line", 0x5 }, |
| 2671 | { "Internal Mic", 0x6 }, |
| 2672 | }, |
| 2673 | }; |
| 2674 | |
| 2675 | /* 2,4,6 channel modes */ |
| 2676 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2677 | /* set line-in and mic-in to input */ |
| 2678 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2679 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2680 | { } |
| 2681 | }; |
| 2682 | |
| 2683 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2684 | /* set line-in to out and mic-in to input */ |
| 2685 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2686 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2687 | { } |
| 2688 | }; |
| 2689 | |
| 2690 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2691 | /* set line-in and mic-in to output */ |
| 2692 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2693 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2694 | { } |
| 2695 | }; |
| 2696 | |
| 2697 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2698 | { 2, alc880_lg_ch2_init }, |
| 2699 | { 4, alc880_lg_ch4_init }, |
| 2700 | { 6, alc880_lg_ch6_init }, |
| 2701 | }; |
| 2702 | |
| 2703 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2704 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2705 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2706 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2707 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2708 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2709 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2710 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2711 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2712 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2713 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2714 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2715 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2716 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2717 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2718 | { |
| 2719 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2720 | .name = "Channel Mode", |
| 2721 | .info = alc_ch_mode_info, |
| 2722 | .get = alc_ch_mode_get, |
| 2723 | .put = alc_ch_mode_put, |
| 2724 | }, |
| 2725 | { } /* end */ |
| 2726 | }; |
| 2727 | |
| 2728 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2729 | /* set capture source to mic-in */ |
| 2730 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2731 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2732 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2733 | /* mute all amp mixer inputs */ |
| 2734 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2735 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2736 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2737 | /* line-in to input */ |
| 2738 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2739 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2740 | /* built-in mic */ |
| 2741 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2742 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2743 | /* speaker-out */ |
| 2744 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2745 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2746 | /* mic-in to input */ |
| 2747 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2748 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2749 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2750 | /* HP-out */ |
| 2751 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2752 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2753 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2754 | /* jack sense */ |
| 2755 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2756 | { } |
| 2757 | }; |
| 2758 | |
| 2759 | /* toggle speaker-output according to the hp-jack state */ |
| 2760 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2761 | { |
| 2762 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2763 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2764 | |
| 2765 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2766 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2767 | bits = present ? HDA_AMP_MUTE : 0; |
| 2768 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2769 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2770 | } |
| 2771 | |
| 2772 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2773 | { |
| 2774 | /* Looks like the unsol event is incompatible with the standard |
| 2775 | * definition. 4bit tag is placed at 28 bit! |
| 2776 | */ |
| 2777 | if ((res >> 28) == 0x01) |
| 2778 | alc880_lg_automute(codec); |
| 2779 | } |
| 2780 | |
| 2781 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2782 | * LG LW20 |
| 2783 | * |
| 2784 | * Pin assignment: |
| 2785 | * Speaker-out: 0x14 |
| 2786 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2787 | * Built-in Mic-In: 0x19 |
| 2788 | * Line-In: 0x1b |
| 2789 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2790 | * SPDIF-Out: 0x1e |
| 2791 | */ |
| 2792 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2793 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2794 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2795 | .items = { |
| 2796 | { "Mic", 0x0 }, |
| 2797 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2798 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2799 | }, |
| 2800 | }; |
| 2801 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2802 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2803 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2804 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2805 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2806 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2807 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2808 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2809 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2810 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2811 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2812 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2813 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2814 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2815 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2816 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2817 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2818 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2819 | { |
| 2820 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2821 | .name = "Channel Mode", |
| 2822 | .info = alc_ch_mode_info, |
| 2823 | .get = alc_ch_mode_get, |
| 2824 | .put = alc_ch_mode_put, |
| 2825 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2826 | { } /* end */ |
| 2827 | }; |
| 2828 | |
| 2829 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2830 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2831 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2832 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2833 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2834 | /* set capture source to mic-in */ |
| 2835 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2836 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2837 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2838 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2839 | /* speaker-out */ |
| 2840 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2841 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2842 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2843 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2844 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2845 | /* mic-in to input */ |
| 2846 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2847 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2848 | /* built-in mic */ |
| 2849 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2850 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2851 | /* jack sense */ |
| 2852 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2853 | { } |
| 2854 | }; |
| 2855 | |
| 2856 | /* toggle speaker-output according to the hp-jack state */ |
| 2857 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2858 | { |
| 2859 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2860 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2861 | |
| 2862 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2863 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2864 | bits = present ? HDA_AMP_MUTE : 0; |
| 2865 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2866 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2867 | } |
| 2868 | |
| 2869 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2870 | { |
| 2871 | /* Looks like the unsol event is incompatible with the standard |
| 2872 | * definition. 4bit tag is placed at 28 bit! |
| 2873 | */ |
| 2874 | if ((res >> 28) == 0x01) |
| 2875 | alc880_lg_lw_automute(codec); |
| 2876 | } |
| 2877 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2878 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2879 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2880 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2881 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2882 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2883 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2884 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2885 | { } /* end */ |
| 2886 | }; |
| 2887 | |
| 2888 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2889 | .num_items = 2, |
| 2890 | .items = { |
| 2891 | { "Mic", 0x0 }, |
| 2892 | { "Internal Mic", 0x1 }, |
| 2893 | }, |
| 2894 | }; |
| 2895 | |
| 2896 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2897 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2898 | |
| 2899 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2900 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2901 | |
| 2902 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2903 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2904 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2905 | /* Mic2 (as headphone out) for HP output */ |
| 2906 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2907 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2908 | /* Internal Speaker */ |
| 2909 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2910 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2911 | |
| 2912 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2913 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2914 | |
| 2915 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2916 | { } |
| 2917 | }; |
| 2918 | |
| 2919 | /* toggle speaker-output according to the hp-jack state */ |
| 2920 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2921 | { |
| 2922 | unsigned int present; |
| 2923 | unsigned char bits; |
| 2924 | |
| 2925 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2926 | AC_VERB_GET_PIN_SENSE, 0) |
| 2927 | & AC_PINSENSE_PRESENCE; |
| 2928 | bits = present ? HDA_AMP_MUTE : 0; |
| 2929 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2930 | HDA_AMP_MUTE, bits); |
| 2931 | if (present) |
| 2932 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2933 | else |
| 2934 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2935 | } |
| 2936 | |
| 2937 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2938 | unsigned int res) |
| 2939 | { |
| 2940 | /* Looks like the unsol event is incompatible with the standard |
| 2941 | * definition. 4bit tag is placed at 28 bit! |
| 2942 | */ |
| 2943 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2944 | alc880_medion_rim_automute(codec); |
| 2945 | } |
| 2946 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2947 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2948 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2949 | { 0x0b, HDA_INPUT, 0 }, |
| 2950 | { 0x0b, HDA_INPUT, 1 }, |
| 2951 | { 0x0b, HDA_INPUT, 2 }, |
| 2952 | { 0x0b, HDA_INPUT, 3 }, |
| 2953 | { 0x0b, HDA_INPUT, 4 }, |
| 2954 | { } /* end */ |
| 2955 | }; |
| 2956 | |
| 2957 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2958 | { 0x0b, HDA_INPUT, 1 }, |
| 2959 | { 0x0b, HDA_INPUT, 6 }, |
| 2960 | { 0x0b, HDA_INPUT, 7 }, |
| 2961 | { } /* end */ |
| 2962 | }; |
| 2963 | #endif |
| 2964 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2965 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2966 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2967 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2968 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2969 | static int alc_init(struct hda_codec *codec) |
| 2970 | { |
| 2971 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2972 | unsigned int i; |
| 2973 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2974 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 2975 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2976 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2977 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2978 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2979 | |
| 2980 | if (spec->init_hook) |
| 2981 | spec->init_hook(codec); |
| 2982 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2983 | return 0; |
| 2984 | } |
| 2985 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2986 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2987 | { |
| 2988 | struct alc_spec *spec = codec->spec; |
| 2989 | |
| 2990 | if (spec->unsol_event) |
| 2991 | spec->unsol_event(codec, res); |
| 2992 | } |
| 2993 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2994 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2995 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2996 | { |
| 2997 | struct alc_spec *spec = codec->spec; |
| 2998 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2999 | } |
| 3000 | #endif |
| 3001 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3002 | /* |
| 3003 | * Analog playback callbacks |
| 3004 | */ |
| 3005 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3006 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3007 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3008 | { |
| 3009 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3010 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3011 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3012 | } |
| 3013 | |
| 3014 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3015 | struct hda_codec *codec, |
| 3016 | unsigned int stream_tag, |
| 3017 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3018 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3019 | { |
| 3020 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3021 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3022 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3023 | } |
| 3024 | |
| 3025 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3026 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3027 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3028 | { |
| 3029 | struct alc_spec *spec = codec->spec; |
| 3030 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3031 | } |
| 3032 | |
| 3033 | /* |
| 3034 | * Digital out |
| 3035 | */ |
| 3036 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3037 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3038 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3039 | { |
| 3040 | struct alc_spec *spec = codec->spec; |
| 3041 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3042 | } |
| 3043 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3044 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3045 | struct hda_codec *codec, |
| 3046 | unsigned int stream_tag, |
| 3047 | unsigned int format, |
| 3048 | struct snd_pcm_substream *substream) |
| 3049 | { |
| 3050 | struct alc_spec *spec = codec->spec; |
| 3051 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3052 | stream_tag, format, substream); |
| 3053 | } |
| 3054 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3055 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3056 | struct hda_codec *codec, |
| 3057 | struct snd_pcm_substream *substream) |
| 3058 | { |
| 3059 | struct alc_spec *spec = codec->spec; |
| 3060 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3061 | } |
| 3062 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3063 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3064 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3065 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3066 | { |
| 3067 | struct alc_spec *spec = codec->spec; |
| 3068 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3069 | } |
| 3070 | |
| 3071 | /* |
| 3072 | * Analog capture |
| 3073 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3074 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3075 | struct hda_codec *codec, |
| 3076 | unsigned int stream_tag, |
| 3077 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3078 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3079 | { |
| 3080 | struct alc_spec *spec = codec->spec; |
| 3081 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3082 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3083 | stream_tag, 0, format); |
| 3084 | return 0; |
| 3085 | } |
| 3086 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3087 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3088 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3089 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3090 | { |
| 3091 | struct alc_spec *spec = codec->spec; |
| 3092 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3093 | snd_hda_codec_cleanup_stream(codec, |
| 3094 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3095 | return 0; |
| 3096 | } |
| 3097 | |
| 3098 | |
| 3099 | /* |
| 3100 | */ |
| 3101 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3102 | .substreams = 1, |
| 3103 | .channels_min = 2, |
| 3104 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3105 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3106 | .ops = { |
| 3107 | .open = alc880_playback_pcm_open, |
| 3108 | .prepare = alc880_playback_pcm_prepare, |
| 3109 | .cleanup = alc880_playback_pcm_cleanup |
| 3110 | }, |
| 3111 | }; |
| 3112 | |
| 3113 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3114 | .substreams = 1, |
| 3115 | .channels_min = 2, |
| 3116 | .channels_max = 2, |
| 3117 | /* NID is set in alc_build_pcms */ |
| 3118 | }; |
| 3119 | |
| 3120 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3121 | .substreams = 1, |
| 3122 | .channels_min = 2, |
| 3123 | .channels_max = 2, |
| 3124 | /* NID is set in alc_build_pcms */ |
| 3125 | }; |
| 3126 | |
| 3127 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3128 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3129 | .channels_min = 2, |
| 3130 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3131 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3132 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3133 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3134 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3135 | }, |
| 3136 | }; |
| 3137 | |
| 3138 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3139 | .substreams = 1, |
| 3140 | .channels_min = 2, |
| 3141 | .channels_max = 2, |
| 3142 | /* NID is set in alc_build_pcms */ |
| 3143 | .ops = { |
| 3144 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3145 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3146 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3147 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3148 | }, |
| 3149 | }; |
| 3150 | |
| 3151 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3152 | .substreams = 1, |
| 3153 | .channels_min = 2, |
| 3154 | .channels_max = 2, |
| 3155 | /* NID is set in alc_build_pcms */ |
| 3156 | }; |
| 3157 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3158 | /* 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] | 3159 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3160 | .substreams = 0, |
| 3161 | .channels_min = 0, |
| 3162 | .channels_max = 0, |
| 3163 | }; |
| 3164 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3165 | static int alc_build_pcms(struct hda_codec *codec) |
| 3166 | { |
| 3167 | struct alc_spec *spec = codec->spec; |
| 3168 | struct hda_pcm *info = spec->pcm_rec; |
| 3169 | int i; |
| 3170 | |
| 3171 | codec->num_pcms = 1; |
| 3172 | codec->pcm_info = info; |
| 3173 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3174 | if (spec->no_analog) |
| 3175 | goto skip_analog; |
| 3176 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3177 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3178 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3179 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3180 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3181 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3182 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3183 | } |
| 3184 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3185 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3186 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3187 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3188 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3189 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3190 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3191 | if (spec->channel_mode) { |
| 3192 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3193 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3194 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3195 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3196 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3197 | } |
| 3198 | } |
| 3199 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3200 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3201 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3202 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3203 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3204 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3205 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3206 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3207 | if (spec->dig_out_type) |
| 3208 | info->pcm_type = spec->dig_out_type; |
| 3209 | else |
| 3210 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3211 | if (spec->multiout.dig_out_nid && |
| 3212 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3213 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3214 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3215 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3216 | if (spec->dig_in_nid && |
| 3217 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3218 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3219 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3220 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3221 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3222 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3223 | } |
| 3224 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3225 | if (spec->no_analog) |
| 3226 | return 0; |
| 3227 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3228 | /* If the use of more than one ADC is requested for the current |
| 3229 | * model, configure a second analog capture-only PCM. |
| 3230 | */ |
| 3231 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3232 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3233 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3234 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3235 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3236 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3237 | if (spec->alt_dac_nid) { |
| 3238 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3239 | *spec->stream_analog_alt_playback; |
| 3240 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3241 | spec->alt_dac_nid; |
| 3242 | } else { |
| 3243 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3244 | alc_pcm_null_stream; |
| 3245 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3246 | } |
| 3247 | if (spec->num_adc_nids > 1) { |
| 3248 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3249 | *spec->stream_analog_alt_capture; |
| 3250 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3251 | spec->adc_nids[1]; |
| 3252 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3253 | spec->num_adc_nids - 1; |
| 3254 | } else { |
| 3255 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3256 | alc_pcm_null_stream; |
| 3257 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3258 | } |
| 3259 | } |
| 3260 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3261 | return 0; |
| 3262 | } |
| 3263 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3264 | static void alc_free_kctls(struct hda_codec *codec) |
| 3265 | { |
| 3266 | struct alc_spec *spec = codec->spec; |
| 3267 | |
| 3268 | if (spec->kctls.list) { |
| 3269 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3270 | int i; |
| 3271 | for (i = 0; i < spec->kctls.used; i++) |
| 3272 | kfree(kctl[i].name); |
| 3273 | } |
| 3274 | snd_array_free(&spec->kctls); |
| 3275 | } |
| 3276 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3277 | static void alc_free(struct hda_codec *codec) |
| 3278 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3279 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3280 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3281 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3282 | return; |
| 3283 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3284 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3285 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3286 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3287 | } |
| 3288 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3289 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3290 | static int alc_resume(struct hda_codec *codec) |
| 3291 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3292 | codec->patch_ops.init(codec); |
| 3293 | snd_hda_codec_resume_amp(codec); |
| 3294 | snd_hda_codec_resume_cache(codec); |
| 3295 | return 0; |
| 3296 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3297 | #endif |
| 3298 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3299 | /* |
| 3300 | */ |
| 3301 | static struct hda_codec_ops alc_patch_ops = { |
| 3302 | .build_controls = alc_build_controls, |
| 3303 | .build_pcms = alc_build_pcms, |
| 3304 | .init = alc_init, |
| 3305 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3306 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3307 | #ifdef SND_HDA_NEEDS_RESUME |
| 3308 | .resume = alc_resume, |
| 3309 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3310 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3311 | .check_power_status = alc_check_power_status, |
| 3312 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3313 | }; |
| 3314 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3315 | |
| 3316 | /* |
| 3317 | * Test configuration for debugging |
| 3318 | * |
| 3319 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3320 | * enum controls. |
| 3321 | */ |
| 3322 | #ifdef CONFIG_SND_DEBUG |
| 3323 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3324 | 0x02, 0x03, 0x04, 0x05 |
| 3325 | }; |
| 3326 | |
| 3327 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3328 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3329 | .items = { |
| 3330 | { "In-1", 0x0 }, |
| 3331 | { "In-2", 0x1 }, |
| 3332 | { "In-3", 0x2 }, |
| 3333 | { "In-4", 0x3 }, |
| 3334 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3335 | { "Front", 0x5 }, |
| 3336 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3337 | }, |
| 3338 | }; |
| 3339 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3340 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3341 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3342 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3343 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3344 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3345 | }; |
| 3346 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3347 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3348 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3349 | { |
| 3350 | static char *texts[] = { |
| 3351 | "N/A", "Line Out", "HP Out", |
| 3352 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3353 | }; |
| 3354 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3355 | uinfo->count = 1; |
| 3356 | uinfo->value.enumerated.items = 8; |
| 3357 | if (uinfo->value.enumerated.item >= 8) |
| 3358 | uinfo->value.enumerated.item = 7; |
| 3359 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3360 | return 0; |
| 3361 | } |
| 3362 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3363 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3364 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3365 | { |
| 3366 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3367 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3368 | unsigned int pin_ctl, item = 0; |
| 3369 | |
| 3370 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3371 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3372 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3373 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3374 | item = 2; |
| 3375 | else |
| 3376 | item = 1; |
| 3377 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3378 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3379 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3380 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3381 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3382 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3383 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3384 | } |
| 3385 | } |
| 3386 | ucontrol->value.enumerated.item[0] = item; |
| 3387 | return 0; |
| 3388 | } |
| 3389 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3390 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3391 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3392 | { |
| 3393 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3394 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3395 | static unsigned int ctls[] = { |
| 3396 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3397 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3398 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3399 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3400 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3401 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3402 | }; |
| 3403 | unsigned int old_ctl, new_ctl; |
| 3404 | |
| 3405 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3406 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3407 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3408 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3409 | int val; |
| 3410 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3411 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3412 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3413 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3414 | HDA_AMP_MUTE : 0; |
| 3415 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3416 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3417 | return 1; |
| 3418 | } |
| 3419 | return 0; |
| 3420 | } |
| 3421 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3422 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3423 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3424 | { |
| 3425 | static char *texts[] = { |
| 3426 | "Front", "Surround", "CLFE", "Side" |
| 3427 | }; |
| 3428 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3429 | uinfo->count = 1; |
| 3430 | uinfo->value.enumerated.items = 4; |
| 3431 | if (uinfo->value.enumerated.item >= 4) |
| 3432 | uinfo->value.enumerated.item = 3; |
| 3433 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3434 | return 0; |
| 3435 | } |
| 3436 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3437 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3438 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3439 | { |
| 3440 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3441 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3442 | unsigned int sel; |
| 3443 | |
| 3444 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3445 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3446 | return 0; |
| 3447 | } |
| 3448 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3449 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3450 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3451 | { |
| 3452 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3453 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3454 | unsigned int sel; |
| 3455 | |
| 3456 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3457 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3458 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3459 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3460 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3461 | return 1; |
| 3462 | } |
| 3463 | return 0; |
| 3464 | } |
| 3465 | |
| 3466 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3467 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3468 | .name = xname, \ |
| 3469 | .info = alc_test_pin_ctl_info, \ |
| 3470 | .get = alc_test_pin_ctl_get, \ |
| 3471 | .put = alc_test_pin_ctl_put, \ |
| 3472 | .private_value = nid \ |
| 3473 | } |
| 3474 | |
| 3475 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3476 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3477 | .name = xname, \ |
| 3478 | .info = alc_test_pin_src_info, \ |
| 3479 | .get = alc_test_pin_src_get, \ |
| 3480 | .put = alc_test_pin_src_put, \ |
| 3481 | .private_value = nid \ |
| 3482 | } |
| 3483 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3484 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3485 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3486 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3487 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3488 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3489 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3490 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3491 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3492 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3493 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3494 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3495 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3496 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3497 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3498 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3499 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3500 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3501 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3502 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3503 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3504 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3505 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3506 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3507 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3508 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3509 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3510 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3511 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3512 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3513 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3514 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3515 | { |
| 3516 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3517 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3518 | .info = alc_ch_mode_info, |
| 3519 | .get = alc_ch_mode_get, |
| 3520 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3521 | }, |
| 3522 | { } /* end */ |
| 3523 | }; |
| 3524 | |
| 3525 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3526 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3527 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3528 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3529 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3530 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3531 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3532 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3533 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3534 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3535 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3536 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3537 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3538 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3539 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3540 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3541 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3542 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3543 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3544 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3545 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3546 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3547 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3548 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3549 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3550 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3551 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3552 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3553 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3554 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3555 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3556 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3557 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3558 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3559 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3560 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3561 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3562 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3563 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3564 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3565 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3566 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3567 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3568 | /* Analog input/passthru */ |
| 3569 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3570 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3571 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3572 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3573 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3574 | { } |
| 3575 | }; |
| 3576 | #endif |
| 3577 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3578 | /* |
| 3579 | */ |
| 3580 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3581 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3582 | [ALC880_3ST] = "3stack", |
| 3583 | [ALC880_TCL_S700] = "tcl", |
| 3584 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3585 | [ALC880_CLEVO] = "clevo", |
| 3586 | [ALC880_5ST] = "5stack", |
| 3587 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3588 | [ALC880_W810] = "w810", |
| 3589 | [ALC880_Z71V] = "z71v", |
| 3590 | [ALC880_6ST] = "6stack", |
| 3591 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3592 | [ALC880_ASUS] = "asus", |
| 3593 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3594 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3595 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3596 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3597 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3598 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3599 | [ALC880_F1734] = "F1734", |
| 3600 | [ALC880_LG] = "lg", |
| 3601 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3602 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3603 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3604 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3605 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3606 | [ALC880_AUTO] = "auto", |
| 3607 | }; |
| 3608 | |
| 3609 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3610 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3611 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3612 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3613 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3614 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3615 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3616 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3617 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3618 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3619 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3620 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3621 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3622 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3623 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3624 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3625 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3626 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3627 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3628 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3629 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3630 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3631 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3632 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3633 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3634 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3635 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3636 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3637 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3638 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3639 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3640 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3641 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3642 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3643 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3644 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3645 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3646 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3647 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3648 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3649 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3650 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3651 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3652 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3653 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3654 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3655 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3656 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3657 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3658 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3659 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3660 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3661 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3662 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3663 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3664 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3665 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3666 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3667 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3668 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3669 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3670 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3671 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3672 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3673 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3674 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3675 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3676 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3677 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3678 | /* default Intel */ |
| 3679 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3680 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3681 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3682 | {} |
| 3683 | }; |
| 3684 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3685 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3686 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3687 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3688 | static struct alc_config_preset alc880_presets[] = { |
| 3689 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3690 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3691 | .init_verbs = { alc880_volume_init_verbs, |
| 3692 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3693 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3694 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3695 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3696 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3697 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3698 | .input_mux = &alc880_capture_source, |
| 3699 | }, |
| 3700 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3701 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3702 | .init_verbs = { alc880_volume_init_verbs, |
| 3703 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3704 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3705 | .dac_nids = alc880_dac_nids, |
| 3706 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3707 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3708 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3709 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3710 | .input_mux = &alc880_capture_source, |
| 3711 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3712 | [ALC880_TCL_S700] = { |
| 3713 | .mixers = { alc880_tcl_s700_mixer }, |
| 3714 | .init_verbs = { alc880_volume_init_verbs, |
| 3715 | alc880_pin_tcl_S700_init_verbs, |
| 3716 | alc880_gpio2_init_verbs }, |
| 3717 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3718 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3719 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3720 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3721 | .hp_nid = 0x03, |
| 3722 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3723 | .channel_mode = alc880_2_jack_modes, |
| 3724 | .input_mux = &alc880_capture_source, |
| 3725 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3726 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3727 | .mixers = { alc880_three_stack_mixer, |
| 3728 | alc880_five_stack_mixer}, |
| 3729 | .init_verbs = { alc880_volume_init_verbs, |
| 3730 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3731 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3732 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3733 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3734 | .channel_mode = alc880_fivestack_modes, |
| 3735 | .input_mux = &alc880_capture_source, |
| 3736 | }, |
| 3737 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3738 | .mixers = { alc880_three_stack_mixer, |
| 3739 | alc880_five_stack_mixer }, |
| 3740 | .init_verbs = { alc880_volume_init_verbs, |
| 3741 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3742 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3743 | .dac_nids = alc880_dac_nids, |
| 3744 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3745 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3746 | .channel_mode = alc880_fivestack_modes, |
| 3747 | .input_mux = &alc880_capture_source, |
| 3748 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3749 | [ALC880_6ST] = { |
| 3750 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3751 | .init_verbs = { alc880_volume_init_verbs, |
| 3752 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3753 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3754 | .dac_nids = alc880_6st_dac_nids, |
| 3755 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3756 | .channel_mode = alc880_sixstack_modes, |
| 3757 | .input_mux = &alc880_6stack_capture_source, |
| 3758 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3759 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3760 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3761 | .init_verbs = { alc880_volume_init_verbs, |
| 3762 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3763 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3764 | .dac_nids = alc880_6st_dac_nids, |
| 3765 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3766 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3767 | .channel_mode = alc880_sixstack_modes, |
| 3768 | .input_mux = &alc880_6stack_capture_source, |
| 3769 | }, |
| 3770 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3771 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3772 | .init_verbs = { alc880_volume_init_verbs, |
| 3773 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3774 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3775 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3776 | .dac_nids = alc880_w810_dac_nids, |
| 3777 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3778 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3779 | .channel_mode = alc880_w810_modes, |
| 3780 | .input_mux = &alc880_capture_source, |
| 3781 | }, |
| 3782 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3783 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3784 | .init_verbs = { alc880_volume_init_verbs, |
| 3785 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3786 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3787 | .dac_nids = alc880_z71v_dac_nids, |
| 3788 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3789 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3790 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3791 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3792 | .input_mux = &alc880_capture_source, |
| 3793 | }, |
| 3794 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3795 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3796 | .init_verbs = { alc880_volume_init_verbs, |
| 3797 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3798 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3799 | .dac_nids = alc880_f1734_dac_nids, |
| 3800 | .hp_nid = 0x02, |
| 3801 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3802 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3803 | .input_mux = &alc880_f1734_capture_source, |
| 3804 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3805 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3806 | }, |
| 3807 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3808 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3809 | .init_verbs = { alc880_volume_init_verbs, |
| 3810 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3811 | alc880_gpio1_init_verbs }, |
| 3812 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3813 | .dac_nids = alc880_asus_dac_nids, |
| 3814 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3815 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3816 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3817 | .input_mux = &alc880_capture_source, |
| 3818 | }, |
| 3819 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3820 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3821 | .init_verbs = { alc880_volume_init_verbs, |
| 3822 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3823 | alc880_gpio1_init_verbs }, |
| 3824 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3825 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3826 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3827 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3828 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3829 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3830 | .input_mux = &alc880_capture_source, |
| 3831 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3832 | [ALC880_ASUS_DIG2] = { |
| 3833 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3834 | .init_verbs = { alc880_volume_init_verbs, |
| 3835 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3836 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3837 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3838 | .dac_nids = alc880_asus_dac_nids, |
| 3839 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3840 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3841 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3842 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3843 | .input_mux = &alc880_capture_source, |
| 3844 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3845 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3846 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3847 | .init_verbs = { alc880_volume_init_verbs, |
| 3848 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3849 | alc880_gpio1_init_verbs }, |
| 3850 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3851 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3852 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3853 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3854 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3855 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3856 | .input_mux = &alc880_capture_source, |
| 3857 | }, |
| 3858 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3859 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3860 | .init_verbs = { alc880_volume_init_verbs, |
| 3861 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3862 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3863 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3864 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3865 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3866 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3867 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3868 | .input_mux = &alc880_capture_source, |
| 3869 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3870 | [ALC880_UNIWILL] = { |
| 3871 | .mixers = { alc880_uniwill_mixer }, |
| 3872 | .init_verbs = { alc880_volume_init_verbs, |
| 3873 | alc880_uniwill_init_verbs }, |
| 3874 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3875 | .dac_nids = alc880_asus_dac_nids, |
| 3876 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3877 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3878 | .channel_mode = alc880_threestack_modes, |
| 3879 | .need_dac_fix = 1, |
| 3880 | .input_mux = &alc880_capture_source, |
| 3881 | .unsol_event = alc880_uniwill_unsol_event, |
| 3882 | .init_hook = alc880_uniwill_automute, |
| 3883 | }, |
| 3884 | [ALC880_UNIWILL_P53] = { |
| 3885 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3886 | .init_verbs = { alc880_volume_init_verbs, |
| 3887 | alc880_uniwill_p53_init_verbs }, |
| 3888 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3889 | .dac_nids = alc880_asus_dac_nids, |
| 3890 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3891 | .channel_mode = alc880_threestack_modes, |
| 3892 | .input_mux = &alc880_capture_source, |
| 3893 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3894 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3895 | }, |
| 3896 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3897 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3898 | .init_verbs = { alc880_volume_init_verbs, |
| 3899 | alc880_uniwill_p53_init_verbs, |
| 3900 | alc880_beep_init_verbs }, |
| 3901 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3902 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3903 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3904 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3905 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3906 | .input_mux = &alc880_capture_source, |
| 3907 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3908 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3909 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3910 | [ALC880_CLEVO] = { |
| 3911 | .mixers = { alc880_three_stack_mixer }, |
| 3912 | .init_verbs = { alc880_volume_init_verbs, |
| 3913 | alc880_pin_clevo_init_verbs }, |
| 3914 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3915 | .dac_nids = alc880_dac_nids, |
| 3916 | .hp_nid = 0x03, |
| 3917 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3918 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3919 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3920 | .input_mux = &alc880_capture_source, |
| 3921 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3922 | [ALC880_LG] = { |
| 3923 | .mixers = { alc880_lg_mixer }, |
| 3924 | .init_verbs = { alc880_volume_init_verbs, |
| 3925 | alc880_lg_init_verbs }, |
| 3926 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3927 | .dac_nids = alc880_lg_dac_nids, |
| 3928 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3929 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3930 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3931 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3932 | .input_mux = &alc880_lg_capture_source, |
| 3933 | .unsol_event = alc880_lg_unsol_event, |
| 3934 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3935 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3936 | .loopbacks = alc880_lg_loopbacks, |
| 3937 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3938 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3939 | [ALC880_LG_LW] = { |
| 3940 | .mixers = { alc880_lg_lw_mixer }, |
| 3941 | .init_verbs = { alc880_volume_init_verbs, |
| 3942 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3943 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3944 | .dac_nids = alc880_dac_nids, |
| 3945 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3946 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3947 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3948 | .input_mux = &alc880_lg_lw_capture_source, |
| 3949 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3950 | .init_hook = alc880_lg_lw_automute, |
| 3951 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3952 | [ALC880_MEDION_RIM] = { |
| 3953 | .mixers = { alc880_medion_rim_mixer }, |
| 3954 | .init_verbs = { alc880_volume_init_verbs, |
| 3955 | alc880_medion_rim_init_verbs, |
| 3956 | alc_gpio2_init_verbs }, |
| 3957 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3958 | .dac_nids = alc880_dac_nids, |
| 3959 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3960 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3961 | .channel_mode = alc880_2_jack_modes, |
| 3962 | .input_mux = &alc880_medion_rim_capture_source, |
| 3963 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3964 | .init_hook = alc880_medion_rim_automute, |
| 3965 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3966 | #ifdef CONFIG_SND_DEBUG |
| 3967 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3968 | .mixers = { alc880_test_mixer }, |
| 3969 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3970 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3971 | .dac_nids = alc880_test_dac_nids, |
| 3972 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3973 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3974 | .channel_mode = alc880_test_modes, |
| 3975 | .input_mux = &alc880_test_capture_source, |
| 3976 | }, |
| 3977 | #endif |
| 3978 | }; |
| 3979 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3980 | /* |
| 3981 | * Automatic parse of I/O pins from the BIOS configuration |
| 3982 | */ |
| 3983 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3984 | enum { |
| 3985 | ALC_CTL_WIDGET_VOL, |
| 3986 | ALC_CTL_WIDGET_MUTE, |
| 3987 | ALC_CTL_BIND_MUTE, |
| 3988 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3989 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3990 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3991 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3992 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3993 | }; |
| 3994 | |
| 3995 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3996 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3997 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3998 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3999 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4000 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4001 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4002 | knew = snd_array_new(&spec->kctls); |
| 4003 | if (!knew) |
| 4004 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4005 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4006 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4007 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4008 | return -ENOMEM; |
| 4009 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4010 | return 0; |
| 4011 | } |
| 4012 | |
| 4013 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4014 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4015 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4016 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4017 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4018 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4019 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4020 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4021 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4022 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4023 | #define ALC880_PIN_CD_NID 0x1c |
| 4024 | |
| 4025 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4026 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4027 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4028 | { |
| 4029 | hda_nid_t nid; |
| 4030 | int assigned[4]; |
| 4031 | int i, j; |
| 4032 | |
| 4033 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4034 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4035 | |
| 4036 | /* check the pins hardwired to audio widget */ |
| 4037 | for (i = 0; i < cfg->line_outs; i++) { |
| 4038 | nid = cfg->line_out_pins[i]; |
| 4039 | if (alc880_is_fixed_pin(nid)) { |
| 4040 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4041 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4042 | assigned[idx] = 1; |
| 4043 | } |
| 4044 | } |
| 4045 | /* left pins can be connect to any audio widget */ |
| 4046 | for (i = 0; i < cfg->line_outs; i++) { |
| 4047 | nid = cfg->line_out_pins[i]; |
| 4048 | if (alc880_is_fixed_pin(nid)) |
| 4049 | continue; |
| 4050 | /* search for an empty channel */ |
| 4051 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4052 | if (!assigned[j]) { |
| 4053 | spec->multiout.dac_nids[i] = |
| 4054 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4055 | assigned[j] = 1; |
| 4056 | break; |
| 4057 | } |
| 4058 | } |
| 4059 | } |
| 4060 | spec->multiout.num_dacs = cfg->line_outs; |
| 4061 | return 0; |
| 4062 | } |
| 4063 | |
| 4064 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4065 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4066 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4067 | { |
| 4068 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4069 | static const char *chname[4] = { |
| 4070 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4071 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4072 | hda_nid_t nid; |
| 4073 | int i, err; |
| 4074 | |
| 4075 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4076 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4077 | continue; |
| 4078 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4079 | if (i == 2) { |
| 4080 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4081 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4082 | "Center Playback Volume", |
| 4083 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4084 | HDA_OUTPUT)); |
| 4085 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4086 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4087 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4088 | "LFE Playback Volume", |
| 4089 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4090 | HDA_OUTPUT)); |
| 4091 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4092 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4093 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4094 | "Center Playback Switch", |
| 4095 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4096 | HDA_INPUT)); |
| 4097 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4098 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4099 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4100 | "LFE Playback Switch", |
| 4101 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4102 | HDA_INPUT)); |
| 4103 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4104 | return err; |
| 4105 | } else { |
| 4106 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4107 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4108 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4109 | HDA_OUTPUT)); |
| 4110 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4111 | return err; |
| 4112 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4113 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4114 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4115 | HDA_INPUT)); |
| 4116 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4117 | return err; |
| 4118 | } |
| 4119 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4120 | return 0; |
| 4121 | } |
| 4122 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4123 | /* add playback controls for speaker and HP outputs */ |
| 4124 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4125 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4126 | { |
| 4127 | hda_nid_t nid; |
| 4128 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4129 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4130 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4131 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4132 | return 0; |
| 4133 | |
| 4134 | if (alc880_is_fixed_pin(pin)) { |
| 4135 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4136 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4137 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4138 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4139 | else |
| 4140 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4141 | /* control HP volume/switch on the output mixer amp */ |
| 4142 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4143 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4144 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4145 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4146 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4147 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4148 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4149 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4150 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4151 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4152 | return err; |
| 4153 | } else if (alc880_is_multi_pin(pin)) { |
| 4154 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4155 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4156 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4157 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4158 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4159 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4160 | return err; |
| 4161 | } |
| 4162 | return 0; |
| 4163 | } |
| 4164 | |
| 4165 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4166 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4167 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4168 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4169 | { |
| 4170 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4171 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4172 | |
| 4173 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4174 | err = add_control(spec, ALC_CTL_WIDGET_VOL, 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 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4179 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4180 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4181 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4182 | return err; |
| 4183 | return 0; |
| 4184 | } |
| 4185 | |
| 4186 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4187 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4188 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4189 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4190 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4191 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4192 | |
| 4193 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4194 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4195 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4196 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4197 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4198 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4199 | if (err < 0) |
| 4200 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4201 | imux->items[imux->num_items].label = |
| 4202 | auto_pin_cfg_labels[i]; |
| 4203 | imux->items[imux->num_items].index = |
| 4204 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4205 | imux->num_items++; |
| 4206 | } |
| 4207 | } |
| 4208 | return 0; |
| 4209 | } |
| 4210 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4211 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4212 | unsigned int pin_type) |
| 4213 | { |
| 4214 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4215 | pin_type); |
| 4216 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4217 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4218 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4219 | } |
| 4220 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4221 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4222 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4223 | int dac_idx) |
| 4224 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4225 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4226 | /* need the manual connection? */ |
| 4227 | if (alc880_is_multi_pin(nid)) { |
| 4228 | struct alc_spec *spec = codec->spec; |
| 4229 | int idx = alc880_multi_pin_idx(nid); |
| 4230 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4231 | AC_VERB_SET_CONNECT_SEL, |
| 4232 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4233 | } |
| 4234 | } |
| 4235 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4236 | static int get_pin_type(int line_out_type) |
| 4237 | { |
| 4238 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4239 | return PIN_HP; |
| 4240 | else |
| 4241 | return PIN_OUT; |
| 4242 | } |
| 4243 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4244 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4245 | { |
| 4246 | struct alc_spec *spec = codec->spec; |
| 4247 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4248 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4249 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4250 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4251 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4252 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4253 | } |
| 4254 | } |
| 4255 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4256 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4257 | { |
| 4258 | struct alc_spec *spec = codec->spec; |
| 4259 | hda_nid_t pin; |
| 4260 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4261 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4262 | if (pin) /* connect to front */ |
| 4263 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4264 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4265 | if (pin) /* connect to front */ |
| 4266 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4267 | } |
| 4268 | |
| 4269 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4270 | { |
| 4271 | struct alc_spec *spec = codec->spec; |
| 4272 | int i; |
| 4273 | |
| 4274 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4275 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4276 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4277 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4278 | if (nid != ALC880_PIN_CD_NID && |
| 4279 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4280 | snd_hda_codec_write(codec, nid, 0, |
| 4281 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4282 | AMP_OUT_MUTE); |
| 4283 | } |
| 4284 | } |
| 4285 | } |
| 4286 | |
| 4287 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4288 | /* return 1 if successful, 0 if the proper config is not found, |
| 4289 | * or a negative error code |
| 4290 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4291 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4292 | { |
| 4293 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4294 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4295 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4296 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4297 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4298 | alc880_ignore); |
| 4299 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4300 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4301 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4302 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4303 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4304 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4305 | if (err < 0) |
| 4306 | return err; |
| 4307 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4308 | if (err < 0) |
| 4309 | return err; |
| 4310 | err = alc880_auto_create_extra_out(spec, |
| 4311 | spec->autocfg.speaker_pins[0], |
| 4312 | "Speaker"); |
| 4313 | if (err < 0) |
| 4314 | return err; |
| 4315 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4316 | "Headphone"); |
| 4317 | if (err < 0) |
| 4318 | return err; |
| 4319 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4320 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4321 | return err; |
| 4322 | |
| 4323 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4324 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4325 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4326 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4327 | hda_nid_t dig_nid; |
| 4328 | err = snd_hda_get_connections(codec, |
| 4329 | spec->autocfg.dig_out_pins[i], |
| 4330 | &dig_nid, 1); |
| 4331 | if (err < 0) |
| 4332 | continue; |
| 4333 | if (!i) |
| 4334 | spec->multiout.dig_out_nid = dig_nid; |
| 4335 | else { |
| 4336 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4337 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4338 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4339 | break; |
| 4340 | } |
| 4341 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4342 | if (spec->autocfg.dig_in_pin) |
| 4343 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4344 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4345 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4346 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4347 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4348 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4349 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4350 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4351 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4352 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4353 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4354 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4355 | return 1; |
| 4356 | } |
| 4357 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4358 | /* additional initialization for auto-configuration model */ |
| 4359 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4360 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4361 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4362 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4363 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4364 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4365 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4366 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4367 | } |
| 4368 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4369 | static void set_capture_mixer(struct alc_spec *spec) |
| 4370 | { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4371 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4372 | { alc_capture_mixer_nosrc1, |
| 4373 | alc_capture_mixer_nosrc2, |
| 4374 | alc_capture_mixer_nosrc3 }, |
| 4375 | { alc_capture_mixer1, |
| 4376 | alc_capture_mixer2, |
| 4377 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4378 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4379 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4380 | int mux; |
| 4381 | if (spec->input_mux && spec->input_mux->num_items > 1) |
| 4382 | mux = 1; |
| 4383 | else |
| 4384 | mux = 0; |
| 4385 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4386 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4387 | } |
| 4388 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4389 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4390 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4391 | |
| 4392 | /* |
| 4393 | * OK, here we have finally the patch for ALC880 |
| 4394 | */ |
| 4395 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4396 | static int patch_alc880(struct hda_codec *codec) |
| 4397 | { |
| 4398 | struct alc_spec *spec; |
| 4399 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4400 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4401 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4402 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4403 | if (spec == NULL) |
| 4404 | return -ENOMEM; |
| 4405 | |
| 4406 | codec->spec = spec; |
| 4407 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4408 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4409 | alc880_models, |
| 4410 | alc880_cfg_tbl); |
| 4411 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4412 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 4413 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4414 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4415 | } |
| 4416 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4417 | if (board_config == ALC880_AUTO) { |
| 4418 | /* automatic parse from the BIOS config */ |
| 4419 | err = alc880_parse_auto_config(codec); |
| 4420 | if (err < 0) { |
| 4421 | alc_free(codec); |
| 4422 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4423 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4424 | printk(KERN_INFO |
| 4425 | "hda_codec: Cannot set up configuration " |
| 4426 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4427 | board_config = ALC880_3ST; |
| 4428 | } |
| 4429 | } |
| 4430 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4431 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4432 | if (err < 0) { |
| 4433 | alc_free(codec); |
| 4434 | return err; |
| 4435 | } |
| 4436 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4437 | if (board_config != ALC880_AUTO) |
| 4438 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4439 | |
| 4440 | spec->stream_name_analog = "ALC880 Analog"; |
| 4441 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4442 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4443 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4444 | |
| 4445 | spec->stream_name_digital = "ALC880 Digital"; |
| 4446 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4447 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4448 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4449 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4450 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4451 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4452 | /* get type */ |
| 4453 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4454 | if (wcap != AC_WID_AUD_IN) { |
| 4455 | spec->adc_nids = alc880_adc_nids_alt; |
| 4456 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4457 | } else { |
| 4458 | spec->adc_nids = alc880_adc_nids; |
| 4459 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4460 | } |
| 4461 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4462 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4463 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4464 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4465 | spec->vmaster_nid = 0x0c; |
| 4466 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4467 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4468 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4469 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4470 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4471 | if (!spec->loopback.amplist) |
| 4472 | spec->loopback.amplist = alc880_loopbacks; |
| 4473 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4474 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4475 | |
| 4476 | return 0; |
| 4477 | } |
| 4478 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4479 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4480 | /* |
| 4481 | * ALC260 support |
| 4482 | */ |
| 4483 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4484 | static hda_nid_t alc260_dac_nids[1] = { |
| 4485 | /* front */ |
| 4486 | 0x02, |
| 4487 | }; |
| 4488 | |
| 4489 | static hda_nid_t alc260_adc_nids[1] = { |
| 4490 | /* ADC0 */ |
| 4491 | 0x04, |
| 4492 | }; |
| 4493 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4494 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4495 | /* ADC1 */ |
| 4496 | 0x05, |
| 4497 | }; |
| 4498 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4499 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4500 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4501 | */ |
| 4502 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4503 | /* ADC0, ADC1 */ |
| 4504 | 0x04, 0x05 |
| 4505 | }; |
| 4506 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4507 | #define ALC260_DIGOUT_NID 0x03 |
| 4508 | #define ALC260_DIGIN_NID 0x06 |
| 4509 | |
| 4510 | static struct hda_input_mux alc260_capture_source = { |
| 4511 | .num_items = 4, |
| 4512 | .items = { |
| 4513 | { "Mic", 0x0 }, |
| 4514 | { "Front Mic", 0x1 }, |
| 4515 | { "Line", 0x2 }, |
| 4516 | { "CD", 0x4 }, |
| 4517 | }, |
| 4518 | }; |
| 4519 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4520 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4521 | * headphone jack and the internal CD lines since these are the only pins at |
| 4522 | * which audio can appear. For flexibility, also allow the option of |
| 4523 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4524 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4525 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4526 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4527 | { |
| 4528 | .num_items = 3, |
| 4529 | .items = { |
| 4530 | { "Mic/Line", 0x0 }, |
| 4531 | { "CD", 0x4 }, |
| 4532 | { "Headphone", 0x2 }, |
| 4533 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4534 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4535 | { |
| 4536 | .num_items = 4, |
| 4537 | .items = { |
| 4538 | { "Mic/Line", 0x0 }, |
| 4539 | { "CD", 0x4 }, |
| 4540 | { "Headphone", 0x2 }, |
| 4541 | { "Mixer", 0x5 }, |
| 4542 | }, |
| 4543 | }, |
| 4544 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4545 | }; |
| 4546 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4547 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4548 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4549 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4550 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4551 | { |
| 4552 | .num_items = 4, |
| 4553 | .items = { |
| 4554 | { "Mic", 0x0 }, |
| 4555 | { "Line", 0x2 }, |
| 4556 | { "CD", 0x4 }, |
| 4557 | { "Headphone", 0x5 }, |
| 4558 | }, |
| 4559 | }, |
| 4560 | { |
| 4561 | .num_items = 5, |
| 4562 | .items = { |
| 4563 | { "Mic", 0x0 }, |
| 4564 | { "Line", 0x2 }, |
| 4565 | { "CD", 0x4 }, |
| 4566 | { "Headphone", 0x6 }, |
| 4567 | { "Mixer", 0x5 }, |
| 4568 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4569 | }, |
| 4570 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4571 | |
| 4572 | /* Maxdata Favorit 100XS */ |
| 4573 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4574 | { |
| 4575 | .num_items = 2, |
| 4576 | .items = { |
| 4577 | { "Line/Mic", 0x0 }, |
| 4578 | { "CD", 0x4 }, |
| 4579 | }, |
| 4580 | }, |
| 4581 | { |
| 4582 | .num_items = 3, |
| 4583 | .items = { |
| 4584 | { "Line/Mic", 0x0 }, |
| 4585 | { "CD", 0x4 }, |
| 4586 | { "Mixer", 0x5 }, |
| 4587 | }, |
| 4588 | }, |
| 4589 | }; |
| 4590 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4591 | /* |
| 4592 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4593 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4594 | * element which allows changing the channel mode, so the verb list is |
| 4595 | * never used. |
| 4596 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4597 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4598 | { 2, NULL }, |
| 4599 | }; |
| 4600 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4601 | |
| 4602 | /* Mixer combinations |
| 4603 | * |
| 4604 | * basic: base_output + input + pc_beep + capture |
| 4605 | * HP: base_output + input + capture_alt |
| 4606 | * HP_3013: hp_3013 + input + capture |
| 4607 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4608 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4609 | */ |
| 4610 | |
| 4611 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4612 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4613 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4614 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4615 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4616 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4617 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4618 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4619 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4620 | |
| 4621 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4622 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4623 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4624 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4625 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4626 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4627 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4628 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4629 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4630 | { } /* end */ |
| 4631 | }; |
| 4632 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4633 | /* update HP, line and mono out pins according to the master switch */ |
| 4634 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4635 | hda_nid_t hp, hda_nid_t line, |
| 4636 | hda_nid_t mono) |
| 4637 | { |
| 4638 | struct alc_spec *spec = codec->spec; |
| 4639 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4640 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4641 | 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] | 4642 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4643 | 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] | 4644 | val); |
| 4645 | /* mono (speaker) depending on the HP jack sense */ |
| 4646 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4647 | 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] | 4648 | val); |
| 4649 | } |
| 4650 | |
| 4651 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4652 | struct snd_ctl_elem_value *ucontrol) |
| 4653 | { |
| 4654 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4655 | struct alc_spec *spec = codec->spec; |
| 4656 | *ucontrol->value.integer.value = spec->master_sw; |
| 4657 | return 0; |
| 4658 | } |
| 4659 | |
| 4660 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4661 | struct snd_ctl_elem_value *ucontrol) |
| 4662 | { |
| 4663 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4664 | struct alc_spec *spec = codec->spec; |
| 4665 | int val = !!*ucontrol->value.integer.value; |
| 4666 | hda_nid_t hp, line, mono; |
| 4667 | |
| 4668 | if (val == spec->master_sw) |
| 4669 | return 0; |
| 4670 | spec->master_sw = val; |
| 4671 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4672 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4673 | mono = kcontrol->private_value & 0xff; |
| 4674 | alc260_hp_master_update(codec, hp, line, mono); |
| 4675 | return 1; |
| 4676 | } |
| 4677 | |
| 4678 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4679 | { |
| 4680 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4681 | .name = "Master Playback Switch", |
| 4682 | .info = snd_ctl_boolean_mono_info, |
| 4683 | .get = alc260_hp_master_sw_get, |
| 4684 | .put = alc260_hp_master_sw_put, |
| 4685 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4686 | }, |
| 4687 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4688 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4689 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4690 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4691 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4692 | HDA_OUTPUT), |
| 4693 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4694 | { } /* end */ |
| 4695 | }; |
| 4696 | |
| 4697 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4698 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4699 | {}, |
| 4700 | }; |
| 4701 | |
| 4702 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4703 | { |
| 4704 | struct alc_spec *spec = codec->spec; |
| 4705 | unsigned int present; |
| 4706 | |
| 4707 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4708 | AC_VERB_GET_PIN_SENSE, 0); |
| 4709 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4710 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4711 | } |
| 4712 | |
| 4713 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4714 | { |
| 4715 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4716 | alc260_hp_automute(codec); |
| 4717 | } |
| 4718 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4719 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4720 | { |
| 4721 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4722 | .name = "Master Playback Switch", |
| 4723 | .info = snd_ctl_boolean_mono_info, |
| 4724 | .get = alc260_hp_master_sw_get, |
| 4725 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4726 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4727 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4728 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4729 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4730 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4731 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4732 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4733 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4734 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4735 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4736 | { } /* end */ |
| 4737 | }; |
| 4738 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4739 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4740 | .ops = &snd_hda_bind_vol, |
| 4741 | .values = { |
| 4742 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4743 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4744 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4745 | 0 |
| 4746 | }, |
| 4747 | }; |
| 4748 | |
| 4749 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4750 | .ops = &snd_hda_bind_sw, |
| 4751 | .values = { |
| 4752 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4753 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4754 | 0 |
| 4755 | }, |
| 4756 | }; |
| 4757 | |
| 4758 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4759 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4760 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4761 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4762 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4763 | { } /* end */ |
| 4764 | }; |
| 4765 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4766 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4767 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4768 | {}, |
| 4769 | }; |
| 4770 | |
| 4771 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4772 | { |
| 4773 | struct alc_spec *spec = codec->spec; |
| 4774 | unsigned int present; |
| 4775 | |
| 4776 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4777 | AC_VERB_GET_PIN_SENSE, 0); |
| 4778 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4779 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4780 | } |
| 4781 | |
| 4782 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4783 | unsigned int res) |
| 4784 | { |
| 4785 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4786 | alc260_hp_3013_automute(codec); |
| 4787 | } |
| 4788 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4789 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4790 | { |
| 4791 | unsigned int present, bits; |
| 4792 | |
| 4793 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4794 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4795 | |
| 4796 | bits = present ? 0 : PIN_OUT; |
| 4797 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4798 | bits); |
| 4799 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4800 | bits); |
| 4801 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4802 | bits); |
| 4803 | } |
| 4804 | |
| 4805 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4806 | unsigned int res) |
| 4807 | { |
| 4808 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4809 | alc260_hp_3012_automute(codec); |
| 4810 | } |
| 4811 | |
| 4812 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4813 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4814 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4815 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4816 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4817 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4818 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4819 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4820 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4821 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4822 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4823 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4824 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4825 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4826 | { } /* end */ |
| 4827 | }; |
| 4828 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4829 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4830 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4831 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4832 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4833 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4834 | * revisions available in early 2006. Therefore for now allow the |
| 4835 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4836 | * that the lack of mic bias for this NID is intentional we could change the |
| 4837 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4838 | * |
| 4839 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4840 | * don't appear to make the mic bias available from the "line" jack, even |
| 4841 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4842 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4843 | * and the output jack. If this turns out to be the case for all such |
| 4844 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4845 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4846 | * |
| 4847 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4848 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4849 | * controls for such models. On models without a "mono speaker" the control |
| 4850 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4851 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4852 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4853 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4854 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4855 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4856 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4857 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4858 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4859 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4860 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4861 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4862 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4863 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4864 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4865 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4866 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4867 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4868 | { } /* end */ |
| 4869 | }; |
| 4870 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4871 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 4872 | */ |
| 4873 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 4874 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4875 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 4876 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4877 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4878 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4879 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4880 | { } /* end */ |
| 4881 | }; |
| 4882 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4883 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4884 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4885 | */ |
| 4886 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4887 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4888 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4889 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4890 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4891 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4892 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4893 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4894 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4895 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4896 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4897 | { } /* end */ |
| 4898 | }; |
| 4899 | |
| 4900 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4901 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4902 | */ |
| 4903 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4904 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4905 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4906 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4907 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4908 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4909 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4910 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4911 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4912 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4913 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4914 | { } /* end */ |
| 4915 | }; |
| 4916 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4917 | /* |
| 4918 | * initialization verbs |
| 4919 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4920 | static struct hda_verb alc260_init_verbs[] = { |
| 4921 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4922 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4923 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4924 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4925 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4926 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4927 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4928 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4929 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4930 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4931 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4932 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4933 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4934 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4935 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4936 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4937 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4938 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4939 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4940 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4941 | /* set connection select to line in (default select for this ADC) */ |
| 4942 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4943 | /* mute capture amp left and right */ |
| 4944 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4945 | /* set connection select to line in (default select for this ADC) */ |
| 4946 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4947 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4948 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4949 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4950 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4951 | /* set vol=0 HP mixer amp left and right */ |
| 4952 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4953 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4954 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4955 | /* set vol=0 Mono mixer amp left and right */ |
| 4956 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4957 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4958 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4959 | /* unmute LINE-2 out pin */ |
| 4960 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4961 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4962 | * Line In 2 = 0x03 |
| 4963 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4964 | /* mute analog inputs */ |
| 4965 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4966 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4967 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4968 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4969 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4970 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4971 | /* mute Front out path */ |
| 4972 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4973 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4974 | /* mute Headphone out path */ |
| 4975 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4976 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4977 | /* mute Mono out path */ |
| 4978 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4979 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4980 | { } |
| 4981 | }; |
| 4982 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4983 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4984 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4985 | /* Headphone and output */ |
| 4986 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4987 | /* mono output */ |
| 4988 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4989 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4990 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4991 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4992 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4993 | /* Line In pin widget for input */ |
| 4994 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4995 | /* Line-2 pin widget for output */ |
| 4996 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4997 | /* CD pin widget for input */ |
| 4998 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4999 | /* unmute amp left and right */ |
| 5000 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5001 | /* set connection select to line in (default select for this ADC) */ |
| 5002 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5003 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5004 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5005 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5006 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5007 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5008 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5009 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5010 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5011 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5012 | * Line In 2 = 0x03 |
| 5013 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5014 | /* mute analog inputs */ |
| 5015 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5016 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5017 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5018 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5019 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5020 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5021 | /* Unmute Front out path */ |
| 5022 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5023 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5024 | /* Unmute Headphone out path */ |
| 5025 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5026 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5027 | /* Unmute Mono out path */ |
| 5028 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5029 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5030 | { } |
| 5031 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5032 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5033 | |
| 5034 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5035 | /* Line out and output */ |
| 5036 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5037 | /* mono output */ |
| 5038 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5039 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5040 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5041 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5042 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5043 | /* Line In pin widget for input */ |
| 5044 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5045 | /* Headphone pin widget for output */ |
| 5046 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5047 | /* CD pin widget for input */ |
| 5048 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5049 | /* unmute amp left and right */ |
| 5050 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5051 | /* set connection select to line in (default select for this ADC) */ |
| 5052 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5053 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5054 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5055 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5056 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5057 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5058 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5059 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5060 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5061 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5062 | * Line In 2 = 0x03 |
| 5063 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5064 | /* mute analog inputs */ |
| 5065 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5066 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5067 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5068 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5069 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5070 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5071 | /* Unmute Front out path */ |
| 5072 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5073 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5074 | /* Unmute Headphone out path */ |
| 5075 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5076 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5077 | /* Unmute Mono out path */ |
| 5078 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5079 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5080 | { } |
| 5081 | }; |
| 5082 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5083 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5084 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5085 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5086 | */ |
| 5087 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5088 | /* Disable all GPIOs */ |
| 5089 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5090 | /* Internal speaker is connected to headphone pin */ |
| 5091 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5092 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5093 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5094 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5095 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5096 | /* Ensure all other unused pins are disabled and muted. */ |
| 5097 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5098 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5099 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5100 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5101 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5102 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5103 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5104 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5105 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5106 | /* Disable digital (SPDIF) pins */ |
| 5107 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5108 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5109 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5110 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5111 | * when acting as an output. |
| 5112 | */ |
| 5113 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5114 | |
| 5115 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5116 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5117 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5118 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5119 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5120 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5121 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5122 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5123 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5124 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5125 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5126 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5127 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5128 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5129 | * If the pin mode is changed by the user the pin mode control will |
| 5130 | * take care of enabling the pin's input/output buffers as needed. |
| 5131 | * Therefore there's no need to enable the input buffer at this |
| 5132 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5133 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5134 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5135 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5136 | * mixer ctrl) |
| 5137 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5138 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5139 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5140 | /* Mute capture amp left and right */ |
| 5141 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5142 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5143 | * in (on mic1 pin) |
| 5144 | */ |
| 5145 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5146 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5147 | /* Do the same for the second ADC: mute capture input amp and |
| 5148 | * set ADC connection to line in (on mic1 pin) |
| 5149 | */ |
| 5150 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5151 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5152 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5153 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5154 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5155 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5156 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5157 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5158 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5159 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5160 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5161 | {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] | 5162 | |
| 5163 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5164 | }; |
| 5165 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5166 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5167 | * similar laptops (adapted from Fujitsu init verbs). |
| 5168 | */ |
| 5169 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5170 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5171 | * the headphone jack. Turn this on and rely on the standard mute |
| 5172 | * methods whenever the user wants to turn these outputs off. |
| 5173 | */ |
| 5174 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5175 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5176 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5177 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5178 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5179 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5180 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5181 | /* Line In jack is connected to Line1 pin */ |
| 5182 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5183 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5184 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5185 | /* Ensure all other unused pins are disabled and muted. */ |
| 5186 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5187 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5188 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5189 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5190 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5191 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5192 | /* Disable digital (SPDIF) pins */ |
| 5193 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5194 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5195 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5196 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5197 | * bus when acting as outputs. |
| 5198 | */ |
| 5199 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5200 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5201 | |
| 5202 | /* Start with output sum widgets muted and their output gains at min */ |
| 5203 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5204 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5205 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5206 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5207 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5208 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5209 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5210 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5211 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5212 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5213 | /* Unmute Line-out pin widget amp left and right |
| 5214 | * (no equiv mixer ctrl) |
| 5215 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5216 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5217 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5218 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5219 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5220 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5221 | * will take care of enabling the pin's input/output buffers as needed. |
| 5222 | * Therefore there's no need to enable the input buffer at this |
| 5223 | * stage. |
| 5224 | */ |
| 5225 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5226 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5227 | |
| 5228 | /* Mute capture amp left and right */ |
| 5229 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5230 | /* Set ADC connection select to match default mixer setting - mic |
| 5231 | * (on mic1 pin) |
| 5232 | */ |
| 5233 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5234 | |
| 5235 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5236 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5237 | */ |
| 5238 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5239 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5240 | |
| 5241 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5242 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5243 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5244 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5245 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5246 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5247 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5248 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5249 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5250 | |
| 5251 | { } |
| 5252 | }; |
| 5253 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5254 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5255 | * (adapted from Acer init verbs). |
| 5256 | */ |
| 5257 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5258 | /* GPIO 0 enables the output jack. |
| 5259 | * Turn this on and rely on the standard mute |
| 5260 | * methods whenever the user wants to turn these outputs off. |
| 5261 | */ |
| 5262 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5263 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5264 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5265 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5266 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5267 | /* Ensure all other unused pins are disabled and muted. */ |
| 5268 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5269 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5270 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5271 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5272 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5273 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5274 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5275 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5276 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5277 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5278 | /* Disable digital (SPDIF) pins */ |
| 5279 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5280 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5281 | |
| 5282 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5283 | * bus when acting as outputs. |
| 5284 | */ |
| 5285 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5286 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5287 | |
| 5288 | /* Start with output sum widgets muted and their output gains at min */ |
| 5289 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5290 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5291 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5292 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5293 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5294 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5295 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5296 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5297 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5298 | |
| 5299 | /* Unmute Line-out pin widget amp left and right |
| 5300 | * (no equiv mixer ctrl) |
| 5301 | */ |
| 5302 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5303 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5304 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5305 | * will take care of enabling the pin's input/output buffers as needed. |
| 5306 | * Therefore there's no need to enable the input buffer at this |
| 5307 | * stage. |
| 5308 | */ |
| 5309 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5310 | |
| 5311 | /* Mute capture amp left and right */ |
| 5312 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5313 | /* Set ADC connection select to match default mixer setting - mic |
| 5314 | * (on mic1 pin) |
| 5315 | */ |
| 5316 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5317 | |
| 5318 | /* Do similar with the second ADC: mute capture input amp and |
| 5319 | * set ADC connection to mic to match ALSA's default state. |
| 5320 | */ |
| 5321 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5322 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5323 | |
| 5324 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5325 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5326 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5327 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5328 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5329 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5330 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5331 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5333 | |
| 5334 | { } |
| 5335 | }; |
| 5336 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5337 | static struct hda_verb alc260_will_verbs[] = { |
| 5338 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5339 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5340 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5341 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5342 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5343 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5344 | {} |
| 5345 | }; |
| 5346 | |
| 5347 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5348 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5349 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5350 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5351 | |
| 5352 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5353 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5354 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5355 | |
| 5356 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5357 | {} |
| 5358 | }; |
| 5359 | |
| 5360 | /* toggle speaker-output according to the hp-jack state */ |
| 5361 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5362 | { |
| 5363 | unsigned int present; |
| 5364 | |
| 5365 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5366 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5367 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5368 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5369 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5370 | AC_VERB_SET_GPIO_DATA, 1); |
| 5371 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5372 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5373 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5374 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5375 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5376 | AC_VERB_SET_GPIO_DATA, 0); |
| 5377 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5378 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5379 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5380 | } |
| 5381 | } |
| 5382 | |
| 5383 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5384 | unsigned int res) |
| 5385 | { |
| 5386 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5387 | alc260_replacer_672v_automute(codec); |
| 5388 | } |
| 5389 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5390 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5391 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5392 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5393 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5394 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5395 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5396 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5397 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5398 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5399 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5400 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5401 | {} |
| 5402 | }; |
| 5403 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5404 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5405 | * configuration. |
| 5406 | */ |
| 5407 | #ifdef CONFIG_SND_DEBUG |
| 5408 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5409 | 0x02, |
| 5410 | }; |
| 5411 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5412 | 0x04, 0x05, |
| 5413 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5414 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5415 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5416 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5417 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5418 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5419 | { |
| 5420 | .num_items = 7, |
| 5421 | .items = { |
| 5422 | { "MIC1 pin", 0x0 }, |
| 5423 | { "MIC2 pin", 0x1 }, |
| 5424 | { "LINE1 pin", 0x2 }, |
| 5425 | { "LINE2 pin", 0x3 }, |
| 5426 | { "CD pin", 0x4 }, |
| 5427 | { "LINE-OUT pin", 0x5 }, |
| 5428 | { "HP-OUT pin", 0x6 }, |
| 5429 | }, |
| 5430 | }, |
| 5431 | { |
| 5432 | .num_items = 8, |
| 5433 | .items = { |
| 5434 | { "MIC1 pin", 0x0 }, |
| 5435 | { "MIC2 pin", 0x1 }, |
| 5436 | { "LINE1 pin", 0x2 }, |
| 5437 | { "LINE2 pin", 0x3 }, |
| 5438 | { "CD pin", 0x4 }, |
| 5439 | { "Mixer", 0x5 }, |
| 5440 | { "LINE-OUT pin", 0x6 }, |
| 5441 | { "HP-OUT pin", 0x7 }, |
| 5442 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5443 | }, |
| 5444 | }; |
| 5445 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5446 | /* Output driver widgets */ |
| 5447 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5448 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5449 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5450 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5451 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5452 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5453 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5454 | /* Modes for retasking pin widgets |
| 5455 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5456 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5457 | * mention this restriction. At this stage it's not clear whether |
| 5458 | * this behaviour is intentional or is a hardware bug in chip |
| 5459 | * revisions available at least up until early 2006. Therefore for |
| 5460 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5461 | * choices, but if it turns out that the lack of mic bias for these |
| 5462 | * NIDs is intentional we could change their modes from |
| 5463 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5464 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5465 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5466 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5467 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5468 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5469 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5470 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5471 | |
| 5472 | /* Loopback mixer controls */ |
| 5473 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5474 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5475 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5476 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5477 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5478 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5479 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5480 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5481 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5482 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5483 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5484 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5485 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5486 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5487 | |
| 5488 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5489 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5490 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5491 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5492 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5493 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5494 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5495 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5496 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5497 | */ |
| 5498 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5499 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5500 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5501 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5502 | * this output to turn on an external amplifier. |
| 5503 | */ |
| 5504 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5505 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5506 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5507 | { } /* end */ |
| 5508 | }; |
| 5509 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5510 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5511 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5512 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5513 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5514 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5515 | /* Enable retasking pins as output, initially without power amp */ |
| 5516 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5517 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5518 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5519 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5520 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5521 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5522 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5523 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5524 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5525 | * payload also sets the generation to 0, output to be in "consumer" |
| 5526 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5527 | * control. |
| 5528 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5529 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5530 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5531 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5532 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5533 | * OUT1 sum bus when acting as an output. |
| 5534 | */ |
| 5535 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5536 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5537 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5538 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5539 | |
| 5540 | /* Start with output sum widgets muted and their output gains at min */ |
| 5541 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5542 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5543 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5544 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5545 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5546 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5547 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5548 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5549 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5550 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5551 | /* Unmute retasking pin widget output buffers since the default |
| 5552 | * state appears to be output. As the pin mode is changed by the |
| 5553 | * user the pin mode control will take care of enabling the pin's |
| 5554 | * input/output buffers as needed. |
| 5555 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5556 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5557 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5558 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5559 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5560 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5561 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5562 | /* Also unmute the mono-out pin widget */ |
| 5563 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5564 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5565 | /* Mute capture amp left and right */ |
| 5566 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5567 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5568 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5569 | */ |
| 5570 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5571 | |
| 5572 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5573 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5574 | */ |
| 5575 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5576 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5577 | |
| 5578 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5579 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5580 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5581 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5582 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5583 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5584 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5585 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5586 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5587 | |
| 5588 | { } |
| 5589 | }; |
| 5590 | #endif |
| 5591 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5592 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5593 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5594 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5595 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5596 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5597 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5598 | /* |
| 5599 | * for BIOS auto-configuration |
| 5600 | */ |
| 5601 | |
| 5602 | 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] | 5603 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5604 | { |
| 5605 | hda_nid_t nid_vol; |
| 5606 | unsigned long vol_val, sw_val; |
| 5607 | char name[32]; |
| 5608 | int err; |
| 5609 | |
| 5610 | if (nid >= 0x0f && nid < 0x11) { |
| 5611 | nid_vol = nid - 0x7; |
| 5612 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5613 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5614 | } else if (nid == 0x11) { |
| 5615 | nid_vol = nid - 0x7; |
| 5616 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5617 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5618 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5619 | nid_vol = 0x08; |
| 5620 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5621 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5622 | } else |
| 5623 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5624 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5625 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5626 | /* first control for the volume widget */ |
| 5627 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5628 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5629 | if (err < 0) |
| 5630 | return err; |
| 5631 | *vol_bits |= (1 << nid_vol); |
| 5632 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5633 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5634 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5635 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5636 | return err; |
| 5637 | return 1; |
| 5638 | } |
| 5639 | |
| 5640 | /* add playback controls from the parsed DAC table */ |
| 5641 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5642 | const struct auto_pin_cfg *cfg) |
| 5643 | { |
| 5644 | hda_nid_t nid; |
| 5645 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5646 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5647 | |
| 5648 | spec->multiout.num_dacs = 1; |
| 5649 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5650 | spec->multiout.dac_nids[0] = 0x02; |
| 5651 | |
| 5652 | nid = cfg->line_out_pins[0]; |
| 5653 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5654 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5655 | if (err < 0) |
| 5656 | return err; |
| 5657 | } |
| 5658 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5659 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5660 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5661 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5662 | if (err < 0) |
| 5663 | return err; |
| 5664 | } |
| 5665 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5666 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5667 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5668 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5669 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5670 | if (err < 0) |
| 5671 | return err; |
| 5672 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5673 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5674 | } |
| 5675 | |
| 5676 | /* create playback/capture controls for input pins */ |
| 5677 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5678 | const struct auto_pin_cfg *cfg) |
| 5679 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5680 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5681 | int i, err, idx; |
| 5682 | |
| 5683 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5684 | if (cfg->input_pins[i] >= 0x12) { |
| 5685 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5686 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5687 | auto_pin_cfg_labels[i], idx, |
| 5688 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5689 | if (err < 0) |
| 5690 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5691 | imux->items[imux->num_items].label = |
| 5692 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5693 | imux->items[imux->num_items].index = idx; |
| 5694 | imux->num_items++; |
| 5695 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5696 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5697 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5698 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5699 | auto_pin_cfg_labels[i], idx, |
| 5700 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5701 | if (err < 0) |
| 5702 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5703 | imux->items[imux->num_items].label = |
| 5704 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5705 | imux->items[imux->num_items].index = idx; |
| 5706 | imux->num_items++; |
| 5707 | } |
| 5708 | } |
| 5709 | return 0; |
| 5710 | } |
| 5711 | |
| 5712 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5713 | hda_nid_t nid, int pin_type, |
| 5714 | int sel_idx) |
| 5715 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5716 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5717 | /* need the manual connection? */ |
| 5718 | if (nid >= 0x12) { |
| 5719 | int idx = nid - 0x12; |
| 5720 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5721 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5722 | } |
| 5723 | } |
| 5724 | |
| 5725 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5726 | { |
| 5727 | struct alc_spec *spec = codec->spec; |
| 5728 | hda_nid_t nid; |
| 5729 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5730 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5731 | if (nid) { |
| 5732 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5733 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5734 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5735 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5736 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5737 | if (nid) |
| 5738 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5739 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5740 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5741 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5742 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5743 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5744 | |
| 5745 | #define ALC260_PIN_CD_NID 0x16 |
| 5746 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5747 | { |
| 5748 | struct alc_spec *spec = codec->spec; |
| 5749 | int i; |
| 5750 | |
| 5751 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5752 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5753 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5754 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5755 | if (nid != ALC260_PIN_CD_NID && |
| 5756 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5757 | snd_hda_codec_write(codec, nid, 0, |
| 5758 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5759 | AMP_OUT_MUTE); |
| 5760 | } |
| 5761 | } |
| 5762 | } |
| 5763 | |
| 5764 | /* |
| 5765 | * generic initialization of ADC, input mixers and output mixers |
| 5766 | */ |
| 5767 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5768 | /* |
| 5769 | * Unmute ADC0-1 and set the default input to mic-in |
| 5770 | */ |
| 5771 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5772 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5773 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5774 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5775 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5776 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5777 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5778 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5779 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5780 | */ |
| 5781 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5782 | /* mute analog inputs */ |
| 5783 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5784 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5785 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5786 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5787 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5788 | |
| 5789 | /* |
| 5790 | * Set up output mixers (0x08 - 0x0a) |
| 5791 | */ |
| 5792 | /* set vol=0 to output mixers */ |
| 5793 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5794 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5795 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5796 | /* set up input amps for analog loopback */ |
| 5797 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5798 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5799 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5800 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5801 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5802 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5803 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5804 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5805 | { } |
| 5806 | }; |
| 5807 | |
| 5808 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5809 | { |
| 5810 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5811 | int err; |
| 5812 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5813 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5814 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5815 | alc260_ignore); |
| 5816 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5817 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5818 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5819 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5820 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5821 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5822 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5823 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5824 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5825 | return err; |
| 5826 | |
| 5827 | spec->multiout.max_channels = 2; |
| 5828 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 5829 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5830 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5831 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5832 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5833 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5834 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5835 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5836 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5837 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5838 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5839 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 5840 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5841 | return 1; |
| 5842 | } |
| 5843 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5844 | /* additional initialization for auto-configuration model */ |
| 5845 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5846 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5847 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5848 | alc260_auto_init_multi_out(codec); |
| 5849 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5850 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5851 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5852 | } |
| 5853 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5854 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5855 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5856 | { 0x07, HDA_INPUT, 0 }, |
| 5857 | { 0x07, HDA_INPUT, 1 }, |
| 5858 | { 0x07, HDA_INPUT, 2 }, |
| 5859 | { 0x07, HDA_INPUT, 3 }, |
| 5860 | { 0x07, HDA_INPUT, 4 }, |
| 5861 | { } /* end */ |
| 5862 | }; |
| 5863 | #endif |
| 5864 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5865 | /* |
| 5866 | * ALC260 configurations |
| 5867 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5868 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5869 | [ALC260_BASIC] = "basic", |
| 5870 | [ALC260_HP] = "hp", |
| 5871 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5872 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5873 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5874 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5875 | [ALC260_WILL] = "will", |
| 5876 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5877 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5878 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5879 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5880 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5881 | [ALC260_AUTO] = "auto", |
| 5882 | }; |
| 5883 | |
| 5884 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5885 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5886 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5887 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5888 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5889 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5890 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5891 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5892 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5893 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5894 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5895 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5896 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5897 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5898 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5899 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5900 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5901 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5902 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5903 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5904 | {} |
| 5905 | }; |
| 5906 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5907 | static struct alc_config_preset alc260_presets[] = { |
| 5908 | [ALC260_BASIC] = { |
| 5909 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5910 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5911 | .init_verbs = { alc260_init_verbs }, |
| 5912 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5913 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5914 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5915 | .adc_nids = alc260_adc_nids, |
| 5916 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5917 | .channel_mode = alc260_modes, |
| 5918 | .input_mux = &alc260_capture_source, |
| 5919 | }, |
| 5920 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5921 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5922 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5923 | .init_verbs = { alc260_init_verbs, |
| 5924 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5925 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5926 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5927 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5928 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5929 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5930 | .channel_mode = alc260_modes, |
| 5931 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5932 | .unsol_event = alc260_hp_unsol_event, |
| 5933 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5934 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5935 | [ALC260_HP_DC7600] = { |
| 5936 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5937 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5938 | .init_verbs = { alc260_init_verbs, |
| 5939 | alc260_hp_dc7600_verbs }, |
| 5940 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5941 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5942 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5943 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5944 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5945 | .channel_mode = alc260_modes, |
| 5946 | .input_mux = &alc260_capture_source, |
| 5947 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5948 | .init_hook = alc260_hp_3012_automute, |
| 5949 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5950 | [ALC260_HP_3013] = { |
| 5951 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5952 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5953 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5954 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5955 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5956 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5957 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5958 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5959 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5960 | .channel_mode = alc260_modes, |
| 5961 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5962 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5963 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5964 | }, |
| 5965 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5966 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5967 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5968 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5969 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5970 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5971 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5972 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5973 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5974 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5975 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5976 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5977 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5978 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5979 | .init_verbs = { alc260_acer_init_verbs }, |
| 5980 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5981 | .dac_nids = alc260_dac_nids, |
| 5982 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5983 | .adc_nids = alc260_dual_adc_nids, |
| 5984 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5985 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5986 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5987 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5988 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5989 | [ALC260_FAVORIT100] = { |
| 5990 | .mixers = { alc260_favorit100_mixer }, |
| 5991 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 5992 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5993 | .dac_nids = alc260_dac_nids, |
| 5994 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5995 | .adc_nids = alc260_dual_adc_nids, |
| 5996 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5997 | .channel_mode = alc260_modes, |
| 5998 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 5999 | .input_mux = alc260_favorit100_capture_sources, |
| 6000 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6001 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6002 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6003 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6004 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6005 | .dac_nids = alc260_dac_nids, |
| 6006 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6007 | .adc_nids = alc260_adc_nids, |
| 6008 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6009 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6010 | .channel_mode = alc260_modes, |
| 6011 | .input_mux = &alc260_capture_source, |
| 6012 | }, |
| 6013 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6014 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6015 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6016 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6017 | .dac_nids = alc260_dac_nids, |
| 6018 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6019 | .adc_nids = alc260_adc_nids, |
| 6020 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6021 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6022 | .channel_mode = alc260_modes, |
| 6023 | .input_mux = &alc260_capture_source, |
| 6024 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6025 | .init_hook = alc260_replacer_672v_automute, |
| 6026 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6027 | #ifdef CONFIG_SND_DEBUG |
| 6028 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6029 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6030 | .init_verbs = { alc260_test_init_verbs }, |
| 6031 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6032 | .dac_nids = alc260_test_dac_nids, |
| 6033 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6034 | .adc_nids = alc260_test_adc_nids, |
| 6035 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6036 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6037 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6038 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6039 | }, |
| 6040 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6041 | }; |
| 6042 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6043 | static int patch_alc260(struct hda_codec *codec) |
| 6044 | { |
| 6045 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6046 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6047 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6048 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6049 | if (spec == NULL) |
| 6050 | return -ENOMEM; |
| 6051 | |
| 6052 | codec->spec = spec; |
| 6053 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6054 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6055 | alc260_models, |
| 6056 | alc260_cfg_tbl); |
| 6057 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6058 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 6059 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6060 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6061 | } |
| 6062 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6063 | if (board_config == ALC260_AUTO) { |
| 6064 | /* automatic parse from the BIOS config */ |
| 6065 | err = alc260_parse_auto_config(codec); |
| 6066 | if (err < 0) { |
| 6067 | alc_free(codec); |
| 6068 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6069 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6070 | printk(KERN_INFO |
| 6071 | "hda_codec: Cannot set up configuration " |
| 6072 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6073 | board_config = ALC260_BASIC; |
| 6074 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6075 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6076 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6077 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6078 | if (err < 0) { |
| 6079 | alc_free(codec); |
| 6080 | return err; |
| 6081 | } |
| 6082 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6083 | if (board_config != ALC260_AUTO) |
| 6084 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6085 | |
| 6086 | spec->stream_name_analog = "ALC260 Analog"; |
| 6087 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6088 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6089 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6090 | spec->stream_name_digital = "ALC260 Digital"; |
| 6091 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6092 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6093 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6094 | if (!spec->adc_nids && spec->input_mux) { |
| 6095 | /* check whether NID 0x04 is valid */ |
| 6096 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 6097 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 6098 | /* get type */ |
| 6099 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6100 | spec->adc_nids = alc260_adc_nids_alt; |
| 6101 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6102 | } else { |
| 6103 | spec->adc_nids = alc260_adc_nids; |
| 6104 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6105 | } |
| 6106 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6107 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6108 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6109 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6110 | spec->vmaster_nid = 0x08; |
| 6111 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6112 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6113 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6114 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6115 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6116 | if (!spec->loopback.amplist) |
| 6117 | spec->loopback.amplist = alc260_loopbacks; |
| 6118 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6119 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6120 | |
| 6121 | return 0; |
| 6122 | } |
| 6123 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6124 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6125 | /* |
| 6126 | * ALC882 support |
| 6127 | * |
| 6128 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6129 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6130 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6131 | * 6-channel independent captures. |
| 6132 | * |
| 6133 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6134 | * driver yet). |
| 6135 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6136 | #define ALC882_DIGOUT_NID 0x06 |
| 6137 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6138 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6139 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6140 | { 8, NULL } |
| 6141 | }; |
| 6142 | |
| 6143 | static hda_nid_t alc882_dac_nids[4] = { |
| 6144 | /* front, rear, clfe, rear_surr */ |
| 6145 | 0x02, 0x03, 0x04, 0x05 |
| 6146 | }; |
| 6147 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6148 | /* identical with ALC880 */ |
| 6149 | #define alc882_adc_nids alc880_adc_nids |
| 6150 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6151 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6152 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6153 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 6154 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6155 | /* input MUX */ |
| 6156 | /* FIXME: should be a matrix-type input source selection */ |
| 6157 | |
| 6158 | static struct hda_input_mux alc882_capture_source = { |
| 6159 | .num_items = 4, |
| 6160 | .items = { |
| 6161 | { "Mic", 0x0 }, |
| 6162 | { "Front Mic", 0x1 }, |
| 6163 | { "Line", 0x2 }, |
| 6164 | { "CD", 0x4 }, |
| 6165 | }, |
| 6166 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6167 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6168 | * 2ch mode |
| 6169 | */ |
| 6170 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6171 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6172 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6173 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6174 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6175 | { } /* end */ |
| 6176 | }; |
| 6177 | |
| 6178 | /* |
| 6179 | * 6ch mode |
| 6180 | */ |
| 6181 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6182 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6183 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6184 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6185 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6186 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6187 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6188 | { } /* end */ |
| 6189 | }; |
| 6190 | |
| 6191 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 6192 | { 2, alc882_3ST_ch2_init }, |
| 6193 | { 6, alc882_3ST_ch6_init }, |
| 6194 | }; |
| 6195 | |
| 6196 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6197 | * 6ch mode |
| 6198 | */ |
| 6199 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6200 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6201 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6202 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6203 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6204 | { } /* end */ |
| 6205 | }; |
| 6206 | |
| 6207 | /* |
| 6208 | * 8ch mode |
| 6209 | */ |
| 6210 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6211 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6212 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6213 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6214 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6215 | { } /* end */ |
| 6216 | }; |
| 6217 | |
| 6218 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6219 | { 6, alc882_sixstack_ch6_init }, |
| 6220 | { 8, alc882_sixstack_ch8_init }, |
| 6221 | }; |
| 6222 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6223 | /* |
| 6224 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 6225 | */ |
| 6226 | |
| 6227 | /* |
| 6228 | * 2ch mode |
| 6229 | */ |
| 6230 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6231 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6232 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6233 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6234 | { } /* end */ |
| 6235 | }; |
| 6236 | |
| 6237 | /* |
| 6238 | * 6ch mode |
| 6239 | */ |
| 6240 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6241 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6242 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6243 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6244 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6245 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6246 | { } /* end */ |
| 6247 | }; |
| 6248 | |
| 6249 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6250 | { 2, alc885_mbp_ch2_init }, |
| 6251 | { 6, alc885_mbp_ch6_init }, |
| 6252 | }; |
| 6253 | |
| 6254 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6255 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6256 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6257 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6258 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6259 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6260 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6261 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6262 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6263 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6264 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6265 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6266 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6267 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6268 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6269 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6270 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6271 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6272 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6273 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6274 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6275 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6276 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6277 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6278 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6279 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6280 | { } /* end */ |
| 6281 | }; |
| 6282 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6283 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6284 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6285 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6286 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6287 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6288 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6289 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6290 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6291 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6292 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6293 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6294 | { } /* end */ |
| 6295 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6296 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6297 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6298 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6299 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6300 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6301 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6302 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6303 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6304 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6305 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6306 | { } /* end */ |
| 6307 | }; |
| 6308 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6309 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6310 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6311 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6312 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6313 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6314 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6315 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6316 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6317 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6318 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6319 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6320 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6321 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6322 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6323 | { } /* end */ |
| 6324 | }; |
| 6325 | |
| 6326 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6327 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6328 | */ |
| 6329 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6330 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6331 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6332 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6333 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6334 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6335 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6336 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6337 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6338 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6339 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6340 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6341 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6342 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6343 | { } /* end */ |
| 6344 | }; |
| 6345 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6346 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6347 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6348 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6349 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6350 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6351 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6352 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6353 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6354 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6355 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6356 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6357 | { } /* end */ |
| 6358 | }; |
| 6359 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6360 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6361 | { |
| 6362 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6363 | .name = "Channel Mode", |
| 6364 | .info = alc_ch_mode_info, |
| 6365 | .get = alc_ch_mode_get, |
| 6366 | .put = alc_ch_mode_put, |
| 6367 | }, |
| 6368 | { } /* end */ |
| 6369 | }; |
| 6370 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6371 | static struct hda_verb alc882_init_verbs[] = { |
| 6372 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6373 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6374 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6375 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6376 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6377 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6378 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6379 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6380 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6381 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6382 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6383 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6384 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6385 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6386 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6387 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6388 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6389 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6390 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6391 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6392 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6393 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6394 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6395 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6396 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6397 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6398 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6399 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6400 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6401 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6402 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6403 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6404 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6405 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6406 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6407 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6408 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6409 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6410 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6411 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6412 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6413 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6414 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6415 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6416 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6417 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6418 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6419 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6420 | |
| 6421 | /* FIXME: use matrix-type input source selection */ |
| 6422 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6423 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6424 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6425 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6426 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6427 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6428 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6429 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6430 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6431 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6432 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6433 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6434 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6435 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6436 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6437 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6438 | /* ADC1: mute amp left and right */ |
| 6439 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6440 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6441 | /* ADC2: mute amp left and right */ |
| 6442 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6443 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6444 | /* ADC3: mute amp left and right */ |
| 6445 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6446 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6447 | |
| 6448 | { } |
| 6449 | }; |
| 6450 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6451 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6452 | /* change to EAPD mode */ |
| 6453 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6454 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6455 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6456 | }; |
| 6457 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6458 | /* Mac Pro test */ |
| 6459 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6460 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6461 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6462 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6463 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6464 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6465 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6466 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6467 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6468 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6469 | { } /* end */ |
| 6470 | }; |
| 6471 | |
| 6472 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6473 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6474 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6475 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6476 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6477 | /* Front Pin: output 0 (0x0c) */ |
| 6478 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6479 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6480 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6481 | /* Front Mic pin: input vref at 80% */ |
| 6482 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6483 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6484 | /* Speaker: output */ |
| 6485 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6486 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6487 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6488 | /* Headphone output (output 0 - 0x0c) */ |
| 6489 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6490 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6491 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6492 | |
| 6493 | /* FIXME: use matrix-type input source selection */ |
| 6494 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6495 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6496 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6497 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6498 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6499 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6500 | /* Input mixer2 */ |
| 6501 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6502 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6503 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6504 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6505 | /* Input mixer3 */ |
| 6506 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6507 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6508 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6509 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6510 | /* ADC1: mute amp left and right */ |
| 6511 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6512 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6513 | /* ADC2: mute amp left and right */ |
| 6514 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6515 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6516 | /* ADC3: mute amp left and right */ |
| 6517 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6518 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6519 | |
| 6520 | { } |
| 6521 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6522 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6523 | /* Macbook Pro rev3 */ |
| 6524 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6525 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6526 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6527 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6528 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6529 | /* Rear mixer */ |
| 6530 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6531 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6532 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6533 | /* Front Pin: output 0 (0x0c) */ |
| 6534 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6535 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6536 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6537 | /* HP Pin: output 0 (0x0d) */ |
| 6538 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6539 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6540 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6541 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6542 | /* Mic (rear) pin: input vref at 80% */ |
| 6543 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6544 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6545 | /* Front Mic pin: input vref at 80% */ |
| 6546 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6547 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6548 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6549 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6550 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6551 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6552 | |
| 6553 | /* FIXME: use matrix-type input source selection */ |
| 6554 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6555 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6556 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6557 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6558 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6559 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6560 | /* Input mixer2 */ |
| 6561 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6562 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6563 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6564 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6565 | /* Input mixer3 */ |
| 6566 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6567 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6568 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6569 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6570 | /* ADC1: mute amp left and right */ |
| 6571 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6572 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6573 | /* ADC2: mute amp left and right */ |
| 6574 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6575 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6576 | /* ADC3: mute amp left and right */ |
| 6577 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6578 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6579 | |
| 6580 | { } |
| 6581 | }; |
| 6582 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6583 | /* iMac 24 mixer. */ |
| 6584 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6585 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6586 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6587 | { } /* end */ |
| 6588 | }; |
| 6589 | |
| 6590 | /* iMac 24 init verbs. */ |
| 6591 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6592 | /* Internal speakers: output 0 (0x0c) */ |
| 6593 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6594 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6595 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6596 | /* Internal speakers: output 0 (0x0c) */ |
| 6597 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6598 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6599 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6600 | /* Headphone: output 0 (0x0c) */ |
| 6601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6602 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6603 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6604 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6605 | /* Front Mic: input vref at 80% */ |
| 6606 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6607 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6608 | { } |
| 6609 | }; |
| 6610 | |
| 6611 | /* Toggle speaker-output according to the hp-jack state */ |
| 6612 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 6613 | { |
| 6614 | unsigned int present; |
| 6615 | |
| 6616 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6617 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6618 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 6619 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6620 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 6621 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6622 | } |
| 6623 | |
| 6624 | /* Processes unsolicited events. */ |
| 6625 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 6626 | unsigned int res) |
| 6627 | { |
| 6628 | /* Headphone insertion or removal. */ |
| 6629 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6630 | alc885_imac24_automute(codec); |
| 6631 | } |
| 6632 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6633 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6634 | { |
| 6635 | unsigned int present; |
| 6636 | |
| 6637 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6638 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6639 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6640 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6641 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6642 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6643 | |
| 6644 | } |
| 6645 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6646 | unsigned int res) |
| 6647 | { |
| 6648 | /* Headphone insertion or removal. */ |
| 6649 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6650 | alc885_mbp3_automute(codec); |
| 6651 | } |
| 6652 | |
| 6653 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6654 | static struct hda_verb alc882_targa_verbs[] = { |
| 6655 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6656 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6657 | |
| 6658 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6659 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6660 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6661 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6662 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6663 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6664 | |
| 6665 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6666 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6667 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6668 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6669 | { } /* end */ |
| 6670 | }; |
| 6671 | |
| 6672 | /* toggle speaker-output according to the hp-jack state */ |
| 6673 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6674 | { |
| 6675 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6676 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6677 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6678 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6679 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6680 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6681 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6682 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6683 | } |
| 6684 | |
| 6685 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6686 | { |
| 6687 | /* Looks like the unsol event is incompatible with the standard |
| 6688 | * definition. 4bit tag is placed at 26 bit! |
| 6689 | */ |
| 6690 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6691 | alc882_targa_automute(codec); |
| 6692 | } |
| 6693 | } |
| 6694 | |
| 6695 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6696 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6697 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6698 | |
| 6699 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6700 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6701 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6702 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6703 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6704 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6705 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6706 | |
| 6707 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6708 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6709 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6710 | { } /* end */ |
| 6711 | }; |
| 6712 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6713 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6714 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6715 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6716 | |
| 6717 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6718 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6719 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6720 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6721 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6722 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6723 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6724 | |
| 6725 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6726 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6727 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6728 | { } /* end */ |
| 6729 | }; |
| 6730 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6731 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6732 | { |
| 6733 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6734 | |
| 6735 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6736 | AC_VERB_GET_GPIO_DATA, 0); |
| 6737 | |
| 6738 | if (!muted) |
| 6739 | gpiostate |= (1 << pin); |
| 6740 | else |
| 6741 | gpiostate &= ~(1 << pin); |
| 6742 | |
| 6743 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6744 | AC_VERB_GET_GPIO_MASK, 0); |
| 6745 | gpiomask |= (1 << pin); |
| 6746 | |
| 6747 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6748 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6749 | gpiodir |= (1 << pin); |
| 6750 | |
| 6751 | |
| 6752 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6753 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6754 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6755 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6756 | |
| 6757 | msleep(1); |
| 6758 | |
| 6759 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6760 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6761 | } |
| 6762 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6763 | /* set up GPIO at initialization */ |
| 6764 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6765 | { |
| 6766 | alc882_gpio_mute(codec, 0, 0); |
| 6767 | alc882_gpio_mute(codec, 1, 0); |
| 6768 | } |
| 6769 | |
| 6770 | /* set up GPIO and update auto-muting at initialization */ |
| 6771 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6772 | { |
| 6773 | alc885_macpro_init_hook(codec); |
| 6774 | alc885_imac24_automute(codec); |
| 6775 | } |
| 6776 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6777 | /* |
| 6778 | * generic initialization of ADC, input mixers and output mixers |
| 6779 | */ |
| 6780 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6781 | /* |
| 6782 | * Unmute ADC0-2 and set the default input to mic-in |
| 6783 | */ |
| 6784 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6785 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6786 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6787 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6788 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6789 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6790 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6791 | /* 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] | 6792 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6793 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6794 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6795 | */ |
| 6796 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6797 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6798 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6799 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6800 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6801 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6802 | |
| 6803 | /* |
| 6804 | * Set up output mixers (0x0c - 0x0f) |
| 6805 | */ |
| 6806 | /* set vol=0 to output mixers */ |
| 6807 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6808 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6809 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6810 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6811 | /* set up input amps for analog loopback */ |
| 6812 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6813 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6814 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6815 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6816 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6817 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6818 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6819 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6820 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6821 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6822 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6823 | |
| 6824 | /* FIXME: use matrix-type input source selection */ |
| 6825 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6826 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6827 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6828 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6829 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6830 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6831 | /* Input mixer2 */ |
| 6832 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6833 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6834 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6835 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6836 | /* Input mixer3 */ |
| 6837 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6838 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6839 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6840 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6841 | |
| 6842 | { } |
| 6843 | }; |
| 6844 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6845 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6846 | #define alc882_loopbacks alc880_loopbacks |
| 6847 | #endif |
| 6848 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6849 | /* pcm configuration: identiacal with ALC880 */ |
| 6850 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6851 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6852 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6853 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6854 | |
| 6855 | /* |
| 6856 | * configuration and preset |
| 6857 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6858 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6859 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6860 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6861 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6862 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6863 | [ALC882_TARGA] = "targa", |
| 6864 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6865 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6866 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6867 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6868 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6869 | [ALC882_AUTO] = "auto", |
| 6870 | }; |
| 6871 | |
| 6872 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6873 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6874 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6875 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6876 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6877 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6878 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6879 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6880 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6881 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6882 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6883 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6884 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6885 | {} |
| 6886 | }; |
| 6887 | |
| 6888 | static struct alc_config_preset alc882_presets[] = { |
| 6889 | [ALC882_3ST_DIG] = { |
| 6890 | .mixers = { alc882_base_mixer }, |
| 6891 | .init_verbs = { alc882_init_verbs }, |
| 6892 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6893 | .dac_nids = alc882_dac_nids, |
| 6894 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6895 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6896 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6897 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6898 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6899 | .input_mux = &alc882_capture_source, |
| 6900 | }, |
| 6901 | [ALC882_6ST_DIG] = { |
| 6902 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6903 | .init_verbs = { alc882_init_verbs }, |
| 6904 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6905 | .dac_nids = alc882_dac_nids, |
| 6906 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6907 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6908 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6909 | .channel_mode = alc882_sixstack_modes, |
| 6910 | .input_mux = &alc882_capture_source, |
| 6911 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6912 | [ALC882_ARIMA] = { |
| 6913 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6914 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6915 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6916 | .dac_nids = alc882_dac_nids, |
| 6917 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6918 | .channel_mode = alc882_sixstack_modes, |
| 6919 | .input_mux = &alc882_capture_source, |
| 6920 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6921 | [ALC882_W2JC] = { |
| 6922 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6923 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6924 | alc880_gpio1_init_verbs }, |
| 6925 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6926 | .dac_nids = alc882_dac_nids, |
| 6927 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6928 | .channel_mode = alc880_threestack_modes, |
| 6929 | .need_dac_fix = 1, |
| 6930 | .input_mux = &alc882_capture_source, |
| 6931 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6932 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6933 | [ALC885_MBP3] = { |
| 6934 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6935 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6936 | alc880_gpio1_init_verbs }, |
| 6937 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6938 | .dac_nids = alc882_dac_nids, |
| 6939 | .channel_mode = alc885_mbp_6ch_modes, |
| 6940 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6941 | .input_mux = &alc882_capture_source, |
| 6942 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6943 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6944 | .unsol_event = alc885_mbp3_unsol_event, |
| 6945 | .init_hook = alc885_mbp3_automute, |
| 6946 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6947 | [ALC885_MACPRO] = { |
| 6948 | .mixers = { alc882_macpro_mixer }, |
| 6949 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6950 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6951 | .dac_nids = alc882_dac_nids, |
| 6952 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6953 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6954 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6955 | .channel_mode = alc882_ch_modes, |
| 6956 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6957 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6958 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6959 | [ALC885_IMAC24] = { |
| 6960 | .mixers = { alc885_imac24_mixer }, |
| 6961 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6962 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6963 | .dac_nids = alc882_dac_nids, |
| 6964 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6965 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6966 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6967 | .channel_mode = alc882_ch_modes, |
| 6968 | .input_mux = &alc882_capture_source, |
| 6969 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6970 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6971 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6972 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6973 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6974 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6975 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6976 | .dac_nids = alc882_dac_nids, |
| 6977 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6978 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6979 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6980 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6981 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6982 | .channel_mode = alc882_3ST_6ch_modes, |
| 6983 | .need_dac_fix = 1, |
| 6984 | .input_mux = &alc882_capture_source, |
| 6985 | .unsol_event = alc882_targa_unsol_event, |
| 6986 | .init_hook = alc882_targa_automute, |
| 6987 | }, |
| 6988 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6989 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6990 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6991 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6992 | .dac_nids = alc882_dac_nids, |
| 6993 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6994 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6995 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6996 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6997 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6998 | .channel_mode = alc882_3ST_6ch_modes, |
| 6999 | .need_dac_fix = 1, |
| 7000 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7001 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7002 | [ALC882_ASUS_A7M] = { |
| 7003 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 7004 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 7005 | alc880_gpio1_init_verbs, |
| 7006 | alc882_asus_a7m_verbs }, |
| 7007 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7008 | .dac_nids = alc882_dac_nids, |
| 7009 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7010 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 7011 | .channel_mode = alc880_threestack_modes, |
| 7012 | .need_dac_fix = 1, |
| 7013 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7014 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7015 | }; |
| 7016 | |
| 7017 | |
| 7018 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7019 | * Pin config fixes |
| 7020 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7021 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7022 | PINFIX_ABIT_AW9D_MAX |
| 7023 | }; |
| 7024 | |
| 7025 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 7026 | { 0x15, 0x01080104 }, /* side */ |
| 7027 | { 0x16, 0x01011012 }, /* rear */ |
| 7028 | { 0x17, 0x01016011 }, /* clfe */ |
| 7029 | { } |
| 7030 | }; |
| 7031 | |
| 7032 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 7033 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 7034 | }; |
| 7035 | |
| 7036 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 7037 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 7038 | {} |
| 7039 | }; |
| 7040 | |
| 7041 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7042 | * BIOS auto configuration |
| 7043 | */ |
| 7044 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7045 | hda_nid_t nid, int pin_type, |
| 7046 | int dac_idx) |
| 7047 | { |
| 7048 | /* set as output */ |
| 7049 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7050 | int idx; |
| 7051 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7052 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7053 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7054 | idx = 4; |
| 7055 | else |
| 7056 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7057 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7058 | |
| 7059 | } |
| 7060 | |
| 7061 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 7062 | { |
| 7063 | struct alc_spec *spec = codec->spec; |
| 7064 | int i; |
| 7065 | |
| 7066 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7067 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7068 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7069 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7070 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7071 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7072 | } |
| 7073 | } |
| 7074 | |
| 7075 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 7076 | { |
| 7077 | struct alc_spec *spec = codec->spec; |
| 7078 | hda_nid_t pin; |
| 7079 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7080 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7081 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7082 | /* use dac 0 */ |
| 7083 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7084 | pin = spec->autocfg.speaker_pins[0]; |
| 7085 | if (pin) |
| 7086 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7087 | } |
| 7088 | |
| 7089 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7090 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 7091 | |
| 7092 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 7093 | { |
| 7094 | struct alc_spec *spec = codec->spec; |
| 7095 | int i; |
| 7096 | |
| 7097 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7098 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7099 | if (!nid) |
| 7100 | continue; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 7101 | alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7102 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 7103 | snd_hda_codec_write(codec, nid, 0, |
| 7104 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7105 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7106 | } |
| 7107 | } |
| 7108 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7109 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 7110 | { |
| 7111 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7112 | int c; |
| 7113 | |
| 7114 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 7115 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 7116 | hda_nid_t nid = spec->capsrc_nids[c]; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7117 | unsigned int mux_idx; |
| 7118 | const struct hda_input_mux *imux; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7119 | int conns, mute, idx, item; |
| 7120 | |
| 7121 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 7122 | ARRAY_SIZE(conn_list)); |
| 7123 | if (conns < 0) |
| 7124 | continue; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7125 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 7126 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7127 | for (idx = 0; idx < conns; idx++) { |
| 7128 | /* if the current connection is the selected one, |
| 7129 | * unmute it as default - otherwise mute it |
| 7130 | */ |
| 7131 | mute = AMP_IN_MUTE(idx); |
| 7132 | for (item = 0; item < imux->num_items; item++) { |
| 7133 | if (imux->items[item].index == idx) { |
| 7134 | if (spec->cur_mux[c] == item) |
| 7135 | mute = AMP_IN_UNMUTE(idx); |
| 7136 | break; |
| 7137 | } |
| 7138 | } |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7139 | /* check if we have a selector or mixer |
| 7140 | * we could check for the widget type instead, but |
| 7141 | * just check for Amp-In presence (in case of mixer |
| 7142 | * without amp-in there is something wrong, this |
| 7143 | * function shouldn't be used or capsrc nid is wrong) |
| 7144 | */ |
| 7145 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
| 7146 | snd_hda_codec_write(codec, nid, 0, |
| 7147 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7148 | mute); |
| 7149 | else if (mute != AMP_IN_MUTE(idx)) |
| 7150 | snd_hda_codec_write(codec, nid, 0, |
| 7151 | AC_VERB_SET_CONNECT_SEL, |
| 7152 | idx); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7153 | } |
| 7154 | } |
| 7155 | } |
| 7156 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7157 | /* add mic boosts if needed */ |
| 7158 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 7159 | { |
| 7160 | struct alc_spec *spec = codec->spec; |
| 7161 | int err; |
| 7162 | hda_nid_t nid; |
| 7163 | |
| 7164 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7165 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7166 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7167 | "Mic Boost", |
| 7168 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7169 | if (err < 0) |
| 7170 | return err; |
| 7171 | } |
| 7172 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7173 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7174 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7175 | "Front Mic Boost", |
| 7176 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7177 | if (err < 0) |
| 7178 | return err; |
| 7179 | } |
| 7180 | return 0; |
| 7181 | } |
| 7182 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7183 | /* almost identical with ALC880 parser... */ |
| 7184 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 7185 | { |
| 7186 | struct alc_spec *spec = codec->spec; |
| 7187 | int err = alc880_parse_auto_config(codec); |
| 7188 | |
| 7189 | if (err < 0) |
| 7190 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7191 | else if (!err) |
| 7192 | return 0; /* no config found */ |
| 7193 | |
| 7194 | err = alc_auto_add_mic_boost(codec); |
| 7195 | if (err < 0) |
| 7196 | return err; |
| 7197 | |
| 7198 | /* hack - override the init verbs */ |
| 7199 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7200 | |
| 7201 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7202 | } |
| 7203 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7204 | /* additional initialization for auto-configuration model */ |
| 7205 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7206 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7207 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7208 | alc882_auto_init_multi_out(codec); |
| 7209 | alc882_auto_init_hp_out(codec); |
| 7210 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7211 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7212 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7213 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7214 | } |
| 7215 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7216 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7217 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7218 | static int patch_alc882(struct hda_codec *codec) |
| 7219 | { |
| 7220 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7221 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7222 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7223 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7224 | if (spec == NULL) |
| 7225 | return -ENOMEM; |
| 7226 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7227 | codec->spec = spec; |
| 7228 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7229 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7230 | alc882_models, |
| 7231 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7232 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7233 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7234 | /* Pick up systems that don't supply PCI SSID */ |
| 7235 | switch (codec->subsystem_id) { |
| 7236 | case 0x106b0c00: /* Mac Pro */ |
| 7237 | board_config = ALC885_MACPRO; |
| 7238 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7239 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7240 | case 0x106b2800: /* AppleTV */ |
Mark Eggleston | 3077e44 | 2009-01-31 17:57:54 +0100 | [diff] [blame] | 7241 | case 0x106b3e00: /* iMac 24 Aluminium */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7242 | board_config = ALC885_IMAC24; |
| 7243 | break; |
Luke Yelavich | 2d46638 | 2009-02-23 13:00:33 +1100 | [diff] [blame] | 7244 | case 0x106b00a0: /* MacBookPro3,1 - Another revision */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7245 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7246 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7247 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7248 | case 0x106b3600: /* Macbook 3.1 */ |
Luke Yelavich | 2a88464 | 2009-01-28 15:58:38 +1100 | [diff] [blame] | 7249 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7250 | board_config = ALC885_MBP3; |
| 7251 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7252 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7253 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7254 | if (codec->revision_id == 0x100101 || |
| 7255 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7256 | alc_free(codec); |
| 7257 | return patch_alc883(codec); |
| 7258 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7259 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 7260 | "trying auto-probe from BIOS...\n"); |
| 7261 | board_config = ALC882_AUTO; |
| 7262 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7263 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7264 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7265 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7267 | if (board_config == ALC882_AUTO) { |
| 7268 | /* automatic parse from the BIOS config */ |
| 7269 | err = alc882_parse_auto_config(codec); |
| 7270 | if (err < 0) { |
| 7271 | alc_free(codec); |
| 7272 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7273 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7274 | printk(KERN_INFO |
| 7275 | "hda_codec: Cannot set up configuration " |
| 7276 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7277 | board_config = ALC882_3ST_DIG; |
| 7278 | } |
| 7279 | } |
| 7280 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7281 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7282 | if (err < 0) { |
| 7283 | alc_free(codec); |
| 7284 | return err; |
| 7285 | } |
| 7286 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7287 | if (board_config != ALC882_AUTO) |
| 7288 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7289 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 7290 | if (codec->vendor_id == 0x10ec0885) { |
| 7291 | spec->stream_name_analog = "ALC885 Analog"; |
| 7292 | spec->stream_name_digital = "ALC885 Digital"; |
| 7293 | } else { |
| 7294 | spec->stream_name_analog = "ALC882 Analog"; |
| 7295 | spec->stream_name_digital = "ALC882 Digital"; |
| 7296 | } |
| 7297 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7298 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7299 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7300 | /* FIXME: setup DAC5 */ |
| 7301 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7302 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7303 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7304 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7305 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7306 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7307 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7308 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7309 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7310 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7311 | /* get type */ |
| 7312 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7313 | if (wcap != AC_WID_AUD_IN) { |
| 7314 | spec->adc_nids = alc882_adc_nids_alt; |
| 7315 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7316 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7317 | } else { |
| 7318 | spec->adc_nids = alc882_adc_nids; |
| 7319 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7320 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7321 | } |
| 7322 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7323 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7324 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7325 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7326 | spec->vmaster_nid = 0x0c; |
| 7327 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7328 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7329 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7330 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7331 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7332 | if (!spec->loopback.amplist) |
| 7333 | spec->loopback.amplist = alc882_loopbacks; |
| 7334 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7335 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7336 | |
| 7337 | return 0; |
| 7338 | } |
| 7339 | |
| 7340 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7341 | * ALC883 support |
| 7342 | * |
| 7343 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7344 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7345 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7346 | * 6-channel independent captures. |
| 7347 | * |
| 7348 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7349 | * driver yet). |
| 7350 | */ |
| 7351 | #define ALC883_DIGOUT_NID 0x06 |
| 7352 | #define ALC883_DIGIN_NID 0x0a |
| 7353 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7354 | #define ALC1200_DIGOUT_NID 0x10 |
| 7355 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7356 | static hda_nid_t alc883_dac_nids[4] = { |
| 7357 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7358 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7359 | }; |
| 7360 | |
| 7361 | static hda_nid_t alc883_adc_nids[2] = { |
| 7362 | /* ADC1-2 */ |
| 7363 | 0x08, 0x09, |
| 7364 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7365 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7366 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7367 | /* ADC1 */ |
| 7368 | 0x08, |
| 7369 | }; |
| 7370 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7371 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7372 | /* ADC2-1 */ |
| 7373 | 0x09, 0x08 |
| 7374 | }; |
| 7375 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7376 | #define alc889_adc_nids alc880_adc_nids |
| 7377 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7378 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7379 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7380 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7381 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7382 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7383 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7384 | /* input MUX */ |
| 7385 | /* FIXME: should be a matrix-type input source selection */ |
| 7386 | |
| 7387 | static struct hda_input_mux alc883_capture_source = { |
| 7388 | .num_items = 4, |
| 7389 | .items = { |
| 7390 | { "Mic", 0x0 }, |
| 7391 | { "Front Mic", 0x1 }, |
| 7392 | { "Line", 0x2 }, |
| 7393 | { "CD", 0x4 }, |
| 7394 | }, |
| 7395 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7396 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7397 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7398 | .num_items = 4, |
| 7399 | .items = { |
| 7400 | { "Mic", 0x1 }, |
| 7401 | { "Front Mic", 0x0 }, |
| 7402 | { "Line", 0x2 }, |
| 7403 | { "CD", 0x4 }, |
| 7404 | }, |
| 7405 | }; |
| 7406 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7407 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7408 | .num_items = 2, |
| 7409 | .items = { |
| 7410 | { "Mic", 0x1 }, |
| 7411 | { "Line", 0x2 }, |
| 7412 | }, |
| 7413 | }; |
| 7414 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7415 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7416 | .num_items = 4, |
| 7417 | .items = { |
| 7418 | { "Mic", 0x0 }, |
| 7419 | { "iMic", 0x1 }, |
| 7420 | { "Line", 0x2 }, |
| 7421 | { "CD", 0x4 }, |
| 7422 | }, |
| 7423 | }; |
| 7424 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7425 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7426 | .num_items = 2, |
| 7427 | .items = { |
| 7428 | { "Mic", 0x0 }, |
| 7429 | { "Int Mic", 0x1 }, |
| 7430 | }, |
| 7431 | }; |
| 7432 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7433 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7434 | .num_items = 3, |
| 7435 | .items = { |
| 7436 | { "Mic", 0x0 }, |
| 7437 | { "Front Mic", 0x1 }, |
| 7438 | { "Line", 0x4 }, |
| 7439 | }, |
| 7440 | }; |
| 7441 | |
| 7442 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7443 | .num_items = 2, |
| 7444 | .items = { |
| 7445 | { "Mic", 0x0 }, |
| 7446 | { "Line", 0x2 }, |
| 7447 | }, |
| 7448 | }; |
| 7449 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7450 | /* |
| 7451 | * 2ch mode |
| 7452 | */ |
| 7453 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7454 | { 2, NULL } |
| 7455 | }; |
| 7456 | |
| 7457 | /* |
| 7458 | * 2ch mode |
| 7459 | */ |
| 7460 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7461 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7462 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7463 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7464 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7465 | { } /* end */ |
| 7466 | }; |
| 7467 | |
| 7468 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7469 | * 4ch mode |
| 7470 | */ |
| 7471 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7472 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7473 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7474 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7475 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7476 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7477 | { } /* end */ |
| 7478 | }; |
| 7479 | |
| 7480 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7481 | * 6ch mode |
| 7482 | */ |
| 7483 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7484 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7485 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7486 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7487 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7488 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7489 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7490 | { } /* end */ |
| 7491 | }; |
| 7492 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7493 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7494 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7495 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7496 | { 6, alc883_3ST_ch6_init }, |
| 7497 | }; |
| 7498 | |
| 7499 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7500 | * 2ch mode |
| 7501 | */ |
| 7502 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7503 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7504 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7505 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7506 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7507 | { } /* end */ |
| 7508 | }; |
| 7509 | |
| 7510 | /* |
| 7511 | * 4ch mode |
| 7512 | */ |
| 7513 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7514 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7515 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7516 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7517 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7518 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7519 | { } /* end */ |
| 7520 | }; |
| 7521 | |
| 7522 | /* |
| 7523 | * 6ch mode |
| 7524 | */ |
| 7525 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7526 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7527 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7528 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7529 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7530 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7531 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7532 | { } /* end */ |
| 7533 | }; |
| 7534 | |
| 7535 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7536 | { 2, alc883_3ST_ch2_intel_init }, |
| 7537 | { 4, alc883_3ST_ch4_intel_init }, |
| 7538 | { 6, alc883_3ST_ch6_intel_init }, |
| 7539 | }; |
| 7540 | |
| 7541 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7542 | * 6ch mode |
| 7543 | */ |
| 7544 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7545 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7546 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7547 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7548 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7549 | { } /* end */ |
| 7550 | }; |
| 7551 | |
| 7552 | /* |
| 7553 | * 8ch mode |
| 7554 | */ |
| 7555 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7556 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7557 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7558 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7559 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7560 | { } /* end */ |
| 7561 | }; |
| 7562 | |
| 7563 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7564 | { 6, alc883_sixstack_ch6_init }, |
| 7565 | { 8, alc883_sixstack_ch8_init }, |
| 7566 | }; |
| 7567 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7568 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7569 | /* eanable EAPD on medion laptop */ |
| 7570 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7571 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7572 | { } |
| 7573 | }; |
| 7574 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7575 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7576 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7577 | */ |
| 7578 | |
| 7579 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7580 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7581 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7582 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7583 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7584 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7585 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7586 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7587 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7588 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7589 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7590 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7591 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7592 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7593 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7594 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7595 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7596 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7597 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7598 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7599 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7600 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7601 | { } /* end */ |
| 7602 | }; |
| 7603 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7604 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7605 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7606 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7607 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7608 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7609 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7610 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7611 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7612 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7613 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7614 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7615 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7616 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7617 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7618 | { } /* end */ |
| 7619 | }; |
| 7620 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7621 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7622 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7623 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7624 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7625 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7626 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7627 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7628 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7629 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7630 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7631 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7632 | { } /* end */ |
| 7633 | }; |
| 7634 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7635 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7636 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7637 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7638 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7639 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7640 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7641 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7642 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7643 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7644 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7645 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7646 | { } /* end */ |
| 7647 | }; |
| 7648 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7649 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7650 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7651 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7652 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7653 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7654 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7655 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7656 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7657 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7658 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7659 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7660 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7661 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7662 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7663 | { } /* end */ |
| 7664 | }; |
| 7665 | |
| 7666 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7667 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7668 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7669 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7670 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7671 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7672 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7673 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7674 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7675 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7676 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7677 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7678 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7679 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7680 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7681 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7682 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7683 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7684 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7685 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7686 | { } /* end */ |
| 7687 | }; |
| 7688 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7689 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7690 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7691 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7692 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7693 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7694 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7695 | HDA_OUTPUT), |
| 7696 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7697 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7698 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7699 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7700 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7701 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7702 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7703 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7704 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7705 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7706 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7707 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7708 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7709 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7710 | { } /* end */ |
| 7711 | }; |
| 7712 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7713 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7714 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7715 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7716 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7717 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7718 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7719 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7720 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7721 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7722 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7723 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7724 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7725 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7726 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7727 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7728 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7729 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7730 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7731 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7732 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7733 | { } /* end */ |
| 7734 | }; |
| 7735 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7736 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7737 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7738 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7739 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7740 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7741 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7742 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7743 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7744 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7745 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 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, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7751 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7752 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7753 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7754 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7755 | |
| 7756 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7757 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7758 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7759 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7760 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7761 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7762 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7763 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7764 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7765 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7766 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7767 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7768 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7769 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7770 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7771 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7772 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7773 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7774 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7775 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7776 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7777 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7778 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7779 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7780 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7781 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7782 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7783 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7784 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7785 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7786 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7787 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7788 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7789 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7790 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7791 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7792 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7793 | { } /* end */ |
| 7794 | }; |
| 7795 | |
| 7796 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7797 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7798 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7799 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7800 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7801 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7802 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7803 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7804 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7805 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7806 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7807 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7808 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7809 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7810 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7811 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7812 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7813 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7814 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7815 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7816 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7817 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7818 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7819 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7820 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7821 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7822 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7823 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7824 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7825 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7826 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7827 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7828 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7829 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7830 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7831 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7832 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7833 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7834 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7835 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7836 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7837 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7838 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7839 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7840 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7841 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7842 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7843 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7844 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7845 | { } /* end */ |
| 7846 | }; |
| 7847 | |
| 7848 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7849 | .ops = &snd_hda_bind_vol, |
| 7850 | .values = { |
| 7851 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7852 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7853 | 0 |
| 7854 | }, |
| 7855 | }; |
| 7856 | |
| 7857 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7858 | .ops = &snd_hda_bind_sw, |
| 7859 | .values = { |
| 7860 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7861 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7862 | 0 |
| 7863 | }, |
| 7864 | }; |
| 7865 | |
| 7866 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7867 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7868 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7869 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7870 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7871 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7872 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7873 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7874 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7875 | { } /* end */ |
| 7876 | }; |
| 7877 | |
| 7878 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7879 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7880 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7881 | { |
| 7882 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7883 | /* .name = "Capture Source", */ |
| 7884 | .name = "Input Source", |
| 7885 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7886 | .info = alc_mux_enum_info, |
| 7887 | .get = alc_mux_enum_get, |
| 7888 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7889 | }, |
| 7890 | { } /* end */ |
| 7891 | }; |
| 7892 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7893 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7894 | { |
| 7895 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7896 | .name = "Channel Mode", |
| 7897 | .info = alc_ch_mode_info, |
| 7898 | .get = alc_ch_mode_get, |
| 7899 | .put = alc_ch_mode_put, |
| 7900 | }, |
| 7901 | { } /* end */ |
| 7902 | }; |
| 7903 | |
| 7904 | static struct hda_verb alc883_init_verbs[] = { |
| 7905 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7906 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7907 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7908 | /* ADC2: mute amp left and right */ |
| 7909 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7910 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7911 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7912 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7913 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7914 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7915 | /* Rear mixer */ |
| 7916 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7917 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7918 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7919 | /* CLFE mixer */ |
| 7920 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7921 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7923 | /* Side mixer */ |
| 7924 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7925 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7926 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7927 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7928 | /* mute analog input loopbacks */ |
| 7929 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7930 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7932 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7933 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7934 | |
| 7935 | /* Front Pin: output 0 (0x0c) */ |
| 7936 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7937 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7938 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7939 | /* Rear Pin: output 1 (0x0d) */ |
| 7940 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7941 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7942 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7943 | /* CLFE Pin: output 2 (0x0e) */ |
| 7944 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7945 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7946 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7947 | /* Side Pin: output 3 (0x0f) */ |
| 7948 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7949 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7950 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7951 | /* Mic (rear) pin: input vref at 80% */ |
| 7952 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7953 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7954 | /* Front Mic pin: input vref at 80% */ |
| 7955 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7956 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7957 | /* Line In pin: input */ |
| 7958 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7959 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7960 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7961 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7962 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7963 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7964 | /* CD pin widget for input */ |
| 7965 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7966 | |
| 7967 | /* FIXME: use matrix-type input source selection */ |
| 7968 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7969 | /* Input mixer2 */ |
| 7970 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7971 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7972 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7973 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7974 | /* Input mixer3 */ |
| 7975 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7976 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7977 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7978 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7979 | { } |
| 7980 | }; |
| 7981 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7982 | /* toggle speaker-output according to the hp-jack state */ |
| 7983 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7984 | { |
| 7985 | unsigned int present; |
| 7986 | |
| 7987 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7988 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7989 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7990 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7991 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7992 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7993 | } |
| 7994 | |
| 7995 | /* auto-toggle front mic */ |
| 7996 | /* |
| 7997 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7998 | { |
| 7999 | unsigned int present; |
| 8000 | unsigned char bits; |
| 8001 | |
| 8002 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8003 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8004 | bits = present ? HDA_AMP_MUTE : 0; |
| 8005 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8006 | } |
| 8007 | */ |
| 8008 | |
| 8009 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 8010 | { |
| 8011 | alc883_mitac_hp_automute(codec); |
| 8012 | /* alc883_mitac_mic_automute(codec); */ |
| 8013 | } |
| 8014 | |
| 8015 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 8016 | unsigned int res) |
| 8017 | { |
| 8018 | switch (res >> 26) { |
| 8019 | case ALC880_HP_EVENT: |
| 8020 | alc883_mitac_hp_automute(codec); |
| 8021 | break; |
| 8022 | case ALC880_MIC_EVENT: |
| 8023 | /* alc883_mitac_mic_automute(codec); */ |
| 8024 | break; |
| 8025 | } |
| 8026 | } |
| 8027 | |
| 8028 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8029 | /* HP */ |
| 8030 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8031 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8032 | /* Subwoofer */ |
| 8033 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8034 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8035 | |
| 8036 | /* enable unsolicited event */ |
| 8037 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8038 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8039 | |
| 8040 | { } /* end */ |
| 8041 | }; |
| 8042 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8043 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8044 | /* HP */ |
| 8045 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8046 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8047 | /* Int speaker */ |
| 8048 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8049 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8050 | |
| 8051 | /* enable unsolicited event */ |
| 8052 | {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] | 8053 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8054 | |
| 8055 | { } /* end */ |
| 8056 | }; |
| 8057 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8058 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8059 | /* HP */ |
| 8060 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8062 | /* Subwoofer */ |
| 8063 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8064 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8065 | |
| 8066 | /* enable unsolicited event */ |
| 8067 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8068 | |
| 8069 | { } /* end */ |
| 8070 | }; |
| 8071 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8072 | static struct hda_verb alc883_tagra_verbs[] = { |
| 8073 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8074 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8075 | |
| 8076 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8077 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8078 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8079 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8080 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8081 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8082 | |
| 8083 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8084 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 8085 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 8086 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8087 | |
| 8088 | { } /* end */ |
| 8089 | }; |
| 8090 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8091 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8092 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8093 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8094 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8095 | { } /* end */ |
| 8096 | }; |
| 8097 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8098 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8099 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8100 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8101 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8102 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8103 | { } /* end */ |
| 8104 | }; |
| 8105 | |
| 8106 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8107 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8108 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8109 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8110 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8111 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8112 | { } /* end */ |
| 8113 | }; |
| 8114 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8115 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8117 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8118 | |
| 8119 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8120 | |
| 8121 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8122 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8123 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8124 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8125 | { } /* end */ |
| 8126 | }; |
| 8127 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8128 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8130 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8131 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8132 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8133 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8134 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8135 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8136 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8137 | { } /* end */ |
| 8138 | }; |
| 8139 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8140 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8141 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8142 | { } |
| 8143 | }; |
| 8144 | |
| 8145 | static void alc888_3st_hp_front_automute(struct hda_codec *codec) |
| 8146 | { |
| 8147 | unsigned int present, bits; |
| 8148 | |
| 8149 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8150 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8151 | bits = present ? HDA_AMP_MUTE : 0; |
| 8152 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8153 | HDA_AMP_MUTE, bits); |
| 8154 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8155 | HDA_AMP_MUTE, bits); |
| 8156 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 8157 | HDA_AMP_MUTE, bits); |
| 8158 | } |
| 8159 | |
| 8160 | static void alc888_3st_hp_unsol_event(struct hda_codec *codec, |
| 8161 | unsigned int res) |
| 8162 | { |
| 8163 | switch (res >> 26) { |
| 8164 | case ALC880_HP_EVENT: |
| 8165 | alc888_3st_hp_front_automute(codec); |
| 8166 | break; |
| 8167 | } |
| 8168 | } |
| 8169 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8170 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8171 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8172 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8173 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8174 | {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] | 8175 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8176 | }; |
| 8177 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8178 | /* |
| 8179 | * 2ch mode |
| 8180 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8181 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8182 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8183 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8184 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8185 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8186 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8187 | }; |
| 8188 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8189 | /* |
| 8190 | * 4ch mode |
| 8191 | */ |
| 8192 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8193 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8194 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8195 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8196 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8197 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8198 | { } /* end */ |
| 8199 | }; |
| 8200 | |
| 8201 | /* |
| 8202 | * 6ch mode |
| 8203 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8204 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8205 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8206 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8207 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8208 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8209 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8210 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8211 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8212 | }; |
| 8213 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8214 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8215 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8216 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8217 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8218 | }; |
| 8219 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8220 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8221 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8222 | { |
| 8223 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8224 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8225 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8226 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8227 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8228 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8229 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8230 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8231 | } |
| 8232 | |
| 8233 | /* toggle RCA according to the front-jack state */ |
| 8234 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8235 | { |
| 8236 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8237 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8238 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8239 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8240 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8241 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8242 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8243 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8244 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8245 | unsigned int res) |
| 8246 | { |
| 8247 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8248 | alc888_lenovo_ms7195_front_automute(codec); |
| 8249 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8250 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8251 | } |
| 8252 | |
| 8253 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8254 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8255 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8256 | |
| 8257 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8258 | |
| 8259 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8260 | { } /* end */ |
| 8261 | }; |
| 8262 | |
| 8263 | /* toggle speaker-output according to the hp-jack state */ |
| 8264 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 8265 | { |
| 8266 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8267 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8268 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8269 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8270 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8271 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8272 | } |
| 8273 | |
| 8274 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 8275 | unsigned int res) |
| 8276 | { |
| 8277 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8278 | alc883_medion_md2_automute(codec); |
| 8279 | } |
| 8280 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8281 | /* toggle speaker-output according to the hp-jack state */ |
| 8282 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 8283 | { |
| 8284 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8285 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8286 | |
| 8287 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8288 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8289 | bits = present ? HDA_AMP_MUTE : 0; |
| 8290 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8291 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8292 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 8293 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8294 | } |
| 8295 | |
| 8296 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8297 | { |
| 8298 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8299 | alc883_tagra_automute(codec); |
| 8300 | } |
| 8301 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8302 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8303 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8304 | { |
| 8305 | unsigned int present; |
| 8306 | unsigned char bits; |
| 8307 | |
| 8308 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8309 | & AC_PINSENSE_PRESENCE; |
| 8310 | bits = present ? HDA_AMP_MUTE : 0; |
| 8311 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8312 | HDA_AMP_MUTE, bits); |
| 8313 | } |
| 8314 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8315 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8316 | { |
| 8317 | unsigned int present; |
| 8318 | |
| 8319 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8320 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8321 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8322 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8323 | } |
| 8324 | |
| 8325 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 8326 | { |
| 8327 | alc883_clevo_m720_hp_automute(codec); |
| 8328 | alc883_clevo_m720_mic_automute(codec); |
| 8329 | } |
| 8330 | |
| 8331 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8332 | unsigned int res) |
| 8333 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8334 | switch (res >> 26) { |
| 8335 | case ALC880_HP_EVENT: |
| 8336 | alc883_clevo_m720_hp_automute(codec); |
| 8337 | break; |
| 8338 | case ALC880_MIC_EVENT: |
| 8339 | alc883_clevo_m720_mic_automute(codec); |
| 8340 | break; |
| 8341 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8342 | } |
| 8343 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8344 | /* toggle speaker-output according to the hp-jack state */ |
| 8345 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 8346 | { |
| 8347 | unsigned int present; |
| 8348 | unsigned char bits; |
| 8349 | |
| 8350 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8351 | & AC_PINSENSE_PRESENCE; |
| 8352 | bits = present ? HDA_AMP_MUTE : 0; |
| 8353 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8354 | HDA_AMP_MUTE, bits); |
| 8355 | } |
| 8356 | |
| 8357 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 8358 | unsigned int res) |
| 8359 | { |
| 8360 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8361 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 8362 | } |
| 8363 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8364 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 8365 | { |
| 8366 | unsigned int present; |
| 8367 | unsigned char bits; |
| 8368 | |
| 8369 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8370 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8371 | bits = present ? 0x80 : 0; |
| 8372 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8373 | 0x80, bits); |
| 8374 | } |
| 8375 | |
| 8376 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 8377 | unsigned int res) |
| 8378 | { |
| 8379 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8380 | alc883_haier_w66_automute(codec); |
| 8381 | } |
| 8382 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8383 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8384 | { |
| 8385 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8386 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8387 | |
| 8388 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8389 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8390 | bits = present ? HDA_AMP_MUTE : 0; |
| 8391 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8392 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8393 | } |
| 8394 | |
| 8395 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8396 | { |
| 8397 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8398 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8399 | |
| 8400 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8401 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8402 | bits = present ? HDA_AMP_MUTE : 0; |
| 8403 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8404 | HDA_AMP_MUTE, bits); |
| 8405 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8406 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8407 | } |
| 8408 | |
| 8409 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8410 | unsigned int res) |
| 8411 | { |
| 8412 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8413 | alc883_lenovo_101e_all_automute(codec); |
| 8414 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8415 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8416 | } |
| 8417 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8418 | /* toggle speaker-output according to the hp-jack state */ |
| 8419 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 8420 | { |
| 8421 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8422 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8423 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8424 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8425 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8426 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8427 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8428 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8429 | } |
| 8430 | |
| 8431 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 8432 | unsigned int res) |
| 8433 | { |
| 8434 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8435 | alc883_acer_aspire_automute(codec); |
| 8436 | } |
| 8437 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8438 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8439 | /* HP Pin: output 0 (0x0c) */ |
| 8440 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8441 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8442 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8443 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8444 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8445 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8446 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8447 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8448 | /* eanable EAPD on medion laptop */ |
| 8449 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8450 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8451 | /* enable unsolicited event */ |
| 8452 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8453 | { } |
| 8454 | }; |
| 8455 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8456 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 8457 | { |
| 8458 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8459 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8460 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8461 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8462 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8463 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8464 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8465 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8466 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8467 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8468 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8469 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8470 | } |
| 8471 | |
| 8472 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 8473 | unsigned int res) |
| 8474 | { |
| 8475 | switch (res >> 26) { |
| 8476 | case ALC880_HP_EVENT: |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 8477 | /* printk(KERN_DEBUG "hp_event\n"); */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8478 | alc888_6st_dell_front_automute(codec); |
| 8479 | break; |
| 8480 | } |
| 8481 | } |
| 8482 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8483 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 8484 | { |
| 8485 | unsigned int mute; |
| 8486 | unsigned int present; |
| 8487 | |
| 8488 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8489 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8490 | AC_VERB_GET_PIN_SENSE, 0); |
| 8491 | present = (present & 0x80000000) != 0; |
| 8492 | if (present) { |
| 8493 | /* mute internal speaker */ |
| 8494 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8495 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8496 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8497 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8498 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8499 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8500 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8501 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8502 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8503 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8504 | } else { |
| 8505 | /* unmute internal speaker if necessary */ |
| 8506 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8507 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8508 | HDA_AMP_MUTE, mute); |
| 8509 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8510 | HDA_AMP_MUTE, mute); |
| 8511 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8512 | HDA_AMP_MUTE, mute); |
| 8513 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8514 | HDA_AMP_MUTE, mute); |
| 8515 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8516 | HDA_AMP_MUTE, mute); |
| 8517 | } |
| 8518 | } |
| 8519 | |
| 8520 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 8521 | unsigned int res) |
| 8522 | { |
| 8523 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8524 | alc888_lenovo_sky_front_automute(codec); |
| 8525 | } |
| 8526 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8527 | /* |
| 8528 | * generic initialization of ADC, input mixers and output mixers |
| 8529 | */ |
| 8530 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8531 | /* |
| 8532 | * Unmute ADC0-2 and set the default input to mic-in |
| 8533 | */ |
| 8534 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8535 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8536 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8537 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8538 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8539 | /* 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] | 8540 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8541 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8542 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8543 | */ |
| 8544 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8545 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8546 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8547 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8548 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8549 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8550 | |
| 8551 | /* |
| 8552 | * Set up output mixers (0x0c - 0x0f) |
| 8553 | */ |
| 8554 | /* set vol=0 to output mixers */ |
| 8555 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8556 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8557 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8558 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8559 | /* set up input amps for analog loopback */ |
| 8560 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8561 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8562 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8563 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8564 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8565 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8566 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8567 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8568 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8569 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8570 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8571 | |
| 8572 | /* FIXME: use matrix-type input source selection */ |
| 8573 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8574 | /* Input mixer1 */ |
| 8575 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8576 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8577 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8578 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8579 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8580 | /* Input mixer2 */ |
| 8581 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8582 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8583 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8584 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8585 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8586 | |
| 8587 | { } |
| 8588 | }; |
| 8589 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8590 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8591 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8592 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8593 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8594 | /* enable unsolicited event */ |
| 8595 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8596 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8597 | { } /* end */ |
| 8598 | }; |
| 8599 | |
| 8600 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8601 | { |
| 8602 | unsigned int present; |
| 8603 | |
| 8604 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8605 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8606 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8607 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8608 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8609 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8610 | } |
| 8611 | |
| 8612 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8613 | { |
| 8614 | unsigned int present; |
| 8615 | unsigned char bits; |
| 8616 | |
| 8617 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8618 | AC_VERB_GET_PIN_SENSE, 0) |
| 8619 | & AC_PINSENSE_PRESENCE; |
| 8620 | bits = present ? 0 : PIN_OUT; |
| 8621 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8622 | bits); |
| 8623 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8624 | bits); |
| 8625 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8626 | bits); |
| 8627 | } |
| 8628 | |
| 8629 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8630 | unsigned int res) |
| 8631 | { |
| 8632 | switch (res >> 26) { |
| 8633 | case ALC880_HP_EVENT: |
| 8634 | alc883_M90V_speaker_automute(codec); |
| 8635 | break; |
| 8636 | case ALC880_MIC_EVENT: |
| 8637 | alc883_nb_mic_automute(codec); |
| 8638 | break; |
| 8639 | } |
| 8640 | } |
| 8641 | |
| 8642 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8643 | { |
| 8644 | alc883_M90V_speaker_automute(codec); |
| 8645 | alc883_nb_mic_automute(codec); |
| 8646 | } |
| 8647 | |
| 8648 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8649 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8650 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8651 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8652 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8653 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8654 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8655 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8656 | /* enable unsolicited event */ |
| 8657 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8658 | { } /* end */ |
| 8659 | }; |
| 8660 | |
| 8661 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8662 | { |
| 8663 | unsigned int present; |
| 8664 | unsigned char bits; |
| 8665 | |
| 8666 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8667 | AC_VERB_GET_PIN_SENSE, 0) |
| 8668 | & AC_PINSENSE_PRESENCE; |
| 8669 | bits = present ? 0 : PIN_OUT; |
| 8670 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8671 | bits); |
| 8672 | } |
| 8673 | |
| 8674 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8675 | unsigned int res) |
| 8676 | { |
| 8677 | switch (res >> 26) { |
| 8678 | case ALC880_HP_EVENT: |
| 8679 | alc883_eee1601_speaker_automute(codec); |
| 8680 | break; |
| 8681 | } |
| 8682 | } |
| 8683 | |
| 8684 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8685 | { |
| 8686 | alc883_eee1601_speaker_automute(codec); |
| 8687 | } |
| 8688 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8689 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8690 | #define alc883_loopbacks alc880_loopbacks |
| 8691 | #endif |
| 8692 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8693 | /* pcm configuration: identiacal with ALC880 */ |
| 8694 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8695 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8696 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8697 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8698 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8699 | |
| 8700 | /* |
| 8701 | * configuration and preset |
| 8702 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8703 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8704 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8705 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8706 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8707 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8708 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8709 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8710 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8711 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8712 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8713 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8714 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8715 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8716 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8717 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8718 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8719 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8720 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8721 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8722 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8723 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8724 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8725 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8726 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8727 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8728 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8729 | [ALC883_AUTO] = "auto", |
| 8730 | }; |
| 8731 | |
| 8732 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8733 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8734 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8735 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8736 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8737 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8738 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8739 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8740 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8741 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8742 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8743 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | b3bdb30 | 2009-02-18 13:16:26 +0100 | [diff] [blame] | 8744 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), |
Takashi Iwai | 9468350 | 2009-02-13 09:31:20 +0100 | [diff] [blame] | 8745 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8746 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 8747 | ALC888_ACER_ASPIRE_4930G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8748 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
| 8749 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8750 | /* default Acer */ |
| 8751 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8752 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8753 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8754 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8755 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8756 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8757 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8758 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8759 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8760 | 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] | 8761 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8762 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8763 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8764 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8765 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8766 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8767 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8768 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8769 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8770 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8771 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8772 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8773 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8774 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8775 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8776 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8777 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8778 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8779 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8780 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8781 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8782 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8783 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8784 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8785 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8786 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8787 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8788 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8789 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8790 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8791 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8792 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8793 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8794 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8795 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8796 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8797 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8798 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8799 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8800 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8801 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8802 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8803 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8804 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8805 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8806 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8807 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8808 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8809 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8810 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8811 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8812 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8813 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8814 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8815 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8816 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 8817 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8818 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8819 | {} |
| 8820 | }; |
| 8821 | |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8822 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8823 | ALC1200_DIGOUT_NID, 0, |
| 8824 | }; |
| 8825 | |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 8826 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8827 | ALC883_DIGOUT_NID, 0, |
| 8828 | }; |
| 8829 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8830 | static struct alc_config_preset alc883_presets[] = { |
| 8831 | [ALC883_3ST_2ch_DIG] = { |
| 8832 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8833 | .init_verbs = { alc883_init_verbs }, |
| 8834 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8835 | .dac_nids = alc883_dac_nids, |
| 8836 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8837 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8838 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8839 | .channel_mode = alc883_3ST_2ch_modes, |
| 8840 | .input_mux = &alc883_capture_source, |
| 8841 | }, |
| 8842 | [ALC883_3ST_6ch_DIG] = { |
| 8843 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8844 | .init_verbs = { alc883_init_verbs }, |
| 8845 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8846 | .dac_nids = alc883_dac_nids, |
| 8847 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8848 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8849 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8850 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8851 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8852 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8853 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8854 | [ALC883_3ST_6ch] = { |
| 8855 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8856 | .init_verbs = { alc883_init_verbs }, |
| 8857 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8858 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8859 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8860 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8861 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8862 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8863 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8864 | [ALC883_3ST_6ch_INTEL] = { |
| 8865 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8866 | .init_verbs = { alc883_init_verbs }, |
| 8867 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8868 | .dac_nids = alc883_dac_nids, |
| 8869 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8870 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8871 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8872 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8873 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8874 | .need_dac_fix = 1, |
| 8875 | .input_mux = &alc883_3stack_6ch_intel, |
| 8876 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8877 | [ALC883_6ST_DIG] = { |
| 8878 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8879 | .init_verbs = { alc883_init_verbs }, |
| 8880 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8881 | .dac_nids = alc883_dac_nids, |
| 8882 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8883 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8884 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8885 | .channel_mode = alc883_sixstack_modes, |
| 8886 | .input_mux = &alc883_capture_source, |
| 8887 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8888 | [ALC883_TARGA_DIG] = { |
| 8889 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8890 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8891 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8892 | .dac_nids = alc883_dac_nids, |
| 8893 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8894 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8895 | .channel_mode = alc883_3ST_6ch_modes, |
| 8896 | .need_dac_fix = 1, |
| 8897 | .input_mux = &alc883_capture_source, |
| 8898 | .unsol_event = alc883_tagra_unsol_event, |
| 8899 | .init_hook = alc883_tagra_automute, |
| 8900 | }, |
| 8901 | [ALC883_TARGA_2ch_DIG] = { |
| 8902 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8903 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8904 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8905 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8906 | .adc_nids = alc883_adc_nids_alt, |
| 8907 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8908 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8909 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8910 | .channel_mode = alc883_3ST_2ch_modes, |
| 8911 | .input_mux = &alc883_capture_source, |
| 8912 | .unsol_event = alc883_tagra_unsol_event, |
| 8913 | .init_hook = alc883_tagra_automute, |
| 8914 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8915 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8916 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8917 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8918 | * and the headphone jack. Turn this on and rely on the |
| 8919 | * standard mute methods whenever the user wants to turn |
| 8920 | * these outputs off. |
| 8921 | */ |
| 8922 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8923 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8924 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8925 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8926 | .channel_mode = alc883_3ST_2ch_modes, |
| 8927 | .input_mux = &alc883_capture_source, |
| 8928 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8929 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8930 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8931 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8932 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8933 | .dac_nids = alc883_dac_nids, |
| 8934 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8935 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8936 | .channel_mode = alc883_3ST_2ch_modes, |
| 8937 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8938 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8939 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8940 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8941 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8942 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8943 | alc883_chmode_mixer }, |
| 8944 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8945 | alc888_acer_aspire_4930g_verbs }, |
| 8946 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8947 | .dac_nids = alc883_dac_nids, |
| 8948 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8949 | .adc_nids = alc883_adc_nids_rev, |
| 8950 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8951 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8952 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8953 | .channel_mode = alc883_3ST_6ch_modes, |
| 8954 | .need_dac_fix = 1, |
| 8955 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8956 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8957 | .input_mux = alc888_2_capture_sources, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8958 | .unsol_event = alc888_acer_aspire_4930g_unsol_event, |
| 8959 | .init_hook = alc888_acer_aspire_4930g_automute, |
| 8960 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8961 | [ALC883_MEDION] = { |
| 8962 | .mixers = { alc883_fivestack_mixer, |
| 8963 | alc883_chmode_mixer }, |
| 8964 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8965 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8966 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8967 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8968 | .adc_nids = alc883_adc_nids_alt, |
| 8969 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8970 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8971 | .channel_mode = alc883_sixstack_modes, |
| 8972 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8973 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8974 | [ALC883_MEDION_MD2] = { |
| 8975 | .mixers = { alc883_medion_md2_mixer}, |
| 8976 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8977 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8978 | .dac_nids = alc883_dac_nids, |
| 8979 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8980 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8981 | .channel_mode = alc883_3ST_2ch_modes, |
| 8982 | .input_mux = &alc883_capture_source, |
| 8983 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8984 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8985 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8986 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8987 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8988 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8989 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8990 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8991 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8992 | .channel_mode = alc883_3ST_2ch_modes, |
| 8993 | .input_mux = &alc883_capture_source, |
| 8994 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8995 | [ALC883_CLEVO_M720] = { |
| 8996 | .mixers = { alc883_clevo_m720_mixer }, |
| 8997 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8998 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8999 | .dac_nids = alc883_dac_nids, |
| 9000 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9001 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9002 | .channel_mode = alc883_3ST_2ch_modes, |
| 9003 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9004 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 9005 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9006 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9007 | [ALC883_LENOVO_101E_2ch] = { |
| 9008 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9009 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9010 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9011 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9012 | .adc_nids = alc883_adc_nids_alt, |
| 9013 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9014 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9015 | .channel_mode = alc883_3ST_2ch_modes, |
| 9016 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9017 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9018 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9019 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9020 | [ALC883_LENOVO_NB0763] = { |
| 9021 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9022 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9023 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9024 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9025 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9026 | .channel_mode = alc883_3ST_2ch_modes, |
| 9027 | .need_dac_fix = 1, |
| 9028 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 9029 | .unsol_event = alc883_medion_md2_unsol_event, |
| 9030 | .init_hook = alc883_medion_md2_automute, |
| 9031 | }, |
| 9032 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9033 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9034 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9035 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9036 | .dac_nids = alc883_dac_nids, |
| 9037 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9038 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9039 | .channel_mode = alc883_3ST_6ch_modes, |
| 9040 | .need_dac_fix = 1, |
| 9041 | .input_mux = &alc883_capture_source, |
| 9042 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9043 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9044 | }, |
| 9045 | [ALC883_HAIER_W66] = { |
| 9046 | .mixers = { alc883_tagra_2ch_mixer}, |
| 9047 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9048 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9049 | .dac_nids = alc883_dac_nids, |
| 9050 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9051 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9052 | .channel_mode = alc883_3ST_2ch_modes, |
| 9053 | .input_mux = &alc883_capture_source, |
| 9054 | .unsol_event = alc883_haier_w66_unsol_event, |
| 9055 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9056 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9057 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9058 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9059 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9060 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9061 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9062 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9063 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9064 | .need_dac_fix = 1, |
| 9065 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9066 | .unsol_event = alc888_3st_hp_unsol_event, |
| 9067 | .init_hook = alc888_3st_hp_front_automute, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9068 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9069 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9070 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9071 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9072 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9073 | .dac_nids = alc883_dac_nids, |
| 9074 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9075 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9076 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9077 | .channel_mode = alc883_sixstack_modes, |
| 9078 | .input_mux = &alc883_capture_source, |
| 9079 | .unsol_event = alc888_6st_dell_unsol_event, |
| 9080 | .init_hook = alc888_6st_dell_front_automute, |
| 9081 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9082 | [ALC883_MITAC] = { |
| 9083 | .mixers = { alc883_mitac_mixer }, |
| 9084 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9085 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9086 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9087 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9088 | .channel_mode = alc883_3ST_2ch_modes, |
| 9089 | .input_mux = &alc883_capture_source, |
| 9090 | .unsol_event = alc883_mitac_unsol_event, |
| 9091 | .init_hook = alc883_mitac_automute, |
| 9092 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9093 | [ALC883_FUJITSU_PI2515] = { |
| 9094 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9095 | .init_verbs = { alc883_init_verbs, |
| 9096 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9097 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9098 | .dac_nids = alc883_dac_nids, |
| 9099 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9100 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9101 | .channel_mode = alc883_3ST_2ch_modes, |
| 9102 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9103 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 9104 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 9105 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9106 | [ALC888_FUJITSU_XA3530] = { |
| 9107 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9108 | .init_verbs = { alc883_init_verbs, |
| 9109 | alc888_fujitsu_xa3530_verbs }, |
| 9110 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9111 | .dac_nids = alc883_dac_nids, |
| 9112 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9113 | .adc_nids = alc883_adc_nids_rev, |
| 9114 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9115 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9116 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9117 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9118 | .num_mux_defs = |
| 9119 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9120 | .input_mux = alc888_2_capture_sources, |
| 9121 | .unsol_event = alc888_fujitsu_xa3530_unsol_event, |
| 9122 | .init_hook = alc888_fujitsu_xa3530_automute, |
| 9123 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9124 | [ALC888_LENOVO_SKY] = { |
| 9125 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9126 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9127 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9128 | .dac_nids = alc883_dac_nids, |
| 9129 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9130 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9131 | .channel_mode = alc883_sixstack_modes, |
| 9132 | .need_dac_fix = 1, |
| 9133 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 9134 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 9135 | .init_hook = alc888_lenovo_sky_front_automute, |
| 9136 | }, |
| 9137 | [ALC888_ASUS_M90V] = { |
| 9138 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9139 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9140 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9141 | .dac_nids = alc883_dac_nids, |
| 9142 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9143 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9144 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9145 | .channel_mode = alc883_3ST_6ch_modes, |
| 9146 | .need_dac_fix = 1, |
| 9147 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9148 | .unsol_event = alc883_mode2_unsol_event, |
| 9149 | .init_hook = alc883_mode2_inithook, |
| 9150 | }, |
| 9151 | [ALC888_ASUS_EEE1601] = { |
| 9152 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9153 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9154 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9155 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9156 | .dac_nids = alc883_dac_nids, |
| 9157 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9158 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9159 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9160 | .channel_mode = alc883_3ST_2ch_modes, |
| 9161 | .need_dac_fix = 1, |
| 9162 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 9163 | .unsol_event = alc883_eee1601_unsol_event, |
| 9164 | .init_hook = alc883_eee1601_inithook, |
| 9165 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9166 | [ALC1200_ASUS_P5Q] = { |
| 9167 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9168 | .init_verbs = { alc883_init_verbs }, |
| 9169 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9170 | .dac_nids = alc883_dac_nids, |
| 9171 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9172 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9173 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9174 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9175 | .channel_mode = alc883_sixstack_modes, |
| 9176 | .input_mux = &alc883_capture_source, |
| 9177 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9178 | }; |
| 9179 | |
| 9180 | |
| 9181 | /* |
| 9182 | * BIOS auto configuration |
| 9183 | */ |
| 9184 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9185 | hda_nid_t nid, int pin_type, |
| 9186 | int dac_idx) |
| 9187 | { |
| 9188 | /* set as output */ |
| 9189 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9190 | int idx; |
| 9191 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9192 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9193 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9194 | idx = 4; |
| 9195 | else |
| 9196 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9197 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9198 | |
| 9199 | } |
| 9200 | |
| 9201 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 9202 | { |
| 9203 | struct alc_spec *spec = codec->spec; |
| 9204 | int i; |
| 9205 | |
| 9206 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9207 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9208 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9209 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9210 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9211 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9212 | } |
| 9213 | } |
| 9214 | |
| 9215 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 9216 | { |
| 9217 | struct alc_spec *spec = codec->spec; |
| 9218 | hda_nid_t pin; |
| 9219 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9220 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9221 | if (pin) /* connect to front */ |
| 9222 | /* use dac 0 */ |
| 9223 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9224 | pin = spec->autocfg.speaker_pins[0]; |
| 9225 | if (pin) |
| 9226 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9227 | } |
| 9228 | |
| 9229 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9230 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 9231 | |
| 9232 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 9233 | { |
| 9234 | struct alc_spec *spec = codec->spec; |
| 9235 | int i; |
| 9236 | |
| 9237 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9238 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9239 | if (alc883_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 9240 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 9241 | if (nid != ALC883_PIN_CD_NID && |
| 9242 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9243 | snd_hda_codec_write(codec, nid, 0, |
| 9244 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9245 | AMP_OUT_MUTE); |
| 9246 | } |
| 9247 | } |
| 9248 | } |
| 9249 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9250 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 9251 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9252 | /* almost identical with ALC880 parser... */ |
| 9253 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 9254 | { |
| 9255 | struct alc_spec *spec = codec->spec; |
| 9256 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9257 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 9258 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9259 | |
| 9260 | if (err < 0) |
| 9261 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9262 | else if (!err) |
| 9263 | return 0; /* no config found */ |
| 9264 | |
| 9265 | err = alc_auto_add_mic_boost(codec); |
| 9266 | if (err < 0) |
| 9267 | return err; |
| 9268 | |
| 9269 | /* hack - override the init verbs */ |
| 9270 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9271 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9272 | /* setup input_mux for ALC889 */ |
| 9273 | if (codec->vendor_id == 0x10ec0889) { |
| 9274 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9275 | * because it's under 0x18 |
| 9276 | */ |
| 9277 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9278 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9279 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9280 | for (i = 1; i < 3; i++) |
| 9281 | memcpy(&spec->private_imux[i], |
| 9282 | &spec->private_imux[0], |
| 9283 | sizeof(spec->private_imux[0])); |
| 9284 | imux->items[imux->num_items].label = "Int DMic"; |
| 9285 | imux->items[imux->num_items].index = 0x0b; |
| 9286 | imux->num_items++; |
| 9287 | spec->num_mux_defs = 3; |
| 9288 | spec->input_mux = spec->private_imux; |
| 9289 | } |
| 9290 | } |
| 9291 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9292 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9293 | } |
| 9294 | |
| 9295 | /* additional initialization for auto-configuration model */ |
| 9296 | static void alc883_auto_init(struct hda_codec *codec) |
| 9297 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9298 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9299 | alc883_auto_init_multi_out(codec); |
| 9300 | alc883_auto_init_hp_out(codec); |
| 9301 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9302 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9303 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9304 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9305 | } |
| 9306 | |
| 9307 | static int patch_alc883(struct hda_codec *codec) |
| 9308 | { |
| 9309 | struct alc_spec *spec; |
| 9310 | int err, board_config; |
| 9311 | |
| 9312 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9313 | if (spec == NULL) |
| 9314 | return -ENOMEM; |
| 9315 | |
| 9316 | codec->spec = spec; |
| 9317 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9318 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9319 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9320 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9321 | alc883_models, |
| 9322 | alc883_cfg_tbl); |
| 9323 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9324 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 9325 | "trying auto-probe from BIOS...\n"); |
| 9326 | board_config = ALC883_AUTO; |
| 9327 | } |
| 9328 | |
| 9329 | if (board_config == ALC883_AUTO) { |
| 9330 | /* automatic parse from the BIOS config */ |
| 9331 | err = alc883_parse_auto_config(codec); |
| 9332 | if (err < 0) { |
| 9333 | alc_free(codec); |
| 9334 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9335 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9336 | printk(KERN_INFO |
| 9337 | "hda_codec: Cannot set up configuration " |
| 9338 | "from BIOS. Using base mode...\n"); |
| 9339 | board_config = ALC883_3ST_2ch_DIG; |
| 9340 | } |
| 9341 | } |
| 9342 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9343 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9344 | if (err < 0) { |
| 9345 | alc_free(codec); |
| 9346 | return err; |
| 9347 | } |
| 9348 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9349 | if (board_config != ALC883_AUTO) |
| 9350 | setup_preset(spec, &alc883_presets[board_config]); |
| 9351 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9352 | switch (codec->vendor_id) { |
| 9353 | case 0x10ec0888: |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 9354 | if (codec->revision_id == 0x100101) { |
| 9355 | spec->stream_name_analog = "ALC1200 Analog"; |
| 9356 | spec->stream_name_digital = "ALC1200 Digital"; |
| 9357 | } else { |
| 9358 | spec->stream_name_analog = "ALC888 Analog"; |
| 9359 | spec->stream_name_digital = "ALC888 Digital"; |
| 9360 | } |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9361 | if (!spec->num_adc_nids) { |
| 9362 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9363 | spec->adc_nids = alc883_adc_nids; |
| 9364 | } |
| 9365 | if (!spec->capsrc_nids) |
| 9366 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9367 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9368 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9369 | break; |
| 9370 | case 0x10ec0889: |
| 9371 | spec->stream_name_analog = "ALC889 Analog"; |
| 9372 | spec->stream_name_digital = "ALC889 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9373 | if (!spec->num_adc_nids) { |
| 9374 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9375 | spec->adc_nids = alc889_adc_nids; |
| 9376 | } |
| 9377 | if (!spec->capsrc_nids) |
| 9378 | spec->capsrc_nids = alc889_capsrc_nids; |
| 9379 | spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style |
| 9380 | capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9381 | break; |
| 9382 | default: |
| 9383 | spec->stream_name_analog = "ALC883 Analog"; |
| 9384 | spec->stream_name_digital = "ALC883 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9385 | if (!spec->num_adc_nids) { |
| 9386 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9387 | spec->adc_nids = alc883_adc_nids; |
| 9388 | } |
| 9389 | if (!spec->capsrc_nids) |
| 9390 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9391 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9392 | break; |
| 9393 | } |
| 9394 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9395 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9396 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9397 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9398 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9399 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9400 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9401 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9402 | if (!spec->cap_mixer) |
| 9403 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9404 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9405 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9406 | spec->vmaster_nid = 0x0c; |
| 9407 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9408 | codec->patch_ops = alc_patch_ops; |
| 9409 | if (board_config == ALC883_AUTO) |
| 9410 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9411 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9412 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9413 | if (!spec->loopback.amplist) |
| 9414 | spec->loopback.amplist = alc883_loopbacks; |
| 9415 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9416 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9417 | |
| 9418 | return 0; |
| 9419 | } |
| 9420 | |
| 9421 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9422 | * ALC262 support |
| 9423 | */ |
| 9424 | |
| 9425 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9426 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9427 | |
| 9428 | #define alc262_dac_nids alc260_dac_nids |
| 9429 | #define alc262_adc_nids alc882_adc_nids |
| 9430 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9431 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9432 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9433 | |
| 9434 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9435 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9436 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9437 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9438 | /* ADC0 */ |
| 9439 | 0x09 |
| 9440 | }; |
| 9441 | |
| 9442 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9443 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9444 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9445 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9446 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9447 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9448 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9449 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9450 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9451 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9452 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9453 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9454 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9455 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9456 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9457 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9458 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9459 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9460 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9461 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9462 | }; |
| 9463 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9464 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9465 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9466 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9467 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9468 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9469 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9470 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9471 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9472 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9473 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9474 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9475 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9476 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9477 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 9478 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9479 | { } /* end */ |
| 9480 | }; |
| 9481 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9482 | /* update HP, line and mono-out pins according to the master switch */ |
| 9483 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9484 | { |
| 9485 | struct alc_spec *spec = codec->spec; |
| 9486 | int val = spec->master_sw; |
| 9487 | |
| 9488 | /* HP & line-out */ |
| 9489 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9490 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9491 | val ? PIN_HP : 0); |
| 9492 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9493 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9494 | val ? PIN_HP : 0); |
| 9495 | /* mono (speaker) depending on the HP jack sense */ |
| 9496 | val = val && !spec->jack_present; |
| 9497 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9498 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9499 | val ? PIN_OUT : 0); |
| 9500 | } |
| 9501 | |
| 9502 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9503 | { |
| 9504 | struct alc_spec *spec = codec->spec; |
| 9505 | unsigned int presence; |
| 9506 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9507 | AC_VERB_GET_PIN_SENSE, 0); |
| 9508 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9509 | alc262_hp_master_update(codec); |
| 9510 | } |
| 9511 | |
| 9512 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9513 | { |
| 9514 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9515 | return; |
| 9516 | alc262_hp_bpc_automute(codec); |
| 9517 | } |
| 9518 | |
| 9519 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9520 | { |
| 9521 | struct alc_spec *spec = codec->spec; |
| 9522 | unsigned int presence; |
| 9523 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9524 | AC_VERB_GET_PIN_SENSE, 0); |
| 9525 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9526 | alc262_hp_master_update(codec); |
| 9527 | } |
| 9528 | |
| 9529 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9530 | unsigned int res) |
| 9531 | { |
| 9532 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9533 | return; |
| 9534 | alc262_hp_wildwest_automute(codec); |
| 9535 | } |
| 9536 | |
| 9537 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 9538 | struct snd_ctl_elem_value *ucontrol) |
| 9539 | { |
| 9540 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9541 | struct alc_spec *spec = codec->spec; |
| 9542 | *ucontrol->value.integer.value = spec->master_sw; |
| 9543 | return 0; |
| 9544 | } |
| 9545 | |
| 9546 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9547 | struct snd_ctl_elem_value *ucontrol) |
| 9548 | { |
| 9549 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9550 | struct alc_spec *spec = codec->spec; |
| 9551 | int val = !!*ucontrol->value.integer.value; |
| 9552 | |
| 9553 | if (val == spec->master_sw) |
| 9554 | return 0; |
| 9555 | spec->master_sw = val; |
| 9556 | alc262_hp_master_update(codec); |
| 9557 | return 1; |
| 9558 | } |
| 9559 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9560 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9561 | { |
| 9562 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9563 | .name = "Master Playback Switch", |
| 9564 | .info = snd_ctl_boolean_mono_info, |
| 9565 | .get = alc262_hp_master_sw_get, |
| 9566 | .put = alc262_hp_master_sw_put, |
| 9567 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9568 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9569 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9570 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9571 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9572 | HDA_OUTPUT), |
| 9573 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9574 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9575 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9576 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9577 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9578 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9579 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9580 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9581 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9582 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9583 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9584 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9585 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9586 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9587 | { } /* end */ |
| 9588 | }; |
| 9589 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9590 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9591 | { |
| 9592 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9593 | .name = "Master Playback Switch", |
| 9594 | .info = snd_ctl_boolean_mono_info, |
| 9595 | .get = alc262_hp_master_sw_get, |
| 9596 | .put = alc262_hp_master_sw_put, |
| 9597 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9598 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9599 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9600 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9601 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9602 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9603 | HDA_OUTPUT), |
| 9604 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9605 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9606 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9607 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9608 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9609 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9610 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9611 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9612 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9613 | { } /* end */ |
| 9614 | }; |
| 9615 | |
| 9616 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9617 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9618 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9619 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9620 | { } /* end */ |
| 9621 | }; |
| 9622 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9623 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9624 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 9625 | { |
| 9626 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9627 | |
| 9628 | if (force || !spec->sense_updated) { |
| 9629 | unsigned int present; |
| 9630 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9631 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9632 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9633 | spec->sense_updated = 1; |
| 9634 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9635 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 9636 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9637 | } |
| 9638 | |
| 9639 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 9640 | unsigned int res) |
| 9641 | { |
| 9642 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9643 | return; |
| 9644 | alc262_hp_t5735_automute(codec, 1); |
| 9645 | } |
| 9646 | |
| 9647 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 9648 | { |
| 9649 | alc262_hp_t5735_automute(codec, 1); |
| 9650 | } |
| 9651 | |
| 9652 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9653 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9654 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9655 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9656 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9657 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9658 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9659 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9660 | { } /* end */ |
| 9661 | }; |
| 9662 | |
| 9663 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9664 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9665 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9666 | |
| 9667 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9668 | { } |
| 9669 | }; |
| 9670 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9671 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9672 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9673 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9674 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9675 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9676 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9677 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9678 | { } /* end */ |
| 9679 | }; |
| 9680 | |
| 9681 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9682 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9683 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9684 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9685 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9686 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9687 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9688 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9689 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9690 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9691 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9692 | {} |
| 9693 | }; |
| 9694 | |
| 9695 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9696 | .num_items = 1, |
| 9697 | .items = { |
| 9698 | { "Line", 0x1 }, |
| 9699 | }, |
| 9700 | }; |
| 9701 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9702 | /* bind hp and internal speaker mute (with plug check) */ |
| 9703 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9704 | struct snd_ctl_elem_value *ucontrol) |
| 9705 | { |
| 9706 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9707 | long *valp = ucontrol->value.integer.value; |
| 9708 | int change; |
| 9709 | |
| 9710 | /* change hp mute */ |
| 9711 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9712 | HDA_AMP_MUTE, |
| 9713 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9714 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9715 | HDA_AMP_MUTE, |
| 9716 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9717 | if (change) { |
| 9718 | /* change speaker according to HP jack state */ |
| 9719 | struct alc_spec *spec = codec->spec; |
| 9720 | unsigned int mute; |
| 9721 | if (spec->jack_present) |
| 9722 | mute = HDA_AMP_MUTE; |
| 9723 | else |
| 9724 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9725 | HDA_OUTPUT, 0); |
| 9726 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9727 | HDA_AMP_MUTE, mute); |
| 9728 | } |
| 9729 | return change; |
| 9730 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9731 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9732 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9733 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9734 | { |
| 9735 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9736 | .name = "Master Playback Switch", |
| 9737 | .info = snd_hda_mixer_amp_switch_info, |
| 9738 | .get = snd_hda_mixer_amp_switch_get, |
| 9739 | .put = alc262_sony_master_sw_put, |
| 9740 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9741 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9742 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9743 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9744 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9745 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9746 | { } /* end */ |
| 9747 | }; |
| 9748 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9749 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9750 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9751 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9752 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9753 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9754 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9755 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9756 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9757 | { } /* end */ |
| 9758 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9759 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9760 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 9761 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9762 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9763 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9764 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9765 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9766 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9767 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9768 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9769 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9770 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9771 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9772 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9773 | { } /* end */ |
| 9774 | }; |
| 9775 | |
| 9776 | static struct hda_verb alc262_tyan_verbs[] = { |
| 9777 | /* Headphone automute */ |
| 9778 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9779 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9780 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9781 | |
| 9782 | /* P11 AUX_IN, white 4-pin connector */ |
| 9783 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9784 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 9785 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 9786 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 9787 | |
| 9788 | {} |
| 9789 | }; |
| 9790 | |
| 9791 | /* unsolicited event for HP jack sensing */ |
| 9792 | static void alc262_tyan_automute(struct hda_codec *codec) |
| 9793 | { |
| 9794 | unsigned int mute; |
| 9795 | unsigned int present; |
| 9796 | |
| 9797 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9798 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9799 | AC_VERB_GET_PIN_SENSE, 0); |
| 9800 | present = (present & 0x80000000) != 0; |
| 9801 | if (present) { |
| 9802 | /* mute line output on ATX panel */ |
| 9803 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9804 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9805 | } else { |
| 9806 | /* unmute line output if necessary */ |
| 9807 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9808 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9809 | HDA_AMP_MUTE, mute); |
| 9810 | } |
| 9811 | } |
| 9812 | |
| 9813 | static void alc262_tyan_unsol_event(struct hda_codec *codec, |
| 9814 | unsigned int res) |
| 9815 | { |
| 9816 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9817 | return; |
| 9818 | alc262_tyan_automute(codec); |
| 9819 | } |
| 9820 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9821 | #define alc262_capture_mixer alc882_capture_mixer |
| 9822 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9823 | |
| 9824 | /* |
| 9825 | * generic initialization of ADC, input mixers and output mixers |
| 9826 | */ |
| 9827 | static struct hda_verb alc262_init_verbs[] = { |
| 9828 | /* |
| 9829 | * Unmute ADC0-2 and set the default input to mic-in |
| 9830 | */ |
| 9831 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9832 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9833 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9834 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9835 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9836 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9837 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9838 | /* 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] | 9839 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9840 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9841 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9842 | */ |
| 9843 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9844 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9845 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9846 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9847 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9848 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9849 | |
| 9850 | /* |
| 9851 | * Set up output mixers (0x0c - 0x0e) |
| 9852 | */ |
| 9853 | /* set vol=0 to output mixers */ |
| 9854 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9855 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9856 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9857 | /* set up input amps for analog loopback */ |
| 9858 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9859 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9860 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9861 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9862 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9863 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9864 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9865 | |
| 9866 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9867 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9868 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9869 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9870 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9871 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9872 | |
| 9873 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9875 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9876 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9877 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9878 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9879 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9880 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9881 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9882 | /* FIXME: use matrix-type input source selection */ |
| 9883 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9884 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9885 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9886 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9887 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9888 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9889 | /* Input mixer2 */ |
| 9890 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9891 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9892 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9893 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9894 | /* Input mixer3 */ |
| 9895 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9896 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9897 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9898 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9899 | |
| 9900 | { } |
| 9901 | }; |
| 9902 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9903 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9904 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9905 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9906 | { } |
| 9907 | }; |
| 9908 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9909 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9910 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9911 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9912 | {} |
| 9913 | }; |
| 9914 | |
| 9915 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9916 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9917 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9918 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9919 | |
| 9920 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9921 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9922 | {} |
| 9923 | }; |
| 9924 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9925 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9926 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9927 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9928 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9929 | |
| 9930 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9931 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9932 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9933 | }; |
| 9934 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9935 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9936 | .num_items = 2, |
| 9937 | .items = { |
| 9938 | { "Int DMic", 0x9 }, |
| 9939 | { "Mic", 0x0 }, |
| 9940 | }, |
| 9941 | }; |
| 9942 | |
| 9943 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9944 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9945 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9946 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9947 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9948 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9949 | { } /* end */ |
| 9950 | }; |
| 9951 | |
| 9952 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9953 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9954 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9955 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9956 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9957 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9958 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9959 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9960 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9961 | {} |
| 9962 | }; |
| 9963 | |
| 9964 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9965 | { |
| 9966 | unsigned int present; |
| 9967 | |
| 9968 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9969 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9970 | snd_hda_codec_write(codec, 0x22, 0, |
| 9971 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9972 | } |
| 9973 | |
| 9974 | /* toggle speaker-output according to the hp-jack state */ |
| 9975 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9976 | { |
| 9977 | unsigned int present; |
| 9978 | unsigned char bits; |
| 9979 | |
| 9980 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9981 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9982 | bits = present ? 0 : PIN_OUT; |
| 9983 | snd_hda_codec_write(codec, 0x14, 0, |
| 9984 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9985 | } |
| 9986 | |
| 9987 | |
| 9988 | |
| 9989 | /* unsolicited event for HP jack sensing */ |
| 9990 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9991 | unsigned int res) |
| 9992 | { |
| 9993 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9994 | alc262_toshiba_s06_speaker_automute(codec); |
| 9995 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9996 | alc262_dmic_automute(codec); |
| 9997 | |
| 9998 | } |
| 9999 | |
| 10000 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 10001 | { |
| 10002 | alc262_toshiba_s06_speaker_automute(codec); |
| 10003 | alc262_dmic_automute(codec); |
| 10004 | } |
| 10005 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10006 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10007 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10008 | { |
| 10009 | struct alc_spec *spec = codec->spec; |
| 10010 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10011 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10012 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10013 | /* need to execute and sync at first */ |
| 10014 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10015 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10016 | AC_VERB_GET_PIN_SENSE, 0); |
| 10017 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10018 | if (spec->jack_present) { |
| 10019 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10020 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10021 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10022 | } else { |
| 10023 | /* unmute internal speaker if necessary */ |
| 10024 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10025 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10026 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10027 | } |
| 10028 | } |
| 10029 | |
| 10030 | /* unsolicited event for HP jack sensing */ |
| 10031 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 10032 | unsigned int res) |
| 10033 | { |
| 10034 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10035 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10036 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10037 | } |
| 10038 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10039 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10040 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10041 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10042 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10043 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10044 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10045 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 10046 | AC_VERB_GET_PIN_SENSE, 0); |
| 10047 | present = (present & 0x80000000) != 0; |
| 10048 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10049 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10050 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10051 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10052 | } else { |
| 10053 | /* unmute internal speaker if necessary */ |
| 10054 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10055 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10056 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10057 | } |
| 10058 | } |
| 10059 | |
| 10060 | /* unsolicited event for HP jack sensing */ |
| 10061 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 10062 | unsigned int res) |
| 10063 | { |
| 10064 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10065 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10066 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10067 | } |
| 10068 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10069 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10070 | * nec model |
| 10071 | * 0x15 = headphone |
| 10072 | * 0x16 = internal speaker |
| 10073 | * 0x18 = external mic |
| 10074 | */ |
| 10075 | |
| 10076 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10077 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10078 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10079 | |
| 10080 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10081 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10082 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10083 | |
| 10084 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10085 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10086 | { } /* end */ |
| 10087 | }; |
| 10088 | |
| 10089 | static struct hda_verb alc262_nec_verbs[] = { |
| 10090 | /* Unmute Speaker */ |
| 10091 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10092 | |
| 10093 | /* Headphone */ |
| 10094 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10095 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10096 | |
| 10097 | /* External mic to headphone */ |
| 10098 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10099 | /* External mic to speaker */ |
| 10100 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10101 | {} |
| 10102 | }; |
| 10103 | |
| 10104 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10105 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10106 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10107 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10108 | */ |
| 10109 | |
| 10110 | #define ALC_HP_EVENT 0x37 |
| 10111 | |
| 10112 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10113 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10114 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10115 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10116 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10117 | {} |
| 10118 | }; |
| 10119 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10120 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10121 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10122 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10123 | {} |
| 10124 | }; |
| 10125 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10126 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10127 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10128 | .items = { |
| 10129 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10130 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10131 | { "CD", 0x4 }, |
| 10132 | }, |
| 10133 | }; |
| 10134 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10135 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10136 | .num_items = 5, |
| 10137 | .items = { |
| 10138 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10139 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10140 | { "Line", 0x2 }, |
| 10141 | { "CD", 0x4 }, |
| 10142 | { "AUX IN", 0x6 }, |
| 10143 | }, |
| 10144 | }; |
| 10145 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10146 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10147 | .num_items = 4, |
| 10148 | .items = { |
| 10149 | { "Mic", 0x0 }, |
| 10150 | { "Front Mic", 0x2 }, |
| 10151 | { "Line", 0x1 }, |
| 10152 | { "CD", 0x4 }, |
| 10153 | }, |
| 10154 | }; |
| 10155 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10156 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10157 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10158 | { |
| 10159 | struct alc_spec *spec = codec->spec; |
| 10160 | unsigned int mute; |
| 10161 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10162 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10163 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10164 | /* need to execute and sync at first */ |
| 10165 | 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] | 10166 | /* check laptop HP jack */ |
| 10167 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10168 | AC_VERB_GET_PIN_SENSE, 0); |
| 10169 | /* need to execute and sync at first */ |
| 10170 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10171 | /* check docking HP jack */ |
| 10172 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10173 | AC_VERB_GET_PIN_SENSE, 0); |
| 10174 | if (present & AC_PINSENSE_PRESENCE) |
| 10175 | spec->jack_present = 1; |
| 10176 | else |
| 10177 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10178 | spec->sense_updated = 1; |
| 10179 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10180 | /* unmute internal speaker only if both HPs are unplugged and |
| 10181 | * master switch is on |
| 10182 | */ |
| 10183 | if (spec->jack_present) |
| 10184 | mute = HDA_AMP_MUTE; |
| 10185 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10186 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10187 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10188 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10189 | } |
| 10190 | |
| 10191 | /* unsolicited event for HP jack sensing */ |
| 10192 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10193 | unsigned int res) |
| 10194 | { |
| 10195 | if ((res >> 26) != ALC_HP_EVENT) |
| 10196 | return; |
| 10197 | alc262_fujitsu_automute(codec, 1); |
| 10198 | } |
| 10199 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10200 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10201 | { |
| 10202 | alc262_fujitsu_automute(codec, 1); |
| 10203 | } |
| 10204 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10205 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10206 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10207 | .ops = &snd_hda_bind_vol, |
| 10208 | .values = { |
| 10209 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10210 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10211 | 0 |
| 10212 | }, |
| 10213 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10214 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10215 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10216 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10217 | { |
| 10218 | struct alc_spec *spec = codec->spec; |
| 10219 | unsigned int mute; |
| 10220 | |
| 10221 | if (force || !spec->sense_updated) { |
| 10222 | unsigned int present_int_hp; |
| 10223 | /* need to execute and sync at first */ |
| 10224 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10225 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10226 | AC_VERB_GET_PIN_SENSE, 0); |
| 10227 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10228 | spec->sense_updated = 1; |
| 10229 | } |
| 10230 | if (spec->jack_present) { |
| 10231 | /* mute internal speaker */ |
| 10232 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10233 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10234 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10235 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10236 | } else { |
| 10237 | /* unmute internal speaker if necessary */ |
| 10238 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10239 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10240 | HDA_AMP_MUTE, mute); |
| 10241 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10242 | HDA_AMP_MUTE, mute); |
| 10243 | } |
| 10244 | } |
| 10245 | |
| 10246 | /* unsolicited event for HP jack sensing */ |
| 10247 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10248 | unsigned int res) |
| 10249 | { |
| 10250 | if ((res >> 26) != ALC_HP_EVENT) |
| 10251 | return; |
| 10252 | alc262_lenovo_3000_automute(codec, 1); |
| 10253 | } |
| 10254 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10255 | /* bind hp and internal speaker mute (with plug check) */ |
| 10256 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10257 | struct snd_ctl_elem_value *ucontrol) |
| 10258 | { |
| 10259 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10260 | long *valp = ucontrol->value.integer.value; |
| 10261 | int change; |
| 10262 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10263 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10264 | HDA_AMP_MUTE, |
| 10265 | valp ? 0 : HDA_AMP_MUTE); |
| 10266 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10267 | HDA_AMP_MUTE, |
| 10268 | valp ? 0 : HDA_AMP_MUTE); |
| 10269 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10270 | if (change) |
| 10271 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10272 | return change; |
| 10273 | } |
| 10274 | |
| 10275 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10276 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10277 | { |
| 10278 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10279 | .name = "Master Playback Switch", |
| 10280 | .info = snd_hda_mixer_amp_switch_info, |
| 10281 | .get = snd_hda_mixer_amp_switch_get, |
| 10282 | .put = alc262_fujitsu_master_sw_put, |
| 10283 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10284 | }, |
| 10285 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10286 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10287 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10288 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10289 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10290 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10291 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10292 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10293 | { } /* end */ |
| 10294 | }; |
| 10295 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10296 | /* bind hp and internal speaker mute (with plug check) */ |
| 10297 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10298 | struct snd_ctl_elem_value *ucontrol) |
| 10299 | { |
| 10300 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10301 | long *valp = ucontrol->value.integer.value; |
| 10302 | int change; |
| 10303 | |
| 10304 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10305 | HDA_AMP_MUTE, |
| 10306 | valp ? 0 : HDA_AMP_MUTE); |
| 10307 | |
| 10308 | if (change) |
| 10309 | alc262_lenovo_3000_automute(codec, 0); |
| 10310 | return change; |
| 10311 | } |
| 10312 | |
| 10313 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10314 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10315 | { |
| 10316 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10317 | .name = "Master Playback Switch", |
| 10318 | .info = snd_hda_mixer_amp_switch_info, |
| 10319 | .get = snd_hda_mixer_amp_switch_get, |
| 10320 | .put = alc262_lenovo_3000_master_sw_put, |
| 10321 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10322 | }, |
| 10323 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10324 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10325 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10326 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10327 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10328 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10329 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10330 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10331 | { } /* end */ |
| 10332 | }; |
| 10333 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10334 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10335 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10336 | { |
| 10337 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10338 | .name = "Master Playback Switch", |
| 10339 | .info = snd_hda_mixer_amp_switch_info, |
| 10340 | .get = snd_hda_mixer_amp_switch_get, |
| 10341 | .put = alc262_sony_master_sw_put, |
| 10342 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 10343 | }, |
| 10344 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10345 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10346 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10347 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10348 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10349 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10350 | { } /* end */ |
| 10351 | }; |
| 10352 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10353 | /* additional init verbs for Benq laptops */ |
| 10354 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10355 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10356 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10357 | {} |
| 10358 | }; |
| 10359 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10360 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10361 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10362 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10363 | |
| 10364 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10365 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10366 | {} |
| 10367 | }; |
| 10368 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10369 | /* Samsung Q1 Ultra Vista model setup */ |
| 10370 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10371 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10372 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10373 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10374 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10375 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10376 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10377 | { } /* end */ |
| 10378 | }; |
| 10379 | |
| 10380 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10381 | /* output mixer */ |
| 10382 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10383 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10384 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10385 | /* speaker */ |
| 10386 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10387 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10388 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10389 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10390 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10392 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10393 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10394 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10395 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10396 | /* internal mic */ |
| 10397 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10398 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10399 | /* ADC, choose mic */ |
| 10400 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10401 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10402 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10403 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10404 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10405 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10406 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10407 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10408 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10409 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10410 | {} |
| 10411 | }; |
| 10412 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10413 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10414 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10415 | { |
| 10416 | struct alc_spec *spec = codec->spec; |
| 10417 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10418 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10419 | mute = 0; |
| 10420 | /* auto-mute only when HP is used as HP */ |
| 10421 | if (!spec->cur_mux[0]) { |
| 10422 | unsigned int present; |
| 10423 | /* need to execute and sync at first */ |
| 10424 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10425 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10426 | AC_VERB_GET_PIN_SENSE, 0); |
| 10427 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10428 | if (spec->jack_present) |
| 10429 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10430 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10431 | /* mute/unmute internal speaker */ |
| 10432 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10433 | HDA_AMP_MUTE, mute); |
| 10434 | /* mute/unmute HP */ |
| 10435 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10436 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10437 | } |
| 10438 | |
| 10439 | /* unsolicited event for HP jack sensing */ |
| 10440 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10441 | unsigned int res) |
| 10442 | { |
| 10443 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10444 | return; |
| 10445 | alc262_ultra_automute(codec); |
| 10446 | } |
| 10447 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10448 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10449 | .num_items = 2, |
| 10450 | .items = { |
| 10451 | { "Mic", 0x1 }, |
| 10452 | { "Headphone", 0x7 }, |
| 10453 | }, |
| 10454 | }; |
| 10455 | |
| 10456 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10457 | struct snd_ctl_elem_value *ucontrol) |
| 10458 | { |
| 10459 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10460 | struct alc_spec *spec = codec->spec; |
| 10461 | int ret; |
| 10462 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10463 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10464 | if (!ret) |
| 10465 | return 0; |
| 10466 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10467 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10468 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10469 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10470 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10471 | return ret; |
| 10472 | } |
| 10473 | |
| 10474 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10475 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10476 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10477 | { |
| 10478 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10479 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10480 | .info = alc_mux_enum_info, |
| 10481 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10482 | .put = alc262_ultra_mux_enum_put, |
| 10483 | }, |
| 10484 | { } /* end */ |
| 10485 | }; |
| 10486 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10487 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10488 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10489 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10490 | { |
| 10491 | hda_nid_t nid; |
| 10492 | int err; |
| 10493 | |
| 10494 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10495 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10496 | spec->multiout.dac_nids[0] = 2; |
| 10497 | |
| 10498 | nid = cfg->line_out_pins[0]; |
| 10499 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10500 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10501 | "Front Playback Volume", |
| 10502 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10503 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10504 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10505 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10506 | "Front Playback Switch", |
| 10507 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10508 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10509 | return err; |
| 10510 | } |
| 10511 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10512 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10513 | if (nid) { |
| 10514 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10515 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10516 | "Speaker Playback Volume", |
| 10517 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10518 | HDA_OUTPUT)); |
| 10519 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10520 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10521 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10522 | "Speaker Playback Switch", |
| 10523 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10524 | HDA_OUTPUT)); |
| 10525 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10526 | return err; |
| 10527 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10528 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10529 | "Speaker Playback Switch", |
| 10530 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10531 | HDA_OUTPUT)); |
| 10532 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10533 | return err; |
| 10534 | } |
| 10535 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10536 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10537 | if (nid) { |
| 10538 | /* spec->multiout.hp_nid = 2; */ |
| 10539 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10540 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10541 | "Headphone Playback Volume", |
| 10542 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10543 | HDA_OUTPUT)); |
| 10544 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10545 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10546 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10547 | "Headphone Playback Switch", |
| 10548 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10549 | HDA_OUTPUT)); |
| 10550 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10551 | return err; |
| 10552 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10553 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10554 | "Headphone Playback Switch", |
| 10555 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10556 | HDA_OUTPUT)); |
| 10557 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10558 | return err; |
| 10559 | } |
| 10560 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10561 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10562 | } |
| 10563 | |
| 10564 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10565 | #define alc262_auto_create_analog_input_ctls \ |
| 10566 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10567 | |
| 10568 | /* |
| 10569 | * generic initialization of ADC, input mixers and output mixers |
| 10570 | */ |
| 10571 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10572 | /* |
| 10573 | * Unmute ADC0-2 and set the default input to mic-in |
| 10574 | */ |
| 10575 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10576 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10577 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10578 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10579 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10580 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10581 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10582 | /* 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] | 10583 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10584 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10585 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10586 | */ |
| 10587 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10588 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10589 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10590 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10591 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10592 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10593 | |
| 10594 | /* |
| 10595 | * Set up output mixers (0x0c - 0x0f) |
| 10596 | */ |
| 10597 | /* set vol=0 to output mixers */ |
| 10598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10599 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10600 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10601 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10602 | /* set up input amps for analog loopback */ |
| 10603 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10604 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10605 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10606 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10607 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10608 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10609 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10610 | |
| 10611 | /* FIXME: use matrix-type input source selection */ |
| 10612 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10613 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10614 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10615 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10616 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10617 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10618 | /* Input mixer2 */ |
| 10619 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10620 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10621 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10622 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10623 | /* Input mixer3 */ |
| 10624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10625 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10626 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10627 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10628 | |
| 10629 | { } |
| 10630 | }; |
| 10631 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10632 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10633 | /* |
| 10634 | * Unmute ADC0-2 and set the default input to mic-in |
| 10635 | */ |
| 10636 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10637 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10638 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10639 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10640 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10641 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10642 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10643 | /* 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] | 10644 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10645 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10646 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10647 | */ |
| 10648 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10649 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10650 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10651 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10652 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10653 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10654 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10655 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10656 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10657 | /* |
| 10658 | * Set up output mixers (0x0c - 0x0e) |
| 10659 | */ |
| 10660 | /* set vol=0 to output mixers */ |
| 10661 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10662 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10663 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10664 | |
| 10665 | /* set up input amps for analog loopback */ |
| 10666 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10667 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10668 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10669 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10670 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10671 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10672 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10673 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10674 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10675 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10676 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10677 | |
| 10678 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10679 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10680 | |
| 10681 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10682 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10683 | |
| 10684 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10685 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10686 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10687 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10688 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10689 | |
| 10690 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10691 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10692 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10693 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10694 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10695 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10696 | |
| 10697 | |
| 10698 | /* FIXME: use matrix-type input source selection */ |
| 10699 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10700 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10701 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10702 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10703 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10704 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10705 | /* Input mixer2 */ |
| 10706 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10707 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10708 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10709 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10710 | /* Input mixer3 */ |
| 10711 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10712 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10713 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10714 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10715 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10716 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10717 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10718 | { } |
| 10719 | }; |
| 10720 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10721 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10722 | /* |
| 10723 | * Unmute ADC0-2 and set the default input to mic-in |
| 10724 | */ |
| 10725 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10726 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10727 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10728 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10729 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10730 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10731 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10732 | /* 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] | 10733 | * mixer widget |
| 10734 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10735 | * panel mic (mic 2) |
| 10736 | */ |
| 10737 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10738 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10739 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10740 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10741 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10742 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10743 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10744 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10745 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10746 | /* |
| 10747 | * Set up output mixers (0x0c - 0x0e) |
| 10748 | */ |
| 10749 | /* set vol=0 to output mixers */ |
| 10750 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10751 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10752 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10753 | |
| 10754 | /* set up input amps for analog loopback */ |
| 10755 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10756 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10757 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10758 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10759 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10760 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10761 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10762 | |
| 10763 | |
| 10764 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10765 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10766 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10767 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10768 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10769 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10770 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10771 | |
| 10772 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10774 | |
| 10775 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10776 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10777 | |
| 10778 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10779 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10780 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10781 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10782 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10783 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10784 | |
| 10785 | /* FIXME: use matrix-type input source selection */ |
| 10786 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10787 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10788 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10789 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10790 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10791 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10792 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10793 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10794 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10795 | /* Input mixer2 */ |
| 10796 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10797 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10798 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10799 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10800 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10801 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10802 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10803 | /* Input mixer3 */ |
| 10804 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10805 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10806 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10807 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10808 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10809 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10810 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10811 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10812 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10813 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10814 | { } |
| 10815 | }; |
| 10816 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10817 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10818 | |
| 10819 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10820 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10821 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10822 | |
| 10823 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10824 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10825 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10826 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10827 | |
| 10828 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10829 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10830 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10831 | {} |
| 10832 | }; |
| 10833 | |
| 10834 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10835 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10836 | #define alc262_loopbacks alc880_loopbacks |
| 10837 | #endif |
| 10838 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10839 | /* pcm configuration: identiacal with ALC880 */ |
| 10840 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10841 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10842 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10843 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10844 | |
| 10845 | /* |
| 10846 | * BIOS auto configuration |
| 10847 | */ |
| 10848 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10849 | { |
| 10850 | struct alc_spec *spec = codec->spec; |
| 10851 | int err; |
| 10852 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10853 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10854 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10855 | alc262_ignore); |
| 10856 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10857 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10858 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10859 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10860 | spec->multiout.max_channels = 2; |
| 10861 | spec->no_analog = 1; |
| 10862 | goto dig_only; |
| 10863 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10864 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10865 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10866 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10867 | if (err < 0) |
| 10868 | return err; |
| 10869 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10870 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10871 | return err; |
| 10872 | |
| 10873 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10874 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10875 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10876 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10877 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10878 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10879 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10880 | if (spec->autocfg.dig_in_pin) |
| 10881 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10882 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10883 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10884 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10885 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10886 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10887 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10888 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10889 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10890 | err = alc_auto_add_mic_boost(codec); |
| 10891 | if (err < 0) |
| 10892 | return err; |
| 10893 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 10894 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 10895 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10896 | return 1; |
| 10897 | } |
| 10898 | |
| 10899 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10900 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10901 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10902 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10903 | |
| 10904 | |
| 10905 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10906 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10907 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10908 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10909 | alc262_auto_init_multi_out(codec); |
| 10910 | alc262_auto_init_hp_out(codec); |
| 10911 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10912 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10913 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10914 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10915 | } |
| 10916 | |
| 10917 | /* |
| 10918 | * configuration and preset |
| 10919 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10920 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10921 | [ALC262_BASIC] = "basic", |
| 10922 | [ALC262_HIPPO] = "hippo", |
| 10923 | [ALC262_HIPPO_1] = "hippo_1", |
| 10924 | [ALC262_FUJITSU] = "fujitsu", |
| 10925 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10926 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10927 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10928 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10929 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10930 | [ALC262_BENQ_T31] = "benq-t31", |
| 10931 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10932 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10933 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10934 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10935 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10936 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10937 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10938 | [ALC262_AUTO] = "auto", |
| 10939 | }; |
| 10940 | |
| 10941 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10942 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10943 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10944 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 10945 | ALC262_HP_BPC), |
| 10946 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 10947 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 10948 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 10949 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10950 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10951 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10952 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10953 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10954 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10955 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10956 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10957 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10958 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10959 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10960 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10961 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10962 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10963 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10964 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10965 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10966 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 10967 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 10968 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 10969 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10970 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10971 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10972 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10973 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10974 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10975 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10976 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 10977 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 10978 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10979 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10980 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10981 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10982 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10983 | {} |
| 10984 | }; |
| 10985 | |
| 10986 | static struct alc_config_preset alc262_presets[] = { |
| 10987 | [ALC262_BASIC] = { |
| 10988 | .mixers = { alc262_base_mixer }, |
| 10989 | .init_verbs = { alc262_init_verbs }, |
| 10990 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10991 | .dac_nids = alc262_dac_nids, |
| 10992 | .hp_nid = 0x03, |
| 10993 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10994 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10995 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10996 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10997 | [ALC262_HIPPO] = { |
| 10998 | .mixers = { alc262_base_mixer }, |
| 10999 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 11000 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11001 | .dac_nids = alc262_dac_nids, |
| 11002 | .hp_nid = 0x03, |
| 11003 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 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 | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11008 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11009 | }, |
| 11010 | [ALC262_HIPPO_1] = { |
| 11011 | .mixers = { alc262_hippo1_mixer }, |
| 11012 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_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, |
| 11020 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11021 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11022 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11023 | [ALC262_FUJITSU] = { |
| 11024 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11025 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11026 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11027 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11028 | .dac_nids = alc262_dac_nids, |
| 11029 | .hp_nid = 0x03, |
| 11030 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11031 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11032 | .channel_mode = alc262_modes, |
| 11033 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11034 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11035 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11036 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11037 | [ALC262_HP_BPC] = { |
| 11038 | .mixers = { alc262_HP_BPC_mixer }, |
| 11039 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11040 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11041 | .dac_nids = alc262_dac_nids, |
| 11042 | .hp_nid = 0x03, |
| 11043 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11044 | .channel_mode = alc262_modes, |
| 11045 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11046 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11047 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11048 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11049 | [ALC262_HP_BPC_D7000_WF] = { |
| 11050 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11051 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11052 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11053 | .dac_nids = alc262_dac_nids, |
| 11054 | .hp_nid = 0x03, |
| 11055 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11056 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11057 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11058 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11059 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11060 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11061 | [ALC262_HP_BPC_D7000_WL] = { |
| 11062 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11063 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11064 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11065 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11066 | .dac_nids = alc262_dac_nids, |
| 11067 | .hp_nid = 0x03, |
| 11068 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11069 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11070 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11071 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11072 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11073 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11074 | [ALC262_HP_TC_T5735] = { |
| 11075 | .mixers = { alc262_hp_t5735_mixer }, |
| 11076 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11077 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11078 | .dac_nids = alc262_dac_nids, |
| 11079 | .hp_nid = 0x03, |
| 11080 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11081 | .channel_mode = alc262_modes, |
| 11082 | .input_mux = &alc262_capture_source, |
| 11083 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 11084 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11085 | }, |
| 11086 | [ALC262_HP_RP5700] = { |
| 11087 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11088 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11089 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11090 | .dac_nids = alc262_dac_nids, |
| 11091 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11092 | .channel_mode = alc262_modes, |
| 11093 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11094 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11095 | [ALC262_BENQ_ED8] = { |
| 11096 | .mixers = { alc262_base_mixer }, |
| 11097 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11098 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11099 | .dac_nids = alc262_dac_nids, |
| 11100 | .hp_nid = 0x03, |
| 11101 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11102 | .channel_mode = alc262_modes, |
| 11103 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11104 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11105 | [ALC262_SONY_ASSAMD] = { |
| 11106 | .mixers = { alc262_sony_mixer }, |
| 11107 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11108 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11109 | .dac_nids = alc262_dac_nids, |
| 11110 | .hp_nid = 0x02, |
| 11111 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11112 | .channel_mode = alc262_modes, |
| 11113 | .input_mux = &alc262_capture_source, |
| 11114 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11115 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11116 | }, |
| 11117 | [ALC262_BENQ_T31] = { |
| 11118 | .mixers = { alc262_benq_t31_mixer }, |
| 11119 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 11120 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11121 | .dac_nids = alc262_dac_nids, |
| 11122 | .hp_nid = 0x03, |
| 11123 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11124 | .channel_mode = alc262_modes, |
| 11125 | .input_mux = &alc262_capture_source, |
| 11126 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11127 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11128 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11129 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11130 | .mixers = { alc262_ultra_mixer }, |
| 11131 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11132 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11133 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11134 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11135 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11136 | .channel_mode = alc262_modes, |
| 11137 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11138 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11139 | .capsrc_nids = alc262_capsrc_nids, |
| 11140 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11141 | .unsol_event = alc262_ultra_unsol_event, |
| 11142 | .init_hook = alc262_ultra_automute, |
| 11143 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11144 | [ALC262_LENOVO_3000] = { |
| 11145 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11146 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11147 | alc262_lenovo_3000_unsol_verbs }, |
| 11148 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11149 | .dac_nids = alc262_dac_nids, |
| 11150 | .hp_nid = 0x03, |
| 11151 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11152 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11153 | .channel_mode = alc262_modes, |
| 11154 | .input_mux = &alc262_fujitsu_capture_source, |
| 11155 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11156 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11157 | [ALC262_NEC] = { |
| 11158 | .mixers = { alc262_nec_mixer }, |
| 11159 | .init_verbs = { alc262_nec_verbs }, |
| 11160 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11161 | .dac_nids = alc262_dac_nids, |
| 11162 | .hp_nid = 0x03, |
| 11163 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11164 | .channel_mode = alc262_modes, |
| 11165 | .input_mux = &alc262_capture_source, |
| 11166 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11167 | [ALC262_TOSHIBA_S06] = { |
| 11168 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11169 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11170 | alc262_eapd_verbs }, |
| 11171 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11172 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11173 | .dac_nids = alc262_dac_nids, |
| 11174 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 11175 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11176 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11177 | .channel_mode = alc262_modes, |
| 11178 | .input_mux = &alc262_dmic_capture_source, |
| 11179 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11180 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11181 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11182 | [ALC262_TOSHIBA_RX1] = { |
| 11183 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11184 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11185 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11186 | .dac_nids = alc262_dac_nids, |
| 11187 | .hp_nid = 0x03, |
| 11188 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11189 | .channel_mode = alc262_modes, |
| 11190 | .input_mux = &alc262_capture_source, |
| 11191 | .unsol_event = alc262_hippo_unsol_event, |
| 11192 | .init_hook = alc262_hippo_automute, |
| 11193 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11194 | [ALC262_TYAN] = { |
| 11195 | .mixers = { alc262_tyan_mixer }, |
| 11196 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11197 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11198 | .dac_nids = alc262_dac_nids, |
| 11199 | .hp_nid = 0x02, |
| 11200 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11201 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11202 | .channel_mode = alc262_modes, |
| 11203 | .input_mux = &alc262_capture_source, |
| 11204 | .unsol_event = alc262_tyan_unsol_event, |
| 11205 | .init_hook = alc262_tyan_automute, |
| 11206 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11207 | }; |
| 11208 | |
| 11209 | static int patch_alc262(struct hda_codec *codec) |
| 11210 | { |
| 11211 | struct alc_spec *spec; |
| 11212 | int board_config; |
| 11213 | int err; |
| 11214 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11215 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11216 | if (spec == NULL) |
| 11217 | return -ENOMEM; |
| 11218 | |
| 11219 | codec->spec = spec; |
| 11220 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11221 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11222 | * under-run |
| 11223 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11224 | { |
| 11225 | int tmp; |
| 11226 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11227 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11228 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11229 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11230 | } |
| 11231 | #endif |
| 11232 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11233 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11234 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11235 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11236 | alc262_models, |
| 11237 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11238 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11239 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11240 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 11241 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11242 | board_config = ALC262_AUTO; |
| 11243 | } |
| 11244 | |
| 11245 | if (board_config == ALC262_AUTO) { |
| 11246 | /* automatic parse from the BIOS config */ |
| 11247 | err = alc262_parse_auto_config(codec); |
| 11248 | if (err < 0) { |
| 11249 | alc_free(codec); |
| 11250 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11251 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11252 | printk(KERN_INFO |
| 11253 | "hda_codec: Cannot set up configuration " |
| 11254 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11255 | board_config = ALC262_BASIC; |
| 11256 | } |
| 11257 | } |
| 11258 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11259 | if (!spec->no_analog) { |
| 11260 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11261 | if (err < 0) { |
| 11262 | alc_free(codec); |
| 11263 | return err; |
| 11264 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11265 | } |
| 11266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11267 | if (board_config != ALC262_AUTO) |
| 11268 | setup_preset(spec, &alc262_presets[board_config]); |
| 11269 | |
| 11270 | spec->stream_name_analog = "ALC262 Analog"; |
| 11271 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11272 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11273 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11274 | spec->stream_name_digital = "ALC262 Digital"; |
| 11275 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11276 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11277 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11278 | spec->capture_style = CAPT_MIX; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11279 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11280 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11281 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11282 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11283 | /* get type */ |
| 11284 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11285 | if (wcap != AC_WID_AUD_IN) { |
| 11286 | spec->adc_nids = alc262_adc_nids_alt; |
| 11287 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11288 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11289 | } else { |
| 11290 | spec->adc_nids = alc262_adc_nids; |
| 11291 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11292 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11293 | } |
| 11294 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11295 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11296 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11297 | if (!spec->no_analog) |
| 11298 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11299 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11300 | spec->vmaster_nid = 0x0c; |
| 11301 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11302 | codec->patch_ops = alc_patch_ops; |
| 11303 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11304 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11305 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11306 | if (!spec->loopback.amplist) |
| 11307 | spec->loopback.amplist = alc262_loopbacks; |
| 11308 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11309 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11310 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11311 | return 0; |
| 11312 | } |
| 11313 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11314 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11315 | * ALC268 channel source setting (2 channel) |
| 11316 | */ |
| 11317 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11318 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11319 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11320 | static hda_nid_t alc268_dac_nids[2] = { |
| 11321 | /* front, hp */ |
| 11322 | 0x02, 0x03 |
| 11323 | }; |
| 11324 | |
| 11325 | static hda_nid_t alc268_adc_nids[2] = { |
| 11326 | /* ADC0-1 */ |
| 11327 | 0x08, 0x07 |
| 11328 | }; |
| 11329 | |
| 11330 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11331 | /* ADC0 */ |
| 11332 | 0x08 |
| 11333 | }; |
| 11334 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11335 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11336 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11337 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11338 | /* output mixer control */ |
| 11339 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11340 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11341 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11342 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11343 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11344 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11345 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11346 | { } |
| 11347 | }; |
| 11348 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11349 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11350 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11351 | .ops = &snd_hda_bind_sw, |
| 11352 | .values = { |
| 11353 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11354 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11355 | 0 |
| 11356 | }, |
| 11357 | }; |
| 11358 | |
| 11359 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11360 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11361 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11362 | { } |
| 11363 | }; |
| 11364 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11365 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11366 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11367 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11368 | { } |
| 11369 | }; |
| 11370 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11371 | /* Toshiba specific */ |
| 11372 | #define alc268_toshiba_automute alc262_hippo_automute |
| 11373 | |
| 11374 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11375 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11376 | { } /* end */ |
| 11377 | }; |
| 11378 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11379 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11380 | .num_items = 2, |
| 11381 | .items = { |
| 11382 | { "i-Mic", 0x6 }, |
| 11383 | { "E-Mic", 0x0 }, |
| 11384 | }, |
| 11385 | }; |
| 11386 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11387 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11388 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11389 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11390 | .ops = &snd_hda_bind_vol, |
| 11391 | .values = { |
| 11392 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11393 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11394 | 0 |
| 11395 | }, |
| 11396 | }; |
| 11397 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11398 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11399 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11400 | { |
| 11401 | struct alc_spec *spec = codec->spec; |
| 11402 | unsigned int mute; |
| 11403 | |
| 11404 | if (force || !spec->sense_updated) { |
| 11405 | unsigned int present; |
| 11406 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11407 | AC_VERB_GET_PIN_SENSE, 0); |
| 11408 | spec->jack_present = (present & 0x80000000) != 0; |
| 11409 | spec->sense_updated = 1; |
| 11410 | } |
| 11411 | if (spec->jack_present) |
| 11412 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11413 | else /* unmute internal speaker if necessary */ |
| 11414 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11415 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11416 | HDA_AMP_MUTE, mute); |
| 11417 | } |
| 11418 | |
| 11419 | |
| 11420 | /* bind hp and internal speaker mute (with plug check) */ |
| 11421 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11422 | struct snd_ctl_elem_value *ucontrol) |
| 11423 | { |
| 11424 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11425 | long *valp = ucontrol->value.integer.value; |
| 11426 | int change; |
| 11427 | |
| 11428 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11429 | HDA_AMP_MUTE, |
| 11430 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11431 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11432 | HDA_AMP_MUTE, |
| 11433 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11434 | if (change) |
| 11435 | alc268_acer_automute(codec, 0); |
| 11436 | return change; |
| 11437 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11438 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11439 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11440 | /* output mixer control */ |
| 11441 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11442 | { |
| 11443 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11444 | .name = "Master Playback Switch", |
| 11445 | .info = snd_hda_mixer_amp_switch_info, |
| 11446 | .get = snd_hda_mixer_amp_switch_get, |
| 11447 | .put = alc268_acer_master_sw_put, |
| 11448 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11449 | }, |
| 11450 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11451 | { } |
| 11452 | }; |
| 11453 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11454 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11455 | /* output mixer control */ |
| 11456 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11457 | { |
| 11458 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11459 | .name = "Master Playback Switch", |
| 11460 | .info = snd_hda_mixer_amp_switch_info, |
| 11461 | .get = snd_hda_mixer_amp_switch_get, |
| 11462 | .put = alc268_acer_master_sw_put, |
| 11463 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11464 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11465 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11466 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11467 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11468 | { } |
| 11469 | }; |
| 11470 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11471 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11472 | /* output mixer control */ |
| 11473 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11474 | { |
| 11475 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11476 | .name = "Master Playback Switch", |
| 11477 | .info = snd_hda_mixer_amp_switch_info, |
| 11478 | .get = snd_hda_mixer_amp_switch_get, |
| 11479 | .put = alc268_acer_master_sw_put, |
| 11480 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11481 | }, |
| 11482 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11483 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11484 | { } |
| 11485 | }; |
| 11486 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11487 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11488 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11489 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11490 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11491 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11492 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11493 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11494 | { } |
| 11495 | }; |
| 11496 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11497 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11498 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11499 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11500 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11501 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11502 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11503 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11504 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11505 | { } |
| 11506 | }; |
| 11507 | |
| 11508 | /* unsolicited event for HP jack sensing */ |
| 11509 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 11510 | unsigned int res) |
| 11511 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11512 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11513 | return; |
| 11514 | alc268_toshiba_automute(codec); |
| 11515 | } |
| 11516 | |
| 11517 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11518 | unsigned int res) |
| 11519 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11520 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11521 | return; |
| 11522 | alc268_acer_automute(codec, 1); |
| 11523 | } |
| 11524 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11525 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11526 | { |
| 11527 | alc268_acer_automute(codec, 1); |
| 11528 | } |
| 11529 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11530 | /* toggle speaker-output according to the hp-jack state */ |
| 11531 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11532 | { |
| 11533 | unsigned int present; |
| 11534 | unsigned char bits; |
| 11535 | |
| 11536 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11537 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11538 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11539 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11540 | AMP_IN_MUTE(0), bits); |
| 11541 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11542 | AMP_IN_MUTE(0), bits); |
| 11543 | } |
| 11544 | |
| 11545 | |
| 11546 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11547 | { |
| 11548 | unsigned int present; |
| 11549 | |
| 11550 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11551 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11552 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11553 | present ? 0x0 : 0x6); |
| 11554 | } |
| 11555 | |
| 11556 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11557 | unsigned int res) |
| 11558 | { |
| 11559 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11560 | alc268_aspire_one_speaker_automute(codec); |
| 11561 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11562 | alc268_acer_mic_automute(codec); |
| 11563 | } |
| 11564 | |
| 11565 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11566 | { |
| 11567 | alc268_aspire_one_speaker_automute(codec); |
| 11568 | alc268_acer_mic_automute(codec); |
| 11569 | } |
| 11570 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11571 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11572 | /* output mixer control */ |
| 11573 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11574 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11575 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11576 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11577 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11578 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11579 | { } |
| 11580 | }; |
| 11581 | |
| 11582 | static struct hda_verb alc268_dell_verbs[] = { |
| 11583 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11584 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11585 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11586 | { } |
| 11587 | }; |
| 11588 | |
| 11589 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11590 | static void alc268_dell_automute(struct hda_codec *codec) |
| 11591 | { |
| 11592 | unsigned int present; |
| 11593 | unsigned int mute; |
| 11594 | |
| 11595 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 11596 | if (present & 0x80000000) |
| 11597 | mute = HDA_AMP_MUTE; |
| 11598 | else |
| 11599 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 11600 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11601 | HDA_AMP_MUTE, mute); |
| 11602 | } |
| 11603 | |
| 11604 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 11605 | unsigned int res) |
| 11606 | { |
| 11607 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11608 | return; |
| 11609 | alc268_dell_automute(codec); |
| 11610 | } |
| 11611 | |
| 11612 | #define alc268_dell_init_hook alc268_dell_automute |
| 11613 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11614 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11615 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11616 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11617 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11618 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11619 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11620 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11621 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11622 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11623 | { } |
| 11624 | }; |
| 11625 | |
| 11626 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11627 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11628 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11629 | { } |
| 11630 | }; |
| 11631 | |
| 11632 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 11633 | { |
| 11634 | unsigned int present; |
| 11635 | |
| 11636 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11637 | & AC_PINSENSE_PRESENCE; |
| 11638 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11639 | present ? 0 : PIN_OUT); |
| 11640 | } |
| 11641 | |
| 11642 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11643 | { |
| 11644 | unsigned int present; |
| 11645 | |
| 11646 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11647 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11648 | snd_hda_codec_write(codec, 0x23, 0, |
| 11649 | AC_VERB_SET_CONNECT_SEL, |
| 11650 | present ? 0x00 : 0x01); |
| 11651 | } |
| 11652 | |
| 11653 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 11654 | { |
| 11655 | alc267_quanta_il1_hp_automute(codec); |
| 11656 | alc267_quanta_il1_mic_automute(codec); |
| 11657 | } |
| 11658 | |
| 11659 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11660 | unsigned int res) |
| 11661 | { |
| 11662 | switch (res >> 26) { |
| 11663 | case ALC880_HP_EVENT: |
| 11664 | alc267_quanta_il1_hp_automute(codec); |
| 11665 | break; |
| 11666 | case ALC880_MIC_EVENT: |
| 11667 | alc267_quanta_il1_mic_automute(codec); |
| 11668 | break; |
| 11669 | } |
| 11670 | } |
| 11671 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11672 | /* |
| 11673 | * generic initialization of ADC, input mixers and output mixers |
| 11674 | */ |
| 11675 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11676 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11677 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11678 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11679 | |
| 11680 | /* |
| 11681 | * Set up output mixers (0x0c - 0x0e) |
| 11682 | */ |
| 11683 | /* set vol=0 to output mixers */ |
| 11684 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11685 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11686 | |
| 11687 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11688 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11689 | |
| 11690 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11691 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11692 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11693 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11694 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11695 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11696 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11697 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11698 | |
| 11699 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11700 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11701 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11702 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11703 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11704 | |
| 11705 | /* set PCBEEP vol = 0, mute connections */ |
| 11706 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11707 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11708 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11709 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11710 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11711 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11712 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11713 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11714 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11715 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11716 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11717 | { } |
| 11718 | }; |
| 11719 | |
| 11720 | /* |
| 11721 | * generic initialization of ADC, input mixers and output mixers |
| 11722 | */ |
| 11723 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11724 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11725 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11726 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11727 | |
| 11728 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11729 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11730 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11731 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11732 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11733 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11734 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11735 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11736 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11737 | |
| 11738 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11739 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11740 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11741 | /* set PCBEEP vol = 0, mute connections */ |
| 11742 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11743 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11744 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11745 | |
| 11746 | { } |
| 11747 | }; |
| 11748 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11749 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11750 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11751 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11752 | { |
| 11753 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11754 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11755 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11756 | */ |
| 11757 | /* .name = "Capture Source", */ |
| 11758 | .name = "Input Source", |
| 11759 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11760 | .info = alc_mux_enum_info, |
| 11761 | .get = alc_mux_enum_get, |
| 11762 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11763 | }, |
| 11764 | { } /* end */ |
| 11765 | }; |
| 11766 | |
| 11767 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11768 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11769 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11770 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11771 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11772 | { |
| 11773 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11774 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11775 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11776 | */ |
| 11777 | /* .name = "Capture Source", */ |
| 11778 | .name = "Input Source", |
| 11779 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11780 | .info = alc_mux_enum_info, |
| 11781 | .get = alc_mux_enum_get, |
| 11782 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11783 | }, |
| 11784 | { } /* end */ |
| 11785 | }; |
| 11786 | |
| 11787 | static struct hda_input_mux alc268_capture_source = { |
| 11788 | .num_items = 4, |
| 11789 | .items = { |
| 11790 | { "Mic", 0x0 }, |
| 11791 | { "Front Mic", 0x1 }, |
| 11792 | { "Line", 0x2 }, |
| 11793 | { "CD", 0x3 }, |
| 11794 | }, |
| 11795 | }; |
| 11796 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11797 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11798 | .num_items = 3, |
| 11799 | .items = { |
| 11800 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11801 | { "Internal Mic", 0x1 }, |
| 11802 | { "Line", 0x2 }, |
| 11803 | }, |
| 11804 | }; |
| 11805 | |
| 11806 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11807 | .num_items = 3, |
| 11808 | .items = { |
| 11809 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11810 | { "Internal Mic", 0x6 }, |
| 11811 | { "Line", 0x2 }, |
| 11812 | }, |
| 11813 | }; |
| 11814 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11815 | #ifdef CONFIG_SND_DEBUG |
| 11816 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11817 | /* Volume widgets */ |
| 11818 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11819 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11820 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11821 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11822 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11823 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11824 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11825 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11826 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11827 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11828 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11829 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11830 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11831 | /* The below appears problematic on some hardwares */ |
| 11832 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11833 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11834 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11835 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11836 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11837 | |
| 11838 | /* Modes for retasking pin widgets */ |
| 11839 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11840 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11841 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11842 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11843 | |
| 11844 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11845 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11846 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11847 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11848 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11849 | |
| 11850 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11851 | * The ALC268 does not have an SPDIF input. |
| 11852 | */ |
| 11853 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11854 | |
| 11855 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11856 | * this output to turn on an external amplifier. |
| 11857 | */ |
| 11858 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11859 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11860 | |
| 11861 | { } /* end */ |
| 11862 | }; |
| 11863 | #endif |
| 11864 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11865 | /* create input playback/capture controls for the given pin */ |
| 11866 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11867 | const char *ctlname, int idx) |
| 11868 | { |
| 11869 | char name[32]; |
| 11870 | int err; |
| 11871 | |
| 11872 | sprintf(name, "%s Playback Volume", ctlname); |
| 11873 | if (nid == 0x14) { |
| 11874 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11875 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11876 | HDA_OUTPUT)); |
| 11877 | if (err < 0) |
| 11878 | return err; |
| 11879 | } else if (nid == 0x15) { |
| 11880 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11881 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11882 | HDA_OUTPUT)); |
| 11883 | if (err < 0) |
| 11884 | return err; |
| 11885 | } else |
| 11886 | return -1; |
| 11887 | sprintf(name, "%s Playback Switch", ctlname); |
| 11888 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11889 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11890 | if (err < 0) |
| 11891 | return err; |
| 11892 | return 0; |
| 11893 | } |
| 11894 | |
| 11895 | /* add playback controls from the parsed DAC table */ |
| 11896 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11897 | const struct auto_pin_cfg *cfg) |
| 11898 | { |
| 11899 | hda_nid_t nid; |
| 11900 | int err; |
| 11901 | |
| 11902 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11903 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11904 | spec->multiout.dac_nids[0] = 2; |
| 11905 | spec->multiout.dac_nids[1] = 3; |
| 11906 | |
| 11907 | nid = cfg->line_out_pins[0]; |
| 11908 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11909 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11910 | |
| 11911 | nid = cfg->speaker_pins[0]; |
| 11912 | if (nid == 0x1d) { |
| 11913 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11914 | "Speaker Playback Volume", |
| 11915 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11916 | if (err < 0) |
| 11917 | return err; |
| 11918 | } |
| 11919 | nid = cfg->hp_pins[0]; |
| 11920 | if (nid) |
| 11921 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11922 | |
| 11923 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11924 | if (nid == 0x16) { |
| 11925 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11926 | "Mono Playback Switch", |
| 11927 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11928 | if (err < 0) |
| 11929 | return err; |
| 11930 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11931 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11932 | } |
| 11933 | |
| 11934 | /* create playback/capture controls for input pins */ |
| 11935 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11936 | const struct auto_pin_cfg *cfg) |
| 11937 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11938 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11939 | int i, idx1; |
| 11940 | |
| 11941 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11942 | switch(cfg->input_pins[i]) { |
| 11943 | case 0x18: |
| 11944 | idx1 = 0; /* Mic 1 */ |
| 11945 | break; |
| 11946 | case 0x19: |
| 11947 | idx1 = 1; /* Mic 2 */ |
| 11948 | break; |
| 11949 | case 0x1a: |
| 11950 | idx1 = 2; /* Line In */ |
| 11951 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11952 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11953 | idx1 = 3; /* CD */ |
| 11954 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11955 | case 0x12: |
| 11956 | case 0x13: |
| 11957 | idx1 = 6; /* digital mics */ |
| 11958 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11959 | default: |
| 11960 | continue; |
| 11961 | } |
| 11962 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11963 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11964 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11965 | } |
| 11966 | return 0; |
| 11967 | } |
| 11968 | |
| 11969 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11970 | { |
| 11971 | struct alc_spec *spec = codec->spec; |
| 11972 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11973 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11974 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11975 | unsigned int dac_vol1, dac_vol2; |
| 11976 | |
| 11977 | if (speaker_nid) { |
| 11978 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11979 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11980 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11981 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11982 | AMP_IN_UNMUTE(1)); |
| 11983 | snd_hda_codec_write(codec, 0x10, 0, |
| 11984 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11985 | AMP_IN_UNMUTE(1)); |
| 11986 | } else { |
| 11987 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11988 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11989 | snd_hda_codec_write(codec, 0x10, 0, |
| 11990 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11991 | } |
| 11992 | |
| 11993 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11994 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11995 | dac_vol2 = AMP_OUT_ZERO; |
| 11996 | else if (line_nid == 0x15) |
| 11997 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11998 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11999 | dac_vol2 = AMP_OUT_ZERO; |
| 12000 | else if (hp_nid == 0x15) |
| 12001 | dac_vol1 = AMP_OUT_ZERO; |
| 12002 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12003 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12004 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12005 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12006 | |
| 12007 | snd_hda_codec_write(codec, 0x02, 0, |
| 12008 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12009 | snd_hda_codec_write(codec, 0x03, 0, |
| 12010 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12011 | } |
| 12012 | |
| 12013 | /* pcm configuration: identiacal with ALC880 */ |
| 12014 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12015 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12016 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12017 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12018 | |
| 12019 | /* |
| 12020 | * BIOS auto configuration |
| 12021 | */ |
| 12022 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12023 | { |
| 12024 | struct alc_spec *spec = codec->spec; |
| 12025 | int err; |
| 12026 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12027 | |
| 12028 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12029 | alc268_ignore); |
| 12030 | if (err < 0) |
| 12031 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12032 | if (!spec->autocfg.line_outs) { |
| 12033 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12034 | spec->multiout.max_channels = 2; |
| 12035 | spec->no_analog = 1; |
| 12036 | goto dig_only; |
| 12037 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12038 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12039 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12040 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12041 | if (err < 0) |
| 12042 | return err; |
| 12043 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12044 | if (err < 0) |
| 12045 | return err; |
| 12046 | |
| 12047 | spec->multiout.max_channels = 2; |
| 12048 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12049 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12050 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12051 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12052 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12053 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12054 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12055 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12056 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12057 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12058 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12059 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12060 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12061 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12062 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12063 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12064 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12065 | err = alc_auto_add_mic_boost(codec); |
| 12066 | if (err < 0) |
| 12067 | return err; |
| 12068 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12069 | return 1; |
| 12070 | } |
| 12071 | |
| 12072 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12073 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12074 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12075 | |
| 12076 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12077 | static void alc268_auto_init(struct hda_codec *codec) |
| 12078 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12079 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12080 | alc268_auto_init_multi_out(codec); |
| 12081 | alc268_auto_init_hp_out(codec); |
| 12082 | alc268_auto_init_mono_speaker_out(codec); |
| 12083 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12084 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12085 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12086 | } |
| 12087 | |
| 12088 | /* |
| 12089 | * configuration and preset |
| 12090 | */ |
| 12091 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12092 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12093 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12094 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12095 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12096 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12097 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12098 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12099 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12100 | #ifdef CONFIG_SND_DEBUG |
| 12101 | [ALC268_TEST] = "test", |
| 12102 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12103 | [ALC268_AUTO] = "auto", |
| 12104 | }; |
| 12105 | |
| 12106 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12107 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12108 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12109 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12110 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12111 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12112 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12113 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12114 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12115 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12116 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12117 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12118 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 12119 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 12120 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12121 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12122 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12123 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12124 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12125 | {} |
| 12126 | }; |
| 12127 | |
| 12128 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12129 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12130 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12131 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12132 | alc267_quanta_il1_verbs }, |
| 12133 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12134 | .dac_nids = alc268_dac_nids, |
| 12135 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12136 | .adc_nids = alc268_adc_nids_alt, |
| 12137 | .hp_nid = 0x03, |
| 12138 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12139 | .channel_mode = alc268_modes, |
| 12140 | .input_mux = &alc268_capture_source, |
| 12141 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 12142 | .init_hook = alc267_quanta_il1_automute, |
| 12143 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12144 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12145 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12146 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12147 | .init_verbs = { alc268_base_init_verbs }, |
| 12148 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12149 | .dac_nids = alc268_dac_nids, |
| 12150 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12151 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12152 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12153 | .hp_nid = 0x03, |
| 12154 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12155 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12156 | .channel_mode = alc268_modes, |
| 12157 | .input_mux = &alc268_capture_source, |
| 12158 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12159 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12160 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12161 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12162 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12163 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12164 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12165 | .dac_nids = alc268_dac_nids, |
| 12166 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12167 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12168 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12169 | .hp_nid = 0x03, |
| 12170 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12171 | .channel_mode = alc268_modes, |
| 12172 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12173 | .unsol_event = alc268_toshiba_unsol_event, |
| 12174 | .init_hook = alc268_toshiba_automute, |
| 12175 | }, |
| 12176 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12177 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12178 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12179 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12180 | alc268_acer_verbs }, |
| 12181 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12182 | .dac_nids = alc268_dac_nids, |
| 12183 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12184 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12185 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12186 | .hp_nid = 0x02, |
| 12187 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12188 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12189 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12190 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12191 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12192 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12193 | [ALC268_ACER_DMIC] = { |
| 12194 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12195 | alc268_beep_mixer }, |
| 12196 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12197 | alc268_acer_verbs }, |
| 12198 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12199 | .dac_nids = alc268_dac_nids, |
| 12200 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12201 | .adc_nids = alc268_adc_nids_alt, |
| 12202 | .capsrc_nids = alc268_capsrc_nids, |
| 12203 | .hp_nid = 0x02, |
| 12204 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12205 | .channel_mode = alc268_modes, |
| 12206 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12207 | .unsol_event = alc268_acer_unsol_event, |
| 12208 | .init_hook = alc268_acer_init_hook, |
| 12209 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12210 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12211 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12212 | alc268_beep_mixer, |
| 12213 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12214 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12215 | alc268_acer_aspire_one_verbs }, |
| 12216 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12217 | .dac_nids = alc268_dac_nids, |
| 12218 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12219 | .adc_nids = alc268_adc_nids_alt, |
| 12220 | .capsrc_nids = alc268_capsrc_nids, |
| 12221 | .hp_nid = 0x03, |
| 12222 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12223 | .channel_mode = alc268_modes, |
| 12224 | .input_mux = &alc268_acer_lc_capture_source, |
| 12225 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12226 | .init_hook = alc268_acer_lc_init_hook, |
| 12227 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12228 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12229 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12230 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12231 | alc268_dell_verbs }, |
| 12232 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12233 | .dac_nids = alc268_dac_nids, |
| 12234 | .hp_nid = 0x02, |
| 12235 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12236 | .channel_mode = alc268_modes, |
| 12237 | .unsol_event = alc268_dell_unsol_event, |
| 12238 | .init_hook = alc268_dell_init_hook, |
| 12239 | .input_mux = &alc268_capture_source, |
| 12240 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12241 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12242 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12243 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12244 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12245 | alc268_toshiba_verbs }, |
| 12246 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12247 | .dac_nids = alc268_dac_nids, |
| 12248 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12249 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12250 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12251 | .hp_nid = 0x03, |
| 12252 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12253 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12254 | .channel_mode = alc268_modes, |
| 12255 | .input_mux = &alc268_capture_source, |
| 12256 | .unsol_event = alc268_toshiba_unsol_event, |
| 12257 | .init_hook = alc268_toshiba_automute |
| 12258 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12259 | #ifdef CONFIG_SND_DEBUG |
| 12260 | [ALC268_TEST] = { |
| 12261 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12262 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12263 | alc268_volume_init_verbs }, |
| 12264 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12265 | .dac_nids = alc268_dac_nids, |
| 12266 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12267 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12268 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12269 | .hp_nid = 0x03, |
| 12270 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12271 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12272 | .channel_mode = alc268_modes, |
| 12273 | .input_mux = &alc268_capture_source, |
| 12274 | }, |
| 12275 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12276 | }; |
| 12277 | |
| 12278 | static int patch_alc268(struct hda_codec *codec) |
| 12279 | { |
| 12280 | struct alc_spec *spec; |
| 12281 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12282 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12283 | |
| 12284 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12285 | if (spec == NULL) |
| 12286 | return -ENOMEM; |
| 12287 | |
| 12288 | codec->spec = spec; |
| 12289 | |
| 12290 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12291 | alc268_models, |
| 12292 | alc268_cfg_tbl); |
| 12293 | |
| 12294 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 12295 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 12296 | "trying auto-probe from BIOS...\n"); |
| 12297 | board_config = ALC268_AUTO; |
| 12298 | } |
| 12299 | |
| 12300 | if (board_config == ALC268_AUTO) { |
| 12301 | /* automatic parse from the BIOS config */ |
| 12302 | err = alc268_parse_auto_config(codec); |
| 12303 | if (err < 0) { |
| 12304 | alc_free(codec); |
| 12305 | return err; |
| 12306 | } else if (!err) { |
| 12307 | printk(KERN_INFO |
| 12308 | "hda_codec: Cannot set up configuration " |
| 12309 | "from BIOS. Using base mode...\n"); |
| 12310 | board_config = ALC268_3ST; |
| 12311 | } |
| 12312 | } |
| 12313 | |
| 12314 | if (board_config != ALC268_AUTO) |
| 12315 | setup_preset(spec, &alc268_presets[board_config]); |
| 12316 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 12317 | if (codec->vendor_id == 0x10ec0267) { |
| 12318 | spec->stream_name_analog = "ALC267 Analog"; |
| 12319 | spec->stream_name_digital = "ALC267 Digital"; |
| 12320 | } else { |
| 12321 | spec->stream_name_analog = "ALC268 Analog"; |
| 12322 | spec->stream_name_digital = "ALC268 Digital"; |
| 12323 | } |
| 12324 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12325 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12326 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12327 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12328 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12329 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12330 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12331 | has_beep = 0; |
| 12332 | for (i = 0; i < spec->num_mixers; i++) { |
| 12333 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12334 | has_beep = 1; |
| 12335 | break; |
| 12336 | } |
| 12337 | } |
| 12338 | |
| 12339 | if (has_beep) { |
| 12340 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12341 | if (err < 0) { |
| 12342 | alc_free(codec); |
| 12343 | return err; |
| 12344 | } |
| 12345 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12346 | /* override the amp caps for beep generator */ |
| 12347 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12348 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12349 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12350 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12351 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12352 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12353 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12354 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12355 | /* check whether NID 0x07 is valid */ |
| 12356 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12357 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12358 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12359 | /* get type */ |
| 12360 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12361 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12362 | spec->adc_nids = alc268_adc_nids_alt; |
| 12363 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12364 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12365 | } else { |
| 12366 | spec->adc_nids = alc268_adc_nids; |
| 12367 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12368 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12369 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12370 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12371 | /* set default input source */ |
| 12372 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12373 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12374 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12375 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12376 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12377 | |
| 12378 | spec->vmaster_nid = 0x02; |
| 12379 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12380 | codec->patch_ops = alc_patch_ops; |
| 12381 | if (board_config == ALC268_AUTO) |
| 12382 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12383 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12384 | codec->proc_widget_hook = print_realtek_coef; |
| 12385 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12386 | return 0; |
| 12387 | } |
| 12388 | |
| 12389 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12390 | * ALC269 channel source setting (2 channel) |
| 12391 | */ |
| 12392 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12393 | |
| 12394 | #define alc269_dac_nids alc260_dac_nids |
| 12395 | |
| 12396 | static hda_nid_t alc269_adc_nids[1] = { |
| 12397 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12398 | 0x08, |
| 12399 | }; |
| 12400 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12401 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12402 | 0x23, |
| 12403 | }; |
| 12404 | |
| 12405 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12406 | * not a mux! |
| 12407 | */ |
| 12408 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12409 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12410 | .num_items = 2, |
| 12411 | .items = { |
| 12412 | { "i-Mic", 0x5 }, |
| 12413 | { "e-Mic", 0x0 }, |
| 12414 | }, |
| 12415 | }; |
| 12416 | |
| 12417 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12418 | .num_items = 2, |
| 12419 | .items = { |
| 12420 | { "i-Mic", 0x1 }, |
| 12421 | { "e-Mic", 0x0 }, |
| 12422 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12423 | }; |
| 12424 | |
| 12425 | #define alc269_modes alc260_modes |
| 12426 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12427 | |
| 12428 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12429 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12430 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12431 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12432 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12433 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12434 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12435 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12436 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12437 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12438 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12439 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12440 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12441 | { } /* end */ |
| 12442 | }; |
| 12443 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12444 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12445 | /* output mixer control */ |
| 12446 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12447 | { |
| 12448 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12449 | .name = "Master Playback Switch", |
| 12450 | .info = snd_hda_mixer_amp_switch_info, |
| 12451 | .get = snd_hda_mixer_amp_switch_get, |
| 12452 | .put = alc268_acer_master_sw_put, |
| 12453 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12454 | }, |
| 12455 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12456 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12457 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12458 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12459 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12460 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12461 | { } |
| 12462 | }; |
| 12463 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12464 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12465 | /* output mixer control */ |
| 12466 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12467 | { |
| 12468 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12469 | .name = "Master Playback Switch", |
| 12470 | .info = snd_hda_mixer_amp_switch_info, |
| 12471 | .get = snd_hda_mixer_amp_switch_get, |
| 12472 | .put = alc268_acer_master_sw_put, |
| 12473 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12474 | }, |
| 12475 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12476 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12477 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12478 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12479 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12480 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12481 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12482 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12483 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12484 | { } |
| 12485 | }; |
| 12486 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12487 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12488 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12489 | .ops = &snd_hda_bind_vol, |
| 12490 | .values = { |
| 12491 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12492 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12493 | 0 |
| 12494 | }, |
| 12495 | }; |
| 12496 | |
| 12497 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12498 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12499 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12500 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12501 | { } /* end */ |
| 12502 | }; |
| 12503 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12504 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12505 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12506 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12507 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12508 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12509 | { } /* end */ |
| 12510 | }; |
| 12511 | |
| 12512 | /* FSC amilo */ |
| 12513 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12514 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12515 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12516 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12517 | { } /* end */ |
| 12518 | }; |
| 12519 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12520 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12521 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12522 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12523 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12524 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12525 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12526 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12527 | { } |
| 12528 | }; |
| 12529 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12530 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12531 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12532 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12533 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12534 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12535 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12536 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12537 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12538 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12539 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12540 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12541 | { } |
| 12542 | }; |
| 12543 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12544 | /* toggle speaker-output according to the hp-jack state */ |
| 12545 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12546 | { |
| 12547 | unsigned int present; |
| 12548 | unsigned char bits; |
| 12549 | |
| 12550 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12551 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12552 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12553 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12554 | AMP_IN_MUTE(0), bits); |
| 12555 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12556 | AMP_IN_MUTE(0), bits); |
| 12557 | |
| 12558 | snd_hda_codec_write(codec, 0x20, 0, |
| 12559 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12560 | snd_hda_codec_write(codec, 0x20, 0, |
| 12561 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12562 | |
| 12563 | snd_hda_codec_write(codec, 0x20, 0, |
| 12564 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12565 | snd_hda_codec_write(codec, 0x20, 0, |
| 12566 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12567 | } |
| 12568 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12569 | /* toggle speaker-output according to the hp-jacks state */ |
| 12570 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12571 | { |
| 12572 | unsigned int present; |
| 12573 | unsigned char bits; |
| 12574 | |
| 12575 | /* Check laptop headphone socket */ |
| 12576 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12577 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12578 | |
| 12579 | /* Check port replicator headphone socket */ |
| 12580 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12581 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12582 | |
| 12583 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12584 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12585 | AMP_IN_MUTE(0), bits); |
| 12586 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12587 | AMP_IN_MUTE(0), bits); |
| 12588 | |
| 12589 | snd_hda_codec_write(codec, 0x20, 0, |
| 12590 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12591 | snd_hda_codec_write(codec, 0x20, 0, |
| 12592 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12593 | |
| 12594 | snd_hda_codec_write(codec, 0x20, 0, |
| 12595 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12596 | snd_hda_codec_write(codec, 0x20, 0, |
| 12597 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12598 | } |
| 12599 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12600 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12601 | { |
| 12602 | unsigned int present; |
| 12603 | |
| 12604 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12605 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12606 | snd_hda_codec_write(codec, 0x23, 0, |
| 12607 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12608 | } |
| 12609 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12610 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12611 | { |
| 12612 | unsigned int present_laptop; |
| 12613 | unsigned int present_dock; |
| 12614 | |
| 12615 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12616 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12617 | |
| 12618 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12619 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12620 | |
| 12621 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12622 | if (present_dock) |
| 12623 | snd_hda_codec_write(codec, 0x23, 0, |
| 12624 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12625 | if (present_laptop) |
| 12626 | snd_hda_codec_write(codec, 0x23, 0, |
| 12627 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12628 | if (!present_dock && !present_laptop) |
| 12629 | snd_hda_codec_write(codec, 0x23, 0, |
| 12630 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12631 | } |
| 12632 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12633 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12634 | unsigned int res) |
| 12635 | { |
| 12636 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12637 | alc269_quanta_fl1_speaker_automute(codec); |
| 12638 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12639 | alc269_quanta_fl1_mic_automute(codec); |
| 12640 | } |
| 12641 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12642 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12643 | unsigned int res) |
| 12644 | { |
| 12645 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12646 | alc269_lifebook_speaker_automute(codec); |
| 12647 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12648 | alc269_lifebook_mic_autoswitch(codec); |
| 12649 | } |
| 12650 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12651 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12652 | { |
| 12653 | alc269_quanta_fl1_speaker_automute(codec); |
| 12654 | alc269_quanta_fl1_mic_automute(codec); |
| 12655 | } |
| 12656 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12657 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12658 | { |
| 12659 | alc269_lifebook_speaker_automute(codec); |
| 12660 | alc269_lifebook_mic_autoswitch(codec); |
| 12661 | } |
| 12662 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12663 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12664 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12665 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12666 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12667 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12668 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12669 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12670 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12671 | {} |
| 12672 | }; |
| 12673 | |
| 12674 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12675 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12676 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12677 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12678 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12679 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12680 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12681 | {} |
| 12682 | }; |
| 12683 | |
| 12684 | /* toggle speaker-output according to the hp-jack state */ |
| 12685 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12686 | { |
| 12687 | unsigned int present; |
| 12688 | unsigned char bits; |
| 12689 | |
| 12690 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12691 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12692 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12693 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12694 | AMP_IN_MUTE(0), bits); |
| 12695 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12696 | AMP_IN_MUTE(0), bits); |
| 12697 | } |
| 12698 | |
| 12699 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12700 | { |
| 12701 | unsigned int present; |
| 12702 | |
| 12703 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12704 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12705 | snd_hda_codec_write(codec, 0x23, 0, |
| 12706 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12707 | } |
| 12708 | |
| 12709 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12710 | { |
| 12711 | unsigned int present; |
| 12712 | |
| 12713 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12714 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12715 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12716 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12717 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12718 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12719 | } |
| 12720 | |
| 12721 | /* unsolicited event for HP jack sensing */ |
| 12722 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12723 | unsigned int res) |
| 12724 | { |
| 12725 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12726 | alc269_speaker_automute(codec); |
| 12727 | |
| 12728 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12729 | alc269_eeepc_dmic_automute(codec); |
| 12730 | } |
| 12731 | |
| 12732 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12733 | { |
| 12734 | alc269_speaker_automute(codec); |
| 12735 | alc269_eeepc_dmic_automute(codec); |
| 12736 | } |
| 12737 | |
| 12738 | /* unsolicited event for HP jack sensing */ |
| 12739 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12740 | unsigned int res) |
| 12741 | { |
| 12742 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12743 | alc269_speaker_automute(codec); |
| 12744 | |
| 12745 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12746 | alc269_eeepc_amic_automute(codec); |
| 12747 | } |
| 12748 | |
| 12749 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12750 | { |
| 12751 | alc269_speaker_automute(codec); |
| 12752 | alc269_eeepc_amic_automute(codec); |
| 12753 | } |
| 12754 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12755 | /* |
| 12756 | * generic initialization of ADC, input mixers and output mixers |
| 12757 | */ |
| 12758 | static struct hda_verb alc269_init_verbs[] = { |
| 12759 | /* |
| 12760 | * Unmute ADC0 and set the default input to mic-in |
| 12761 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12762 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12763 | |
| 12764 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12765 | * analog-loopback mixer widget |
| 12766 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12767 | * front panel mic (mic 2) |
| 12768 | */ |
| 12769 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12770 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12771 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12772 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12773 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12774 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12775 | |
| 12776 | /* |
| 12777 | * Set up output mixers (0x0c - 0x0e) |
| 12778 | */ |
| 12779 | /* set vol=0 to output mixers */ |
| 12780 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12781 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12782 | |
| 12783 | /* set up input amps for analog loopback */ |
| 12784 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12785 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12786 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12787 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12788 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12789 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12790 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12791 | |
| 12792 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12793 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12794 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12795 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12796 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12797 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12798 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12799 | |
| 12800 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12801 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12802 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12803 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12804 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12805 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12806 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12807 | |
| 12808 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12809 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12810 | |
| 12811 | /* FIXME: use matrix-type input source selection */ |
| 12812 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12813 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12814 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12815 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12816 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12817 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12818 | |
| 12819 | /* set EAPD */ |
| 12820 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12821 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12822 | { } |
| 12823 | }; |
| 12824 | |
| 12825 | /* add playback controls from the parsed DAC table */ |
| 12826 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12827 | const struct auto_pin_cfg *cfg) |
| 12828 | { |
| 12829 | hda_nid_t nid; |
| 12830 | int err; |
| 12831 | |
| 12832 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12833 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12834 | spec->multiout.dac_nids[0] = 2; |
| 12835 | |
| 12836 | nid = cfg->line_out_pins[0]; |
| 12837 | if (nid) { |
| 12838 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12839 | "Front Playback Volume", |
| 12840 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12841 | if (err < 0) |
| 12842 | return err; |
| 12843 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12844 | "Front Playback Switch", |
| 12845 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12846 | if (err < 0) |
| 12847 | return err; |
| 12848 | } |
| 12849 | |
| 12850 | nid = cfg->speaker_pins[0]; |
| 12851 | if (nid) { |
| 12852 | if (!cfg->line_out_pins[0]) { |
| 12853 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12854 | "Speaker Playback Volume", |
| 12855 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12856 | HDA_OUTPUT)); |
| 12857 | if (err < 0) |
| 12858 | return err; |
| 12859 | } |
| 12860 | if (nid == 0x16) { |
| 12861 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12862 | "Speaker Playback Switch", |
| 12863 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12864 | HDA_OUTPUT)); |
| 12865 | if (err < 0) |
| 12866 | return err; |
| 12867 | } else { |
| 12868 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12869 | "Speaker Playback Switch", |
| 12870 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12871 | HDA_OUTPUT)); |
| 12872 | if (err < 0) |
| 12873 | return err; |
| 12874 | } |
| 12875 | } |
| 12876 | nid = cfg->hp_pins[0]; |
| 12877 | if (nid) { |
| 12878 | /* spec->multiout.hp_nid = 2; */ |
| 12879 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12880 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12881 | "Headphone Playback Volume", |
| 12882 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12883 | HDA_OUTPUT)); |
| 12884 | if (err < 0) |
| 12885 | return err; |
| 12886 | } |
| 12887 | if (nid == 0x16) { |
| 12888 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12889 | "Headphone Playback Switch", |
| 12890 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12891 | HDA_OUTPUT)); |
| 12892 | if (err < 0) |
| 12893 | return err; |
| 12894 | } else { |
| 12895 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12896 | "Headphone Playback Switch", |
| 12897 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12898 | HDA_OUTPUT)); |
| 12899 | if (err < 0) |
| 12900 | return err; |
| 12901 | } |
| 12902 | } |
| 12903 | return 0; |
| 12904 | } |
| 12905 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12906 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12907 | const struct auto_pin_cfg *cfg) |
| 12908 | { |
| 12909 | int err; |
| 12910 | |
| 12911 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 12912 | if (err < 0) |
| 12913 | return err; |
| 12914 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 12915 | * because it's under 0x18 |
| 12916 | */ |
| 12917 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 12918 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12919 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12920 | imux->items[imux->num_items].label = "Int Mic"; |
| 12921 | imux->items[imux->num_items].index = 0x05; |
| 12922 | imux->num_items++; |
| 12923 | } |
| 12924 | return 0; |
| 12925 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12926 | |
| 12927 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12928 | #define alc269_loopbacks alc880_loopbacks |
| 12929 | #endif |
| 12930 | |
| 12931 | /* pcm configuration: identiacal with ALC880 */ |
| 12932 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12933 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12934 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12935 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12936 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 12937 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 12938 | .substreams = 1, |
| 12939 | .channels_min = 2, |
| 12940 | .channels_max = 8, |
| 12941 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 12942 | /* NID is set in alc_build_pcms */ |
| 12943 | .ops = { |
| 12944 | .open = alc880_playback_pcm_open, |
| 12945 | .prepare = alc880_playback_pcm_prepare, |
| 12946 | .cleanup = alc880_playback_pcm_cleanup |
| 12947 | }, |
| 12948 | }; |
| 12949 | |
| 12950 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 12951 | .substreams = 1, |
| 12952 | .channels_min = 2, |
| 12953 | .channels_max = 2, |
| 12954 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 12955 | /* NID is set in alc_build_pcms */ |
| 12956 | }; |
| 12957 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12958 | /* |
| 12959 | * BIOS auto configuration |
| 12960 | */ |
| 12961 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12962 | { |
| 12963 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 12964 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12965 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12966 | |
| 12967 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12968 | alc269_ignore); |
| 12969 | if (err < 0) |
| 12970 | return err; |
| 12971 | |
| 12972 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12973 | if (err < 0) |
| 12974 | return err; |
| 12975 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12976 | if (err < 0) |
| 12977 | return err; |
| 12978 | |
| 12979 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12980 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12981 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12982 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12983 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12984 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12985 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12986 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12987 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12988 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12989 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12990 | /* set default input source */ |
| 12991 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12992 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12993 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12994 | |
| 12995 | err = alc_auto_add_mic_boost(codec); |
| 12996 | if (err < 0) |
| 12997 | return err; |
| 12998 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12999 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13000 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13001 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13002 | return 1; |
| 13003 | } |
| 13004 | |
| 13005 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 13006 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 13007 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13008 | |
| 13009 | |
| 13010 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13011 | static void alc269_auto_init(struct hda_codec *codec) |
| 13012 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13013 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13014 | alc269_auto_init_multi_out(codec); |
| 13015 | alc269_auto_init_hp_out(codec); |
| 13016 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13017 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13018 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13019 | } |
| 13020 | |
| 13021 | /* |
| 13022 | * configuration and preset |
| 13023 | */ |
| 13024 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13025 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13026 | [ALC269_QUANTA_FL1] = "quanta", |
| 13027 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13028 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13029 | [ALC269_FUJITSU] = "fujitsu", |
| 13030 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13031 | }; |
| 13032 | |
| 13033 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13034 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13035 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13036 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13037 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13038 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13039 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13040 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13041 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13042 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13043 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13044 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13045 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13046 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13047 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13048 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13049 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13050 | {} |
| 13051 | }; |
| 13052 | |
| 13053 | static struct alc_config_preset alc269_presets[] = { |
| 13054 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13055 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13056 | .init_verbs = { alc269_init_verbs }, |
| 13057 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13058 | .dac_nids = alc269_dac_nids, |
| 13059 | .hp_nid = 0x03, |
| 13060 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13061 | .channel_mode = alc269_modes, |
| 13062 | .input_mux = &alc269_capture_source, |
| 13063 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13064 | [ALC269_QUANTA_FL1] = { |
| 13065 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13066 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13067 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13068 | .dac_nids = alc269_dac_nids, |
| 13069 | .hp_nid = 0x03, |
| 13070 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13071 | .channel_mode = alc269_modes, |
| 13072 | .input_mux = &alc269_capture_source, |
| 13073 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 13074 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13075 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13076 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13077 | .mixers = { alc269_eeepc_mixer }, |
| 13078 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13079 | .init_verbs = { alc269_init_verbs, |
| 13080 | alc269_eeepc_amic_init_verbs }, |
| 13081 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13082 | .dac_nids = alc269_dac_nids, |
| 13083 | .hp_nid = 0x03, |
| 13084 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13085 | .channel_mode = alc269_modes, |
| 13086 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 13087 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 13088 | .init_hook = alc269_eeepc_amic_inithook, |
| 13089 | }, |
| 13090 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13091 | .mixers = { alc269_eeepc_mixer }, |
| 13092 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13093 | .init_verbs = { alc269_init_verbs, |
| 13094 | alc269_eeepc_dmic_init_verbs }, |
| 13095 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13096 | .dac_nids = alc269_dac_nids, |
| 13097 | .hp_nid = 0x03, |
| 13098 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13099 | .channel_mode = alc269_modes, |
| 13100 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13101 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13102 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13103 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13104 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13105 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13106 | .cap_mixer = alc269_epc_capture_mixer, |
| 13107 | .init_verbs = { alc269_init_verbs, |
| 13108 | alc269_eeepc_dmic_init_verbs }, |
| 13109 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13110 | .dac_nids = alc269_dac_nids, |
| 13111 | .hp_nid = 0x03, |
| 13112 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13113 | .channel_mode = alc269_modes, |
| 13114 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13115 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13116 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13117 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13118 | [ALC269_LIFEBOOK] = { |
| 13119 | .mixers = { alc269_lifebook_mixer }, |
| 13120 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13121 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13122 | .dac_nids = alc269_dac_nids, |
| 13123 | .hp_nid = 0x03, |
| 13124 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13125 | .channel_mode = alc269_modes, |
| 13126 | .input_mux = &alc269_capture_source, |
| 13127 | .unsol_event = alc269_lifebook_unsol_event, |
| 13128 | .init_hook = alc269_lifebook_init_hook, |
| 13129 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13130 | }; |
| 13131 | |
| 13132 | static int patch_alc269(struct hda_codec *codec) |
| 13133 | { |
| 13134 | struct alc_spec *spec; |
| 13135 | int board_config; |
| 13136 | int err; |
| 13137 | |
| 13138 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13139 | if (spec == NULL) |
| 13140 | return -ENOMEM; |
| 13141 | |
| 13142 | codec->spec = spec; |
| 13143 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13144 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13145 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13146 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13147 | alc269_models, |
| 13148 | alc269_cfg_tbl); |
| 13149 | |
| 13150 | if (board_config < 0) { |
| 13151 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 13152 | "trying auto-probe from BIOS...\n"); |
| 13153 | board_config = ALC269_AUTO; |
| 13154 | } |
| 13155 | |
| 13156 | if (board_config == ALC269_AUTO) { |
| 13157 | /* automatic parse from the BIOS config */ |
| 13158 | err = alc269_parse_auto_config(codec); |
| 13159 | if (err < 0) { |
| 13160 | alc_free(codec); |
| 13161 | return err; |
| 13162 | } else if (!err) { |
| 13163 | printk(KERN_INFO |
| 13164 | "hda_codec: Cannot set up configuration " |
| 13165 | "from BIOS. Using base mode...\n"); |
| 13166 | board_config = ALC269_BASIC; |
| 13167 | } |
| 13168 | } |
| 13169 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13170 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13171 | if (err < 0) { |
| 13172 | alc_free(codec); |
| 13173 | return err; |
| 13174 | } |
| 13175 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13176 | if (board_config != ALC269_AUTO) |
| 13177 | setup_preset(spec, &alc269_presets[board_config]); |
| 13178 | |
| 13179 | spec->stream_name_analog = "ALC269 Analog"; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13180 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13181 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13182 | * fix the sample rate of analog I/O to 44.1kHz |
| 13183 | */ |
| 13184 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13185 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13186 | } else { |
| 13187 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13188 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13189 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13190 | spec->stream_name_digital = "ALC269 Digital"; |
| 13191 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13192 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13193 | |
| 13194 | spec->adc_nids = alc269_adc_nids; |
| 13195 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13196 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13197 | if (!spec->cap_mixer) |
| 13198 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13199 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13200 | |
| 13201 | codec->patch_ops = alc_patch_ops; |
| 13202 | if (board_config == ALC269_AUTO) |
| 13203 | spec->init_hook = alc269_auto_init; |
| 13204 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13205 | if (!spec->loopback.amplist) |
| 13206 | spec->loopback.amplist = alc269_loopbacks; |
| 13207 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13208 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13209 | |
| 13210 | return 0; |
| 13211 | } |
| 13212 | |
| 13213 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13214 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13215 | */ |
| 13216 | |
| 13217 | /* |
| 13218 | * set the path ways for 2 channel output |
| 13219 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13220 | */ |
| 13221 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13222 | /* set pin widget 1Ah (line in) for input */ |
| 13223 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13224 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13225 | * the vref |
| 13226 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13227 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13228 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13229 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13230 | #if 0 |
| 13231 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13232 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13233 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13234 | { } /* end */ |
| 13235 | }; |
| 13236 | /* |
| 13237 | * 6ch mode |
| 13238 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13239 | */ |
| 13240 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13241 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13242 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13243 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13244 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13245 | |
| 13246 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13247 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13248 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13249 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13250 | #if 0 |
| 13251 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13252 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13253 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13254 | { } /* end */ |
| 13255 | }; |
| 13256 | |
| 13257 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13258 | { 2, alc861_threestack_ch2_init }, |
| 13259 | { 6, alc861_threestack_ch6_init }, |
| 13260 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13261 | /* Set mic1 as input and unmute the mixer */ |
| 13262 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13263 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13264 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13265 | { } /* end */ |
| 13266 | }; |
| 13267 | /* Set mic1 as output and mute mixer */ |
| 13268 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13269 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13270 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13271 | { } /* end */ |
| 13272 | }; |
| 13273 | |
| 13274 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13275 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13276 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13277 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13278 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13279 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13280 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13281 | /* set pin widget 1Ah (line in) for input */ |
| 13282 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13283 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13284 | * the vref |
| 13285 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13286 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13287 | |
| 13288 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13289 | #if 0 |
| 13290 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13291 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13292 | #endif |
| 13293 | { } /* end */ |
| 13294 | }; |
| 13295 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13296 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13297 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13298 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13299 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13300 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13301 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13302 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13303 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13304 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13305 | |
| 13306 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13307 | #if 0 |
| 13308 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13309 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13310 | #endif |
| 13311 | { } /* end */ |
| 13312 | }; |
| 13313 | |
| 13314 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13315 | { 2, alc861_asus_ch2_init }, |
| 13316 | { 6, alc861_asus_ch6_init }, |
| 13317 | }; |
| 13318 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13319 | /* patch-ALC861 */ |
| 13320 | |
| 13321 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13322 | /* output mixer control */ |
| 13323 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13324 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13325 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13326 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13327 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13328 | |
| 13329 | /*Input mixer control */ |
| 13330 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13331 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13332 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13333 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13334 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13335 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13336 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13337 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13338 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13339 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13340 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13341 | { } /* end */ |
| 13342 | }; |
| 13343 | |
| 13344 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13345 | /* output mixer control */ |
| 13346 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13347 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13348 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13349 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13350 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13351 | |
| 13352 | /* Input mixer control */ |
| 13353 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13354 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13355 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13356 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13357 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13358 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13359 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13360 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13361 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13362 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13363 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13364 | { |
| 13365 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13366 | .name = "Channel Mode", |
| 13367 | .info = alc_ch_mode_info, |
| 13368 | .get = alc_ch_mode_get, |
| 13369 | .put = alc_ch_mode_put, |
| 13370 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13371 | }, |
| 13372 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13373 | }; |
| 13374 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13375 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13376 | /* output mixer control */ |
| 13377 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13379 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13380 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13381 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13382 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13383 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13384 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13385 | /* output mixer control */ |
| 13386 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13387 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13388 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13389 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13390 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13391 | |
| 13392 | /* Input mixer control */ |
| 13393 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13394 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13395 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13396 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13397 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13398 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13399 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13400 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13401 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13402 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13403 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13404 | { |
| 13405 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13406 | .name = "Channel Mode", |
| 13407 | .info = alc_ch_mode_info, |
| 13408 | .get = alc_ch_mode_get, |
| 13409 | .put = alc_ch_mode_put, |
| 13410 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13411 | }, |
| 13412 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13413 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13414 | |
| 13415 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13416 | /* output mixer control */ |
| 13417 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13418 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13419 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13420 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13421 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13422 | |
| 13423 | /* Input mixer control */ |
| 13424 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13425 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13426 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13427 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13428 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13429 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13431 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13432 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13433 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13434 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13435 | { |
| 13436 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13437 | .name = "Channel Mode", |
| 13438 | .info = alc_ch_mode_info, |
| 13439 | .get = alc_ch_mode_get, |
| 13440 | .put = alc_ch_mode_put, |
| 13441 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13442 | }, |
| 13443 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13444 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13445 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13446 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13447 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13448 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13449 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13450 | { } |
| 13451 | }; |
| 13452 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13453 | /* |
| 13454 | * generic initialization of ADC, input mixers and output mixers |
| 13455 | */ |
| 13456 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13457 | /* |
| 13458 | * Unmute ADC0 and set the default input to mic-in |
| 13459 | */ |
| 13460 | /* port-A for surround (rear panel) */ |
| 13461 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13462 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13463 | /* port-B for mic-in (rear panel) with vref */ |
| 13464 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13465 | /* port-C for line-in (rear panel) */ |
| 13466 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13467 | /* port-D for Front */ |
| 13468 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13469 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13470 | /* port-E for HP out (front panel) */ |
| 13471 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13472 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13473 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13474 | /* port-F for mic-in (front panel) with vref */ |
| 13475 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13476 | /* port-G for CLFE (rear panel) */ |
| 13477 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13478 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13479 | /* port-H for side (rear panel) */ |
| 13480 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13481 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13482 | /* CD-in */ |
| 13483 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13484 | /* route front mic to ADC1*/ |
| 13485 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13486 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13487 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13488 | /* Unmute DAC0~3 & spdif out*/ |
| 13489 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13490 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13491 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13492 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13493 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13494 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13495 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13496 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13497 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13498 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13499 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13500 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13501 | /* Unmute Stereo Mixer 15 */ |
| 13502 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13503 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13504 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13505 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13506 | |
| 13507 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13508 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13509 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13510 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13511 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13512 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13513 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13514 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13515 | /* hp used DAC 3 (Front) */ |
| 13516 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13517 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13518 | |
| 13519 | { } |
| 13520 | }; |
| 13521 | |
| 13522 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13523 | /* |
| 13524 | * Unmute ADC0 and set the default input to mic-in |
| 13525 | */ |
| 13526 | /* port-A for surround (rear panel) */ |
| 13527 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13528 | /* port-B for mic-in (rear panel) with vref */ |
| 13529 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13530 | /* port-C for line-in (rear panel) */ |
| 13531 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13532 | /* port-D for Front */ |
| 13533 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13534 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13535 | /* port-E for HP out (front panel) */ |
| 13536 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13537 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13538 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13539 | /* port-F for mic-in (front panel) with vref */ |
| 13540 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13541 | /* port-G for CLFE (rear panel) */ |
| 13542 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13543 | /* port-H for side (rear panel) */ |
| 13544 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13545 | /* CD-in */ |
| 13546 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13547 | /* route front mic to ADC1*/ |
| 13548 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13549 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13550 | /* Unmute DAC0~3 & spdif out*/ |
| 13551 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13552 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13553 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13554 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13555 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13556 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13557 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13558 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13559 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13560 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13561 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13562 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13563 | /* Unmute Stereo Mixer 15 */ |
| 13564 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13565 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13566 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13567 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13568 | |
| 13569 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13570 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13571 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13572 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13573 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13574 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13575 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13576 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13577 | /* hp used DAC 3 (Front) */ |
| 13578 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13579 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13580 | { } |
| 13581 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13582 | |
| 13583 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13584 | /* |
| 13585 | * Unmute ADC0 and set the default input to mic-in |
| 13586 | */ |
| 13587 | /* port-A for surround (rear panel) */ |
| 13588 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13589 | /* port-B for mic-in (rear panel) with vref */ |
| 13590 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13591 | /* port-C for line-in (rear panel) */ |
| 13592 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13593 | /* port-D for Front */ |
| 13594 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13595 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13596 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13597 | /* this has to be set to VREF80 */ |
| 13598 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13599 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13600 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13601 | /* port-F for mic-in (front panel) with vref */ |
| 13602 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13603 | /* port-G for CLFE (rear panel) */ |
| 13604 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13605 | /* port-H for side (rear panel) */ |
| 13606 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13607 | /* CD-in */ |
| 13608 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13609 | /* route front mic to ADC1*/ |
| 13610 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13611 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13612 | /* Unmute DAC0~3 & spdif out*/ |
| 13613 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13614 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13615 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13616 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13617 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13618 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13619 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13620 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13621 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13622 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13623 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13624 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13625 | /* Unmute Stereo Mixer 15 */ |
| 13626 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13627 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13628 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13629 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13630 | |
| 13631 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13632 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13633 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13634 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13635 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13636 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13637 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13638 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13639 | /* hp used DAC 3 (Front) */ |
| 13640 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13641 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13642 | { } |
| 13643 | }; |
| 13644 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13645 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13646 | /* |
| 13647 | * Unmute ADC0 and set the default input to mic-in |
| 13648 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13649 | /* port-A for surround (rear panel) |
| 13650 | * according to codec#0 this is the HP jack |
| 13651 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13652 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13653 | /* route front PCM to HP */ |
| 13654 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13655 | /* port-B for mic-in (rear panel) with vref */ |
| 13656 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13657 | /* port-C for line-in (rear panel) */ |
| 13658 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13659 | /* port-D for Front */ |
| 13660 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13661 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13662 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13663 | /* this has to be set to VREF80 */ |
| 13664 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13665 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13666 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13667 | /* port-F for mic-in (front panel) with vref */ |
| 13668 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13669 | /* port-G for CLFE (rear panel) */ |
| 13670 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13671 | /* port-H for side (rear panel) */ |
| 13672 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13673 | /* CD-in */ |
| 13674 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13675 | /* route front mic to ADC1*/ |
| 13676 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13677 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13678 | /* Unmute DAC0~3 & spdif out*/ |
| 13679 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13680 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13681 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13682 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13683 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13684 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13685 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13686 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13687 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13688 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13689 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13690 | /* Unmute Stereo Mixer 15 */ |
| 13691 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13692 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13693 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13694 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13695 | |
| 13696 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13697 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13698 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13699 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13700 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13701 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13702 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13703 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13704 | /* hp used DAC 3 (Front) */ |
| 13705 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13706 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13707 | { } |
| 13708 | }; |
| 13709 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13710 | /* additional init verbs for ASUS laptops */ |
| 13711 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13712 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13713 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13714 | { } |
| 13715 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13716 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13717 | /* |
| 13718 | * generic initialization of ADC, input mixers and output mixers |
| 13719 | */ |
| 13720 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13721 | /* |
| 13722 | * Unmute ADC0 and set the default input to mic-in |
| 13723 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13724 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13725 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13726 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13727 | /* Unmute DAC0~3 & spdif out*/ |
| 13728 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13729 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13730 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13731 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13732 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13733 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13734 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13735 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13736 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13737 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13738 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13739 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13740 | /* Unmute Stereo Mixer 15 */ |
| 13741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13742 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13743 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13744 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13745 | |
| 13746 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13747 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13748 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13749 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13750 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13751 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13752 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13753 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13754 | |
| 13755 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13756 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13757 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13758 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13759 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13760 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13761 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13762 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13763 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13764 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13765 | |
| 13766 | { } |
| 13767 | }; |
| 13768 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13769 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13770 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13771 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13772 | { } |
| 13773 | }; |
| 13774 | |
| 13775 | /* toggle speaker-output according to the hp-jack state */ |
| 13776 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13777 | { |
| 13778 | unsigned int present; |
| 13779 | |
| 13780 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13781 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13782 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13783 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13784 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13785 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13786 | } |
| 13787 | |
| 13788 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13789 | unsigned int res) |
| 13790 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13791 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13792 | alc861_toshiba_automute(codec); |
| 13793 | } |
| 13794 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13795 | /* pcm configuration: identiacal with ALC880 */ |
| 13796 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13797 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13798 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13799 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13800 | |
| 13801 | |
| 13802 | #define ALC861_DIGOUT_NID 0x07 |
| 13803 | |
| 13804 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13805 | { 8, NULL } |
| 13806 | }; |
| 13807 | |
| 13808 | static hda_nid_t alc861_dac_nids[4] = { |
| 13809 | /* front, surround, clfe, side */ |
| 13810 | 0x03, 0x06, 0x05, 0x04 |
| 13811 | }; |
| 13812 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13813 | static hda_nid_t alc660_dac_nids[3] = { |
| 13814 | /* front, clfe, surround */ |
| 13815 | 0x03, 0x05, 0x06 |
| 13816 | }; |
| 13817 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13818 | static hda_nid_t alc861_adc_nids[1] = { |
| 13819 | /* ADC0-2 */ |
| 13820 | 0x08, |
| 13821 | }; |
| 13822 | |
| 13823 | static struct hda_input_mux alc861_capture_source = { |
| 13824 | .num_items = 5, |
| 13825 | .items = { |
| 13826 | { "Mic", 0x0 }, |
| 13827 | { "Front Mic", 0x3 }, |
| 13828 | { "Line", 0x1 }, |
| 13829 | { "CD", 0x4 }, |
| 13830 | { "Mixer", 0x5 }, |
| 13831 | }, |
| 13832 | }; |
| 13833 | |
| 13834 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13835 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13836 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13837 | { |
| 13838 | int i; |
| 13839 | hda_nid_t nid; |
| 13840 | |
| 13841 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13842 | for (i = 0; i < cfg->line_outs; i++) { |
| 13843 | nid = cfg->line_out_pins[i]; |
| 13844 | if (nid) { |
| 13845 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13846 | continue; |
| 13847 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13848 | } |
| 13849 | } |
| 13850 | spec->multiout.num_dacs = cfg->line_outs; |
| 13851 | return 0; |
| 13852 | } |
| 13853 | |
| 13854 | /* add playback controls from the parsed DAC table */ |
| 13855 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13856 | const struct auto_pin_cfg *cfg) |
| 13857 | { |
| 13858 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13859 | static const char *chname[4] = { |
| 13860 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13861 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13862 | hda_nid_t nid; |
| 13863 | int i, idx, err; |
| 13864 | |
| 13865 | for (i = 0; i < cfg->line_outs; i++) { |
| 13866 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13867 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13868 | continue; |
| 13869 | if (nid == 0x05) { |
| 13870 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13871 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13872 | "Center Playback Switch", |
| 13873 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13874 | HDA_OUTPUT)); |
| 13875 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13876 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13877 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13878 | "LFE Playback Switch", |
| 13879 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13880 | HDA_OUTPUT)); |
| 13881 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13882 | return err; |
| 13883 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13884 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13885 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13886 | if (nid == alc861_dac_nids[idx]) |
| 13887 | break; |
| 13888 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13889 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13890 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13891 | HDA_OUTPUT)); |
| 13892 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13893 | return err; |
| 13894 | } |
| 13895 | } |
| 13896 | return 0; |
| 13897 | } |
| 13898 | |
| 13899 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13900 | { |
| 13901 | int err; |
| 13902 | hda_nid_t nid; |
| 13903 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13904 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13905 | return 0; |
| 13906 | |
| 13907 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13908 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13909 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13910 | "Headphone Playback Switch", |
| 13911 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13912 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13913 | return err; |
| 13914 | spec->multiout.hp_nid = nid; |
| 13915 | } |
| 13916 | return 0; |
| 13917 | } |
| 13918 | |
| 13919 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13920 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13921 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13922 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13923 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13924 | int i, err, idx, idx1; |
| 13925 | |
| 13926 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13927 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13928 | case 0x0c: |
| 13929 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13930 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13931 | break; |
| 13932 | case 0x0f: |
| 13933 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13934 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13935 | break; |
| 13936 | case 0x0d: |
| 13937 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13938 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13939 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13940 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13941 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13942 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13943 | break; |
| 13944 | case 0x11: |
| 13945 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13946 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13947 | break; |
| 13948 | default: |
| 13949 | continue; |
| 13950 | } |
| 13951 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13952 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13953 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13954 | if (err < 0) |
| 13955 | return err; |
| 13956 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13957 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13958 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13959 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13960 | } |
| 13961 | return 0; |
| 13962 | } |
| 13963 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13964 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13965 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13966 | int pin_type, int dac_idx) |
| 13967 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13968 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13969 | pin_type); |
| 13970 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13971 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13972 | } |
| 13973 | |
| 13974 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13975 | { |
| 13976 | struct alc_spec *spec = codec->spec; |
| 13977 | int i; |
| 13978 | |
| 13979 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13980 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13981 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13982 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13983 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13984 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13985 | } |
| 13986 | } |
| 13987 | |
| 13988 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13989 | { |
| 13990 | struct alc_spec *spec = codec->spec; |
| 13991 | hda_nid_t pin; |
| 13992 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13993 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13994 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13995 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13996 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13997 | pin = spec->autocfg.speaker_pins[0]; |
| 13998 | if (pin) |
| 13999 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14000 | } |
| 14001 | |
| 14002 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14003 | { |
| 14004 | struct alc_spec *spec = codec->spec; |
| 14005 | int i; |
| 14006 | |
| 14007 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14008 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14009 | if (nid >= 0x0c && nid <= 0x11) |
| 14010 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14011 | } |
| 14012 | } |
| 14013 | |
| 14014 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14015 | /* return 1 if successful, 0 if the proper config is not found, |
| 14016 | * or a negative error code |
| 14017 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14018 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14019 | { |
| 14020 | struct alc_spec *spec = codec->spec; |
| 14021 | int err; |
| 14022 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14023 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14024 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14025 | alc861_ignore); |
| 14026 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14027 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14028 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14029 | return 0; /* can't find valid BIOS pin config */ |
| 14030 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14031 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14032 | if (err < 0) |
| 14033 | return err; |
| 14034 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14035 | if (err < 0) |
| 14036 | return err; |
| 14037 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 14038 | if (err < 0) |
| 14039 | return err; |
| 14040 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14041 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14042 | return err; |
| 14043 | |
| 14044 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14045 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14046 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14047 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14048 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14049 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14050 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14051 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14052 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14053 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14054 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14055 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14056 | |
| 14057 | spec->adc_nids = alc861_adc_nids; |
| 14058 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14059 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14060 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14061 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14062 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14063 | return 1; |
| 14064 | } |
| 14065 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14066 | /* additional initialization for auto-configuration model */ |
| 14067 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14068 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14069 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14070 | alc861_auto_init_multi_out(codec); |
| 14071 | alc861_auto_init_hp_out(codec); |
| 14072 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14073 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14074 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14075 | } |
| 14076 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14077 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14078 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14079 | { 0x15, HDA_INPUT, 0 }, |
| 14080 | { 0x15, HDA_INPUT, 1 }, |
| 14081 | { 0x15, HDA_INPUT, 2 }, |
| 14082 | { 0x15, HDA_INPUT, 3 }, |
| 14083 | { } /* end */ |
| 14084 | }; |
| 14085 | #endif |
| 14086 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14087 | |
| 14088 | /* |
| 14089 | * configuration and preset |
| 14090 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14091 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14092 | [ALC861_3ST] = "3stack", |
| 14093 | [ALC660_3ST] = "3stack-660", |
| 14094 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14095 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14096 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14097 | [ALC861_TOSHIBA] = "toshiba", |
| 14098 | [ALC861_ASUS] = "asus", |
| 14099 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14100 | [ALC861_AUTO] = "auto", |
| 14101 | }; |
| 14102 | |
| 14103 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14104 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14105 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14106 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14107 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14108 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14109 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14110 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14111 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14112 | * Any other models that need this preset? |
| 14113 | */ |
| 14114 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14115 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14116 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14117 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14118 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14119 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14120 | /* FIXME: the below seems conflict */ |
| 14121 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14122 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14123 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14124 | {} |
| 14125 | }; |
| 14126 | |
| 14127 | static struct alc_config_preset alc861_presets[] = { |
| 14128 | [ALC861_3ST] = { |
| 14129 | .mixers = { alc861_3ST_mixer }, |
| 14130 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14131 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14132 | .dac_nids = alc861_dac_nids, |
| 14133 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14134 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14135 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14136 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14137 | .adc_nids = alc861_adc_nids, |
| 14138 | .input_mux = &alc861_capture_source, |
| 14139 | }, |
| 14140 | [ALC861_3ST_DIG] = { |
| 14141 | .mixers = { alc861_base_mixer }, |
| 14142 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14143 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14144 | .dac_nids = alc861_dac_nids, |
| 14145 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14146 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14147 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14148 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14149 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14150 | .adc_nids = alc861_adc_nids, |
| 14151 | .input_mux = &alc861_capture_source, |
| 14152 | }, |
| 14153 | [ALC861_6ST_DIG] = { |
| 14154 | .mixers = { alc861_base_mixer }, |
| 14155 | .init_verbs = { alc861_base_init_verbs }, |
| 14156 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14157 | .dac_nids = alc861_dac_nids, |
| 14158 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14159 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14160 | .channel_mode = alc861_8ch_modes, |
| 14161 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14162 | .adc_nids = alc861_adc_nids, |
| 14163 | .input_mux = &alc861_capture_source, |
| 14164 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14165 | [ALC660_3ST] = { |
| 14166 | .mixers = { alc861_3ST_mixer }, |
| 14167 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14168 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14169 | .dac_nids = alc660_dac_nids, |
| 14170 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14171 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14172 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14173 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14174 | .adc_nids = alc861_adc_nids, |
| 14175 | .input_mux = &alc861_capture_source, |
| 14176 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14177 | [ALC861_UNIWILL_M31] = { |
| 14178 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14179 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14180 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14181 | .dac_nids = alc861_dac_nids, |
| 14182 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14183 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14184 | .channel_mode = alc861_uniwill_m31_modes, |
| 14185 | .need_dac_fix = 1, |
| 14186 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14187 | .adc_nids = alc861_adc_nids, |
| 14188 | .input_mux = &alc861_capture_source, |
| 14189 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14190 | [ALC861_TOSHIBA] = { |
| 14191 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14192 | .init_verbs = { alc861_base_init_verbs, |
| 14193 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14194 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14195 | .dac_nids = alc861_dac_nids, |
| 14196 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14197 | .channel_mode = alc883_3ST_2ch_modes, |
| 14198 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14199 | .adc_nids = alc861_adc_nids, |
| 14200 | .input_mux = &alc861_capture_source, |
| 14201 | .unsol_event = alc861_toshiba_unsol_event, |
| 14202 | .init_hook = alc861_toshiba_automute, |
| 14203 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14204 | [ALC861_ASUS] = { |
| 14205 | .mixers = { alc861_asus_mixer }, |
| 14206 | .init_verbs = { alc861_asus_init_verbs }, |
| 14207 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14208 | .dac_nids = alc861_dac_nids, |
| 14209 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14210 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14211 | .channel_mode = alc861_asus_modes, |
| 14212 | .need_dac_fix = 1, |
| 14213 | .hp_nid = 0x06, |
| 14214 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14215 | .adc_nids = alc861_adc_nids, |
| 14216 | .input_mux = &alc861_capture_source, |
| 14217 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14218 | [ALC861_ASUS_LAPTOP] = { |
| 14219 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14220 | .init_verbs = { alc861_asus_init_verbs, |
| 14221 | alc861_asus_laptop_init_verbs }, |
| 14222 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14223 | .dac_nids = alc861_dac_nids, |
| 14224 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14225 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14226 | .channel_mode = alc883_3ST_2ch_modes, |
| 14227 | .need_dac_fix = 1, |
| 14228 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14229 | .adc_nids = alc861_adc_nids, |
| 14230 | .input_mux = &alc861_capture_source, |
| 14231 | }, |
| 14232 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14233 | |
| 14234 | |
| 14235 | static int patch_alc861(struct hda_codec *codec) |
| 14236 | { |
| 14237 | struct alc_spec *spec; |
| 14238 | int board_config; |
| 14239 | int err; |
| 14240 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14241 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14242 | if (spec == NULL) |
| 14243 | return -ENOMEM; |
| 14244 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14245 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14246 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14247 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14248 | alc861_models, |
| 14249 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14250 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14251 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14252 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 14253 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14254 | board_config = ALC861_AUTO; |
| 14255 | } |
| 14256 | |
| 14257 | if (board_config == ALC861_AUTO) { |
| 14258 | /* automatic parse from the BIOS config */ |
| 14259 | err = alc861_parse_auto_config(codec); |
| 14260 | if (err < 0) { |
| 14261 | alc_free(codec); |
| 14262 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14263 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14264 | printk(KERN_INFO |
| 14265 | "hda_codec: Cannot set up configuration " |
| 14266 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14267 | board_config = ALC861_3ST_DIG; |
| 14268 | } |
| 14269 | } |
| 14270 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14271 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14272 | if (err < 0) { |
| 14273 | alc_free(codec); |
| 14274 | return err; |
| 14275 | } |
| 14276 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14277 | if (board_config != ALC861_AUTO) |
| 14278 | setup_preset(spec, &alc861_presets[board_config]); |
| 14279 | |
| 14280 | spec->stream_name_analog = "ALC861 Analog"; |
| 14281 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14282 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14283 | |
| 14284 | spec->stream_name_digital = "ALC861 Digital"; |
| 14285 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14286 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14287 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14288 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14289 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14290 | spec->vmaster_nid = 0x03; |
| 14291 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14292 | codec->patch_ops = alc_patch_ops; |
| 14293 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14294 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14295 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14296 | if (!spec->loopback.amplist) |
| 14297 | spec->loopback.amplist = alc861_loopbacks; |
| 14298 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14299 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14300 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14301 | return 0; |
| 14302 | } |
| 14303 | |
| 14304 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14305 | * ALC861-VD support |
| 14306 | * |
| 14307 | * Based on ALC882 |
| 14308 | * |
| 14309 | * In addition, an independent DAC |
| 14310 | */ |
| 14311 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14312 | |
| 14313 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14314 | /* front, surr, clfe, side surr */ |
| 14315 | 0x02, 0x03, 0x04, 0x05 |
| 14316 | }; |
| 14317 | |
| 14318 | /* dac_nids for ALC660vd are in a different order - according to |
| 14319 | * Realtek's driver. |
| 14320 | * This should probably tesult in a different mixer for 6stack models |
| 14321 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14322 | * - and it is the same as in 861vd. |
| 14323 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14324 | */ |
| 14325 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14326 | /* front, rear, clfe, rear_surr */ |
| 14327 | 0x02, 0x04, 0x03 |
| 14328 | }; |
| 14329 | |
| 14330 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14331 | /* ADC0 */ |
| 14332 | 0x09, |
| 14333 | }; |
| 14334 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14335 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14336 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14337 | /* input MUX */ |
| 14338 | /* FIXME: should be a matrix-type input source selection */ |
| 14339 | static struct hda_input_mux alc861vd_capture_source = { |
| 14340 | .num_items = 4, |
| 14341 | .items = { |
| 14342 | { "Mic", 0x0 }, |
| 14343 | { "Front Mic", 0x1 }, |
| 14344 | { "Line", 0x2 }, |
| 14345 | { "CD", 0x4 }, |
| 14346 | }, |
| 14347 | }; |
| 14348 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14349 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14350 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14351 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14352 | { "Ext Mic", 0x0 }, |
| 14353 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14354 | }, |
| 14355 | }; |
| 14356 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14357 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14358 | .num_items = 2, |
| 14359 | .items = { |
| 14360 | { "Front Mic", 0x0 }, |
| 14361 | { "ATAPI Mic", 0x1 }, |
| 14362 | }, |
| 14363 | }; |
| 14364 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14365 | /* |
| 14366 | * 2ch mode |
| 14367 | */ |
| 14368 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14369 | { 2, NULL } |
| 14370 | }; |
| 14371 | |
| 14372 | /* |
| 14373 | * 6ch mode |
| 14374 | */ |
| 14375 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14376 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14377 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14378 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14379 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14380 | { } /* end */ |
| 14381 | }; |
| 14382 | |
| 14383 | /* |
| 14384 | * 8ch mode |
| 14385 | */ |
| 14386 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14387 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14388 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14389 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14390 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14391 | { } /* end */ |
| 14392 | }; |
| 14393 | |
| 14394 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14395 | { 6, alc861vd_6stack_ch6_init }, |
| 14396 | { 8, alc861vd_6stack_ch8_init }, |
| 14397 | }; |
| 14398 | |
| 14399 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14400 | { |
| 14401 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14402 | .name = "Channel Mode", |
| 14403 | .info = alc_ch_mode_info, |
| 14404 | .get = alc_ch_mode_get, |
| 14405 | .put = alc_ch_mode_put, |
| 14406 | }, |
| 14407 | { } /* end */ |
| 14408 | }; |
| 14409 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14410 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14411 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14412 | */ |
| 14413 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14414 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14415 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14416 | |
| 14417 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14418 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14419 | |
| 14420 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14421 | HDA_OUTPUT), |
| 14422 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14423 | HDA_OUTPUT), |
| 14424 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14425 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14426 | |
| 14427 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14428 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14429 | |
| 14430 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14431 | |
| 14432 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14433 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14434 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14435 | |
| 14436 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14437 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14438 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14439 | |
| 14440 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14441 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14442 | |
| 14443 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14444 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14445 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14446 | { } /* end */ |
| 14447 | }; |
| 14448 | |
| 14449 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14450 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14451 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14452 | |
| 14453 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14454 | |
| 14455 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14456 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14457 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14458 | |
| 14459 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14460 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14461 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14462 | |
| 14463 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14464 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14465 | |
| 14466 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14467 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14468 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14469 | { } /* end */ |
| 14470 | }; |
| 14471 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14472 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14473 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14474 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14475 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14476 | |
| 14477 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14478 | |
| 14479 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14480 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14481 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14482 | |
| 14483 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14484 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14485 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14486 | |
| 14487 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14488 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14489 | |
| 14490 | { } /* end */ |
| 14491 | }; |
| 14492 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14493 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14494 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14495 | */ |
| 14496 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14497 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14498 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14499 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14500 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14501 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14502 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14503 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14504 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14505 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14506 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14507 | { } /* end */ |
| 14508 | }; |
| 14509 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14510 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14511 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14512 | */ |
| 14513 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14514 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14515 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14516 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14517 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14518 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14519 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14520 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14521 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14522 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14523 | { } /* end */ |
| 14524 | }; |
| 14525 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14526 | /* |
| 14527 | * generic initialization of ADC, input mixers and output mixers |
| 14528 | */ |
| 14529 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14530 | /* |
| 14531 | * Unmute ADC0 and set the default input to mic-in |
| 14532 | */ |
| 14533 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14534 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14535 | |
| 14536 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14537 | * the analog-loopback mixer widget |
| 14538 | */ |
| 14539 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14540 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14541 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14542 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14543 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14544 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14545 | |
| 14546 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14547 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14548 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14549 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14550 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14551 | |
| 14552 | /* |
| 14553 | * Set up output mixers (0x02 - 0x05) |
| 14554 | */ |
| 14555 | /* set vol=0 to output mixers */ |
| 14556 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14557 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14558 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14559 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14560 | |
| 14561 | /* set up input amps for analog loopback */ |
| 14562 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14563 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14564 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14565 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14566 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14567 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14568 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14569 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14570 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14571 | |
| 14572 | { } |
| 14573 | }; |
| 14574 | |
| 14575 | /* |
| 14576 | * 3-stack pin configuration: |
| 14577 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14578 | */ |
| 14579 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14580 | /* |
| 14581 | * Set pin mode and muting |
| 14582 | */ |
| 14583 | /* set front pin widgets 0x14 for output */ |
| 14584 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14585 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14586 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14587 | |
| 14588 | /* Mic (rear) pin: input vref at 80% */ |
| 14589 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14590 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14591 | /* Front Mic pin: input vref at 80% */ |
| 14592 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14593 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14594 | /* Line In pin: input */ |
| 14595 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14596 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14597 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14598 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14599 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14600 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14601 | /* CD pin widget for input */ |
| 14602 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14603 | |
| 14604 | { } |
| 14605 | }; |
| 14606 | |
| 14607 | /* |
| 14608 | * 6-stack pin configuration: |
| 14609 | */ |
| 14610 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14611 | /* |
| 14612 | * Set pin mode and muting |
| 14613 | */ |
| 14614 | /* set front pin widgets 0x14 for output */ |
| 14615 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14616 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14617 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14618 | |
| 14619 | /* Rear Pin: output 1 (0x0d) */ |
| 14620 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14621 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14622 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14623 | /* CLFE Pin: output 2 (0x0e) */ |
| 14624 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14625 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14626 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14627 | /* Side Pin: output 3 (0x0f) */ |
| 14628 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14629 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14630 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14631 | |
| 14632 | /* Mic (rear) pin: input vref at 80% */ |
| 14633 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14634 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14635 | /* Front Mic pin: input vref at 80% */ |
| 14636 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14637 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14638 | /* Line In pin: input */ |
| 14639 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14640 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14641 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14642 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14643 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14644 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14645 | /* CD pin widget for input */ |
| 14646 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14647 | |
| 14648 | { } |
| 14649 | }; |
| 14650 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14651 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14652 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14653 | { } |
| 14654 | }; |
| 14655 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14656 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14657 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14658 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14659 | { } |
| 14660 | }; |
| 14661 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14662 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14663 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14664 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14665 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14666 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14667 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14668 | {} |
| 14669 | }; |
| 14670 | |
| 14671 | /* toggle speaker-output according to the hp-jack state */ |
| 14672 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 14673 | { |
| 14674 | unsigned int present; |
| 14675 | unsigned char bits; |
| 14676 | |
| 14677 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14678 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14679 | bits = present ? HDA_AMP_MUTE : 0; |
| 14680 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14681 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14682 | } |
| 14683 | |
| 14684 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14685 | { |
| 14686 | unsigned int present; |
| 14687 | unsigned char bits; |
| 14688 | |
| 14689 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14690 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14691 | bits = present ? HDA_AMP_MUTE : 0; |
| 14692 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14693 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14694 | } |
| 14695 | |
| 14696 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 14697 | { |
| 14698 | alc861vd_lenovo_hp_automute(codec); |
| 14699 | alc861vd_lenovo_mic_automute(codec); |
| 14700 | } |
| 14701 | |
| 14702 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14703 | unsigned int res) |
| 14704 | { |
| 14705 | switch (res >> 26) { |
| 14706 | case ALC880_HP_EVENT: |
| 14707 | alc861vd_lenovo_hp_automute(codec); |
| 14708 | break; |
| 14709 | case ALC880_MIC_EVENT: |
| 14710 | alc861vd_lenovo_mic_automute(codec); |
| 14711 | break; |
| 14712 | } |
| 14713 | } |
| 14714 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14715 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14716 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14717 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14718 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14719 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14720 | |
| 14721 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14722 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14723 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14724 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14725 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14726 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14727 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14728 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14729 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14730 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14731 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14732 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14733 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14734 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14735 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14736 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14737 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14738 | |
| 14739 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14740 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14741 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14742 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14743 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14744 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14745 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14746 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14747 | |
| 14748 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14749 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14750 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14751 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14752 | |
| 14753 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14754 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14755 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14756 | |
| 14757 | { } /* end */ |
| 14758 | }; |
| 14759 | |
| 14760 | /* toggle speaker-output according to the hp-jack state */ |
| 14761 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 14762 | { |
| 14763 | unsigned int present; |
| 14764 | |
| 14765 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14766 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14767 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14768 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14769 | } |
| 14770 | |
| 14771 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 14772 | { |
| 14773 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14774 | alc861vd_dallas_automute(codec); |
| 14775 | } |
| 14776 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14777 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14778 | #define alc861vd_loopbacks alc880_loopbacks |
| 14779 | #endif |
| 14780 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14781 | /* pcm configuration: identiacal with ALC880 */ |
| 14782 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14783 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14784 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14785 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14786 | |
| 14787 | /* |
| 14788 | * configuration and preset |
| 14789 | */ |
| 14790 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14791 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14792 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14793 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14794 | [ALC861VD_3ST] = "3stack", |
| 14795 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14796 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14797 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14798 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14799 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14800 | [ALC861VD_AUTO] = "auto", |
| 14801 | }; |
| 14802 | |
| 14803 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14804 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14805 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14806 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14807 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14808 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14809 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14810 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14811 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14812 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14813 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14814 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14815 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14816 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 14817 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14818 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14819 | {} |
| 14820 | }; |
| 14821 | |
| 14822 | static struct alc_config_preset alc861vd_presets[] = { |
| 14823 | [ALC660VD_3ST] = { |
| 14824 | .mixers = { alc861vd_3st_mixer }, |
| 14825 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14826 | alc861vd_3stack_init_verbs }, |
| 14827 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14828 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14829 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14830 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14831 | .input_mux = &alc861vd_capture_source, |
| 14832 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14833 | [ALC660VD_3ST_DIG] = { |
| 14834 | .mixers = { alc861vd_3st_mixer }, |
| 14835 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14836 | alc861vd_3stack_init_verbs }, |
| 14837 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14838 | .dac_nids = alc660vd_dac_nids, |
| 14839 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14840 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14841 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14842 | .input_mux = &alc861vd_capture_source, |
| 14843 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14844 | [ALC861VD_3ST] = { |
| 14845 | .mixers = { alc861vd_3st_mixer }, |
| 14846 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14847 | alc861vd_3stack_init_verbs }, |
| 14848 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14849 | .dac_nids = alc861vd_dac_nids, |
| 14850 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14851 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14852 | .input_mux = &alc861vd_capture_source, |
| 14853 | }, |
| 14854 | [ALC861VD_3ST_DIG] = { |
| 14855 | .mixers = { alc861vd_3st_mixer }, |
| 14856 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14857 | alc861vd_3stack_init_verbs }, |
| 14858 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14859 | .dac_nids = alc861vd_dac_nids, |
| 14860 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14861 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14862 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14863 | .input_mux = &alc861vd_capture_source, |
| 14864 | }, |
| 14865 | [ALC861VD_6ST_DIG] = { |
| 14866 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14867 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14868 | alc861vd_6stack_init_verbs }, |
| 14869 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14870 | .dac_nids = alc861vd_dac_nids, |
| 14871 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14872 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14873 | .channel_mode = alc861vd_6stack_modes, |
| 14874 | .input_mux = &alc861vd_capture_source, |
| 14875 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14876 | [ALC861VD_LENOVO] = { |
| 14877 | .mixers = { alc861vd_lenovo_mixer }, |
| 14878 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14879 | alc861vd_3stack_init_verbs, |
| 14880 | alc861vd_eapd_verbs, |
| 14881 | alc861vd_lenovo_unsol_verbs }, |
| 14882 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14883 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14884 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14885 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14886 | .input_mux = &alc861vd_capture_source, |
| 14887 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14888 | .init_hook = alc861vd_lenovo_automute, |
| 14889 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14890 | [ALC861VD_DALLAS] = { |
| 14891 | .mixers = { alc861vd_dallas_mixer }, |
| 14892 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14893 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14894 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14895 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14896 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14897 | .input_mux = &alc861vd_dallas_capture_source, |
| 14898 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14899 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14900 | }, |
| 14901 | [ALC861VD_HP] = { |
| 14902 | .mixers = { alc861vd_hp_mixer }, |
| 14903 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14904 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14905 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14906 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14907 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14908 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14909 | .input_mux = &alc861vd_hp_capture_source, |
| 14910 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14911 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14912 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14913 | [ALC660VD_ASUS_V1S] = { |
| 14914 | .mixers = { alc861vd_lenovo_mixer }, |
| 14915 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14916 | alc861vd_3stack_init_verbs, |
| 14917 | alc861vd_eapd_verbs, |
| 14918 | alc861vd_lenovo_unsol_verbs }, |
| 14919 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14920 | .dac_nids = alc660vd_dac_nids, |
| 14921 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14922 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14923 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14924 | .input_mux = &alc861vd_capture_source, |
| 14925 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14926 | .init_hook = alc861vd_lenovo_automute, |
| 14927 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14928 | }; |
| 14929 | |
| 14930 | /* |
| 14931 | * BIOS auto configuration |
| 14932 | */ |
| 14933 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14934 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14935 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14936 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14937 | } |
| 14938 | |
| 14939 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14940 | { |
| 14941 | struct alc_spec *spec = codec->spec; |
| 14942 | int i; |
| 14943 | |
| 14944 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14945 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14946 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14947 | if (nid) |
| 14948 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14949 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14950 | } |
| 14951 | } |
| 14952 | |
| 14953 | |
| 14954 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14955 | { |
| 14956 | struct alc_spec *spec = codec->spec; |
| 14957 | hda_nid_t pin; |
| 14958 | |
| 14959 | pin = spec->autocfg.hp_pins[0]; |
| 14960 | if (pin) /* connect to front and use dac 0 */ |
| 14961 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14962 | pin = spec->autocfg.speaker_pins[0]; |
| 14963 | if (pin) |
| 14964 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14965 | } |
| 14966 | |
| 14967 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14968 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14969 | |
| 14970 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14971 | { |
| 14972 | struct alc_spec *spec = codec->spec; |
| 14973 | int i; |
| 14974 | |
| 14975 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14976 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14977 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14978 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 14979 | if (nid != ALC861VD_PIN_CD_NID && |
| 14980 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14981 | snd_hda_codec_write(codec, nid, 0, |
| 14982 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14983 | AMP_OUT_MUTE); |
| 14984 | } |
| 14985 | } |
| 14986 | } |
| 14987 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14988 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14989 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14990 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14991 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14992 | |
| 14993 | /* add playback controls from the parsed DAC table */ |
| 14994 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14995 | * different NIDs for mute/unmute switch and volume control */ |
| 14996 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14997 | const struct auto_pin_cfg *cfg) |
| 14998 | { |
| 14999 | char name[32]; |
| 15000 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15001 | hda_nid_t nid_v, nid_s; |
| 15002 | int i, err; |
| 15003 | |
| 15004 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15005 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15006 | continue; |
| 15007 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15008 | alc880_dac_to_idx( |
| 15009 | spec->multiout.dac_nids[i])); |
| 15010 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15011 | alc880_dac_to_idx( |
| 15012 | spec->multiout.dac_nids[i])); |
| 15013 | |
| 15014 | if (i == 2) { |
| 15015 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15016 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15017 | "Center Playback Volume", |
| 15018 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15019 | HDA_OUTPUT)); |
| 15020 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15021 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15022 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15023 | "LFE Playback Volume", |
| 15024 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15025 | HDA_OUTPUT)); |
| 15026 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15027 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15028 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15029 | "Center Playback Switch", |
| 15030 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15031 | HDA_INPUT)); |
| 15032 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15033 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15034 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15035 | "LFE Playback Switch", |
| 15036 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15037 | HDA_INPUT)); |
| 15038 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15039 | return err; |
| 15040 | } else { |
| 15041 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15042 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15043 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15044 | HDA_OUTPUT)); |
| 15045 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15046 | return err; |
| 15047 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15048 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15049 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15050 | HDA_INPUT)); |
| 15051 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15052 | return err; |
| 15053 | } |
| 15054 | } |
| 15055 | return 0; |
| 15056 | } |
| 15057 | |
| 15058 | /* add playback controls for speaker and HP outputs */ |
| 15059 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15060 | * different NIDs for mute/unmute switch and volume control */ |
| 15061 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15062 | hda_nid_t pin, const char *pfx) |
| 15063 | { |
| 15064 | hda_nid_t nid_v, nid_s; |
| 15065 | int err; |
| 15066 | char name[32]; |
| 15067 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15068 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15069 | return 0; |
| 15070 | |
| 15071 | if (alc880_is_fixed_pin(pin)) { |
| 15072 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15073 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15074 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15075 | spec->multiout.hp_nid = nid_v; |
| 15076 | else |
| 15077 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15078 | /* control HP volume/switch on the output mixer amp */ |
| 15079 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15080 | alc880_fixed_pin_idx(pin)); |
| 15081 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15082 | alc880_fixed_pin_idx(pin)); |
| 15083 | |
| 15084 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15085 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15086 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15087 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15088 | return err; |
| 15089 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15090 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15091 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15092 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15093 | return err; |
| 15094 | } else if (alc880_is_multi_pin(pin)) { |
| 15095 | /* set manual connection */ |
| 15096 | /* we have only a switch on HP-out PIN */ |
| 15097 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15098 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15099 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15100 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15101 | return err; |
| 15102 | } |
| 15103 | return 0; |
| 15104 | } |
| 15105 | |
| 15106 | /* parse the BIOS configuration and set up the alc_spec |
| 15107 | * return 1 if successful, 0 if the proper config is not found, |
| 15108 | * or a negative error code |
| 15109 | * Based on ALC880 version - had to change it to override |
| 15110 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15111 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15112 | { |
| 15113 | struct alc_spec *spec = codec->spec; |
| 15114 | int err; |
| 15115 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15116 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15117 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15118 | alc861vd_ignore); |
| 15119 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15120 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15121 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15122 | return 0; /* can't find valid BIOS pin config */ |
| 15123 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15124 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15125 | if (err < 0) |
| 15126 | return err; |
| 15127 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15128 | if (err < 0) |
| 15129 | return err; |
| 15130 | err = alc861vd_auto_create_extra_out(spec, |
| 15131 | spec->autocfg.speaker_pins[0], |
| 15132 | "Speaker"); |
| 15133 | if (err < 0) |
| 15134 | return err; |
| 15135 | err = alc861vd_auto_create_extra_out(spec, |
| 15136 | spec->autocfg.hp_pins[0], |
| 15137 | "Headphone"); |
| 15138 | if (err < 0) |
| 15139 | return err; |
| 15140 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15141 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15142 | return err; |
| 15143 | |
| 15144 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15145 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15146 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15147 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15148 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15149 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15150 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15151 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15152 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15153 | |
| 15154 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15155 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15156 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15157 | err = alc_auto_add_mic_boost(codec); |
| 15158 | if (err < 0) |
| 15159 | return err; |
| 15160 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15161 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15162 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15163 | return 1; |
| 15164 | } |
| 15165 | |
| 15166 | /* additional initialization for auto-configuration model */ |
| 15167 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15168 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15169 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15170 | alc861vd_auto_init_multi_out(codec); |
| 15171 | alc861vd_auto_init_hp_out(codec); |
| 15172 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15173 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15174 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15175 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15176 | } |
| 15177 | |
| 15178 | static int patch_alc861vd(struct hda_codec *codec) |
| 15179 | { |
| 15180 | struct alc_spec *spec; |
| 15181 | int err, board_config; |
| 15182 | |
| 15183 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15184 | if (spec == NULL) |
| 15185 | return -ENOMEM; |
| 15186 | |
| 15187 | codec->spec = spec; |
| 15188 | |
| 15189 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15190 | alc861vd_models, |
| 15191 | alc861vd_cfg_tbl); |
| 15192 | |
| 15193 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 15194 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 15195 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 15196 | board_config = ALC861VD_AUTO; |
| 15197 | } |
| 15198 | |
| 15199 | if (board_config == ALC861VD_AUTO) { |
| 15200 | /* automatic parse from the BIOS config */ |
| 15201 | err = alc861vd_parse_auto_config(codec); |
| 15202 | if (err < 0) { |
| 15203 | alc_free(codec); |
| 15204 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15205 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15206 | printk(KERN_INFO |
| 15207 | "hda_codec: Cannot set up configuration " |
| 15208 | "from BIOS. Using base mode...\n"); |
| 15209 | board_config = ALC861VD_3ST; |
| 15210 | } |
| 15211 | } |
| 15212 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15213 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15214 | if (err < 0) { |
| 15215 | alc_free(codec); |
| 15216 | return err; |
| 15217 | } |
| 15218 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15219 | if (board_config != ALC861VD_AUTO) |
| 15220 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15221 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15222 | if (codec->vendor_id == 0x10ec0660) { |
| 15223 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 15224 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15225 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15226 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15227 | } else { |
| 15228 | spec->stream_name_analog = "ALC861VD Analog"; |
| 15229 | spec->stream_name_digital = "ALC861VD Digital"; |
| 15230 | } |
| 15231 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15232 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15233 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15234 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15235 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15236 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15237 | |
| 15238 | spec->adc_nids = alc861vd_adc_nids; |
| 15239 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15240 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15241 | spec->capture_style = CAPT_MIX; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15242 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15243 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15244 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15245 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15246 | spec->vmaster_nid = 0x02; |
| 15247 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15248 | codec->patch_ops = alc_patch_ops; |
| 15249 | |
| 15250 | if (board_config == ALC861VD_AUTO) |
| 15251 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15252 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15253 | if (!spec->loopback.amplist) |
| 15254 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15255 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15256 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15257 | |
| 15258 | return 0; |
| 15259 | } |
| 15260 | |
| 15261 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15262 | * ALC662 support |
| 15263 | * |
| 15264 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15265 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15266 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15267 | * 6-channel independent captures. |
| 15268 | * |
| 15269 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15270 | * driver yet). |
| 15271 | */ |
| 15272 | #define ALC662_DIGOUT_NID 0x06 |
| 15273 | #define ALC662_DIGIN_NID 0x0a |
| 15274 | |
| 15275 | static hda_nid_t alc662_dac_nids[4] = { |
| 15276 | /* front, rear, clfe, rear_surr */ |
| 15277 | 0x02, 0x03, 0x04 |
| 15278 | }; |
| 15279 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15280 | static hda_nid_t alc272_dac_nids[2] = { |
| 15281 | 0x02, 0x03 |
| 15282 | }; |
| 15283 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15284 | static hda_nid_t alc662_adc_nids[1] = { |
| 15285 | /* ADC1-2 */ |
| 15286 | 0x09, |
| 15287 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15288 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15289 | static hda_nid_t alc272_adc_nids[1] = { |
| 15290 | /* ADC1-2 */ |
| 15291 | 0x08, |
| 15292 | }; |
| 15293 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15294 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15295 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15296 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15297 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15298 | /* input MUX */ |
| 15299 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15300 | static struct hda_input_mux alc662_capture_source = { |
| 15301 | .num_items = 4, |
| 15302 | .items = { |
| 15303 | { "Mic", 0x0 }, |
| 15304 | { "Front Mic", 0x1 }, |
| 15305 | { "Line", 0x2 }, |
| 15306 | { "CD", 0x4 }, |
| 15307 | }, |
| 15308 | }; |
| 15309 | |
| 15310 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15311 | .num_items = 2, |
| 15312 | .items = { |
| 15313 | { "Mic", 0x1 }, |
| 15314 | { "Line", 0x2 }, |
| 15315 | }, |
| 15316 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15317 | |
| 15318 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15319 | .num_items = 2, |
| 15320 | .items = { |
| 15321 | { "i-Mic", 0x1 }, |
| 15322 | { "e-Mic", 0x0 }, |
| 15323 | }, |
| 15324 | }; |
| 15325 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15326 | static struct hda_input_mux alc663_capture_source = { |
| 15327 | .num_items = 3, |
| 15328 | .items = { |
| 15329 | { "Mic", 0x0 }, |
| 15330 | { "Front Mic", 0x1 }, |
| 15331 | { "Line", 0x2 }, |
| 15332 | }, |
| 15333 | }; |
| 15334 | |
| 15335 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15336 | .num_items = 2, |
| 15337 | .items = { |
| 15338 | { "Ext-Mic", 0x0 }, |
| 15339 | { "D-Mic", 0x9 }, |
| 15340 | }, |
| 15341 | }; |
| 15342 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15343 | /* |
| 15344 | * 2ch mode |
| 15345 | */ |
| 15346 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15347 | { 2, NULL } |
| 15348 | }; |
| 15349 | |
| 15350 | /* |
| 15351 | * 2ch mode |
| 15352 | */ |
| 15353 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15354 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15355 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15356 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15357 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15358 | { } /* end */ |
| 15359 | }; |
| 15360 | |
| 15361 | /* |
| 15362 | * 6ch mode |
| 15363 | */ |
| 15364 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15365 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15366 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15367 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15368 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15369 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15370 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15371 | { } /* end */ |
| 15372 | }; |
| 15373 | |
| 15374 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15375 | { 2, alc662_3ST_ch2_init }, |
| 15376 | { 6, alc662_3ST_ch6_init }, |
| 15377 | }; |
| 15378 | |
| 15379 | /* |
| 15380 | * 2ch mode |
| 15381 | */ |
| 15382 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15383 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15384 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15385 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15386 | { } /* end */ |
| 15387 | }; |
| 15388 | |
| 15389 | /* |
| 15390 | * 6ch mode |
| 15391 | */ |
| 15392 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15393 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15394 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15395 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15396 | { } /* end */ |
| 15397 | }; |
| 15398 | |
| 15399 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15400 | { 2, alc662_sixstack_ch6_init }, |
| 15401 | { 6, alc662_sixstack_ch8_init }, |
| 15402 | }; |
| 15403 | |
| 15404 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15405 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15406 | */ |
| 15407 | |
| 15408 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15409 | /* output mixer control */ |
| 15410 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15411 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15412 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15413 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15414 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15415 | 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] | 15416 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15417 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15418 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15419 | |
| 15420 | /*Input mixer control */ |
| 15421 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15422 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15423 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15424 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15425 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15426 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15427 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15428 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15429 | { } /* end */ |
| 15430 | }; |
| 15431 | |
| 15432 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15433 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15434 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15435 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15436 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15437 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15438 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15439 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15440 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15441 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15442 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15443 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15444 | { } /* end */ |
| 15445 | }; |
| 15446 | |
| 15447 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15448 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15449 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15450 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15451 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15452 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15453 | 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] | 15454 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15455 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15456 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15457 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15458 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15459 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15460 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15461 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15462 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15463 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15464 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15465 | { } /* end */ |
| 15466 | }; |
| 15467 | |
| 15468 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15469 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15470 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15471 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15472 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15473 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15474 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15475 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15476 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15477 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15478 | { } /* end */ |
| 15479 | }; |
| 15480 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15481 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15482 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15483 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 15484 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15485 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15486 | |
| 15487 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15488 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15489 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15490 | |
| 15491 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15492 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15493 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15494 | { } /* end */ |
| 15495 | }; |
| 15496 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15497 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 15498 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15499 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15500 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15501 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 15502 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15503 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 15504 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 15505 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15506 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15507 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15508 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15509 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15510 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15511 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15512 | { } /* end */ |
| 15513 | }; |
| 15514 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15515 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15516 | .ops = &snd_hda_bind_vol, |
| 15517 | .values = { |
| 15518 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15519 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15520 | 0 |
| 15521 | }, |
| 15522 | }; |
| 15523 | |
| 15524 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15525 | .ops = &snd_hda_bind_sw, |
| 15526 | .values = { |
| 15527 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15528 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15529 | 0 |
| 15530 | }, |
| 15531 | }; |
| 15532 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15533 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15534 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15535 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15536 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15537 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15538 | { } /* end */ |
| 15539 | }; |
| 15540 | |
| 15541 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15542 | .ops = &snd_hda_bind_sw, |
| 15543 | .values = { |
| 15544 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15545 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15546 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15547 | 0 |
| 15548 | }, |
| 15549 | }; |
| 15550 | |
| 15551 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15552 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15553 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15554 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15555 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15556 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15557 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15558 | |
| 15559 | { } /* end */ |
| 15560 | }; |
| 15561 | |
| 15562 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15563 | .ops = &snd_hda_bind_sw, |
| 15564 | .values = { |
| 15565 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15566 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15567 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15568 | 0 |
| 15569 | }, |
| 15570 | }; |
| 15571 | |
| 15572 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15573 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15574 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15575 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15576 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15577 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15578 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15579 | { } /* end */ |
| 15580 | }; |
| 15581 | |
| 15582 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15583 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15584 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15585 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15586 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15587 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15588 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15589 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15590 | { } /* end */ |
| 15591 | }; |
| 15592 | |
| 15593 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15594 | .ops = &snd_hda_bind_vol, |
| 15595 | .values = { |
| 15596 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15597 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15598 | 0 |
| 15599 | }, |
| 15600 | }; |
| 15601 | |
| 15602 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15603 | .ops = &snd_hda_bind_sw, |
| 15604 | .values = { |
| 15605 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15606 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15607 | 0 |
| 15608 | }, |
| 15609 | }; |
| 15610 | |
| 15611 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15612 | HDA_BIND_VOL("Master Playback Volume", |
| 15613 | &alc663_asus_two_bind_master_vol), |
| 15614 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15615 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15616 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15617 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15618 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15619 | { } /* end */ |
| 15620 | }; |
| 15621 | |
| 15622 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15623 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15624 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15625 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15626 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15627 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15628 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15629 | { } /* end */ |
| 15630 | }; |
| 15631 | |
| 15632 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15633 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15634 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15635 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15636 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15637 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15638 | |
| 15639 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15640 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15641 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15642 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15643 | { } /* end */ |
| 15644 | }; |
| 15645 | |
| 15646 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15647 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15648 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15649 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15650 | |
| 15651 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15652 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15653 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15654 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15655 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15656 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15657 | { } /* end */ |
| 15658 | }; |
| 15659 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15660 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15661 | { |
| 15662 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15663 | .name = "Channel Mode", |
| 15664 | .info = alc_ch_mode_info, |
| 15665 | .get = alc_ch_mode_get, |
| 15666 | .put = alc_ch_mode_put, |
| 15667 | }, |
| 15668 | { } /* end */ |
| 15669 | }; |
| 15670 | |
| 15671 | static struct hda_verb alc662_init_verbs[] = { |
| 15672 | /* ADC: mute amp left and right */ |
| 15673 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15674 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15675 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15676 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15677 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15678 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15679 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15680 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15681 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15682 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15683 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15684 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15685 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15686 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15687 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15688 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15689 | |
| 15690 | /* Front Pin: output 0 (0x0c) */ |
| 15691 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15692 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15693 | |
| 15694 | /* Rear Pin: output 1 (0x0d) */ |
| 15695 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15696 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15697 | |
| 15698 | /* CLFE Pin: output 2 (0x0e) */ |
| 15699 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15700 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15701 | |
| 15702 | /* Mic (rear) pin: input vref at 80% */ |
| 15703 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15704 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15705 | /* Front Mic pin: input vref at 80% */ |
| 15706 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15707 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15708 | /* Line In pin: input */ |
| 15709 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15710 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15711 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15712 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15713 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15714 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15715 | /* CD pin widget for input */ |
| 15716 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15717 | |
| 15718 | /* FIXME: use matrix-type input source selection */ |
| 15719 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15720 | /* Input mixer */ |
| 15721 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15722 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15723 | |
| 15724 | /* always trun on EAPD */ |
| 15725 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15726 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15727 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15728 | { } |
| 15729 | }; |
| 15730 | |
| 15731 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15732 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15733 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15734 | {} |
| 15735 | }; |
| 15736 | |
| 15737 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15738 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15739 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15740 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15741 | }; |
| 15742 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15743 | /* Set Unsolicited Event*/ |
| 15744 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15745 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15746 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15747 | {} |
| 15748 | }; |
| 15749 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15750 | /* |
| 15751 | * generic initialization of ADC, input mixers and output mixers |
| 15752 | */ |
| 15753 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15754 | /* |
| 15755 | * Unmute ADC and set the default input to mic-in |
| 15756 | */ |
| 15757 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15758 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15759 | |
| 15760 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15761 | * mixer widget |
| 15762 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15763 | * panel mic (mic 2) |
| 15764 | */ |
| 15765 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15766 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15767 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15768 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15769 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15770 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15771 | |
| 15772 | /* |
| 15773 | * Set up output mixers (0x0c - 0x0f) |
| 15774 | */ |
| 15775 | /* set vol=0 to output mixers */ |
| 15776 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15777 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15778 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15779 | |
| 15780 | /* set up input amps for analog loopback */ |
| 15781 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15782 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15783 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15784 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15785 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15786 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15787 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15788 | |
| 15789 | |
| 15790 | /* FIXME: use matrix-type input source selection */ |
| 15791 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15792 | /* Input mixer */ |
| 15793 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15794 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15795 | { } |
| 15796 | }; |
| 15797 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15798 | /* additional verbs for ALC663 */ |
| 15799 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15800 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15801 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15802 | { } |
| 15803 | }; |
| 15804 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15805 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15806 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15807 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15808 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15809 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15810 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15811 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15812 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15813 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15814 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15815 | {} |
| 15816 | }; |
| 15817 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15818 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15819 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15820 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15821 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15822 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15823 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15824 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15825 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15826 | {} |
| 15827 | }; |
| 15828 | |
| 15829 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15830 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15831 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15832 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15833 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15834 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15835 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15836 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15837 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15838 | {} |
| 15839 | }; |
| 15840 | |
| 15841 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15842 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15843 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15844 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15845 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15846 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15847 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15848 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15849 | {} |
| 15850 | }; |
| 15851 | |
| 15852 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15853 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15854 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15855 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15856 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15857 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15858 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15859 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15860 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15861 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15862 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15863 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15864 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15865 | {} |
| 15866 | }; |
| 15867 | |
| 15868 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15869 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15870 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15871 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15872 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15873 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15875 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15876 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15877 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15878 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15879 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15880 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15881 | {} |
| 15882 | }; |
| 15883 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15884 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15885 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15886 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15887 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15888 | |
| 15889 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15890 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15891 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15892 | |
| 15893 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15894 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15895 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15896 | {} |
| 15897 | }; |
| 15898 | |
| 15899 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15900 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15901 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15902 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15903 | |
| 15904 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15905 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15906 | {} |
| 15907 | }; |
| 15908 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15909 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15910 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15911 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15912 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15913 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15914 | {} |
| 15915 | }; |
| 15916 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15917 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 15918 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15919 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15920 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15921 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15922 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15923 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15924 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15925 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15926 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 15927 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15928 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15929 | {} |
| 15930 | }; |
| 15931 | |
| 15932 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 15933 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15934 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15935 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15936 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15937 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15938 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15939 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15940 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15941 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 15942 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15943 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15944 | {} |
| 15945 | }; |
| 15946 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15947 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15948 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15949 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15950 | { } /* end */ |
| 15951 | }; |
| 15952 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15953 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 15954 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 15955 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 15956 | { } /* end */ |
| 15957 | }; |
| 15958 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15959 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15960 | { |
| 15961 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15962 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15963 | |
| 15964 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15965 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15966 | bits = present ? HDA_AMP_MUTE : 0; |
| 15967 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15968 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15969 | } |
| 15970 | |
| 15971 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15972 | { |
| 15973 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15974 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15975 | |
| 15976 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15977 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15978 | bits = present ? HDA_AMP_MUTE : 0; |
| 15979 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15980 | HDA_AMP_MUTE, bits); |
| 15981 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15982 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15983 | } |
| 15984 | |
| 15985 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15986 | unsigned int res) |
| 15987 | { |
| 15988 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15989 | alc662_lenovo_101e_all_automute(codec); |
| 15990 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15991 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15992 | } |
| 15993 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15994 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15995 | { |
| 15996 | unsigned int present; |
| 15997 | |
| 15998 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15999 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 16000 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16001 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16002 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16003 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16004 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16005 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16006 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16007 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16008 | } |
| 16009 | |
| 16010 | /* unsolicited event for HP jack sensing */ |
| 16011 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16012 | unsigned int res) |
| 16013 | { |
| 16014 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16015 | alc262_hippo1_automute( codec ); |
| 16016 | |
| 16017 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 16018 | alc662_eeepc_mic_automute(codec); |
| 16019 | } |
| 16020 | |
| 16021 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16022 | { |
| 16023 | alc262_hippo1_automute( codec ); |
| 16024 | alc662_eeepc_mic_automute(codec); |
| 16025 | } |
| 16026 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16027 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 16028 | { |
| 16029 | unsigned int mute; |
| 16030 | unsigned int present; |
| 16031 | |
| 16032 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 16033 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16034 | AC_VERB_GET_PIN_SENSE, 0); |
| 16035 | present = (present & 0x80000000) != 0; |
| 16036 | if (present) { |
| 16037 | /* mute internal speaker */ |
| 16038 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16039 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16040 | } else { |
| 16041 | /* unmute internal speaker if necessary */ |
| 16042 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 16043 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16044 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16045 | } |
| 16046 | } |
| 16047 | |
| 16048 | /* unsolicited event for HP jack sensing */ |
| 16049 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 16050 | unsigned int res) |
| 16051 | { |
| 16052 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16053 | alc662_eeepc_ep20_automute(codec); |
| 16054 | } |
| 16055 | |
| 16056 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 16057 | { |
| 16058 | alc662_eeepc_ep20_automute(codec); |
| 16059 | } |
| 16060 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16061 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16062 | { |
| 16063 | unsigned int present; |
| 16064 | unsigned char bits; |
| 16065 | |
| 16066 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16067 | AC_VERB_GET_PIN_SENSE, 0) |
| 16068 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16069 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16070 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16071 | AMP_IN_MUTE(0), bits); |
| 16072 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16073 | AMP_IN_MUTE(0), bits); |
| 16074 | } |
| 16075 | |
| 16076 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16077 | { |
| 16078 | unsigned int present; |
| 16079 | unsigned char bits; |
| 16080 | |
| 16081 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16082 | AC_VERB_GET_PIN_SENSE, 0) |
| 16083 | & AC_PINSENSE_PRESENCE; |
| 16084 | bits = present ? HDA_AMP_MUTE : 0; |
| 16085 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16086 | AMP_IN_MUTE(0), bits); |
| 16087 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16088 | AMP_IN_MUTE(0), bits); |
| 16089 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16090 | AMP_IN_MUTE(0), bits); |
| 16091 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16092 | AMP_IN_MUTE(0), bits); |
| 16093 | } |
| 16094 | |
| 16095 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16096 | { |
| 16097 | unsigned int present; |
| 16098 | unsigned char bits; |
| 16099 | |
| 16100 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16101 | AC_VERB_GET_PIN_SENSE, 0) |
| 16102 | & AC_PINSENSE_PRESENCE; |
| 16103 | bits = present ? HDA_AMP_MUTE : 0; |
| 16104 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16105 | AMP_IN_MUTE(0), bits); |
| 16106 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16107 | AMP_IN_MUTE(0), bits); |
| 16108 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16109 | AMP_IN_MUTE(0), bits); |
| 16110 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16111 | AMP_IN_MUTE(0), bits); |
| 16112 | } |
| 16113 | |
| 16114 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16115 | { |
| 16116 | unsigned int present; |
| 16117 | unsigned char bits; |
| 16118 | |
| 16119 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16120 | AC_VERB_GET_PIN_SENSE, 0) |
| 16121 | & AC_PINSENSE_PRESENCE; |
| 16122 | bits = present ? 0 : PIN_OUT; |
| 16123 | snd_hda_codec_write(codec, 0x14, 0, |
| 16124 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16125 | } |
| 16126 | |
| 16127 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16128 | { |
| 16129 | unsigned int present1, present2; |
| 16130 | |
| 16131 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16132 | AC_VERB_GET_PIN_SENSE, 0) |
| 16133 | & AC_PINSENSE_PRESENCE; |
| 16134 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16135 | AC_VERB_GET_PIN_SENSE, 0) |
| 16136 | & AC_PINSENSE_PRESENCE; |
| 16137 | |
| 16138 | if (present1 || present2) { |
| 16139 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16140 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16141 | } else { |
| 16142 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16143 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16144 | } |
| 16145 | } |
| 16146 | |
| 16147 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16148 | { |
| 16149 | unsigned int present1, present2; |
| 16150 | |
| 16151 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16152 | AC_VERB_GET_PIN_SENSE, 0) |
| 16153 | & AC_PINSENSE_PRESENCE; |
| 16154 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16155 | AC_VERB_GET_PIN_SENSE, 0) |
| 16156 | & AC_PINSENSE_PRESENCE; |
| 16157 | |
| 16158 | if (present1 || present2) { |
| 16159 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16160 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16161 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16162 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16163 | } else { |
| 16164 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16165 | AMP_IN_MUTE(0), 0); |
| 16166 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16167 | AMP_IN_MUTE(0), 0); |
| 16168 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16169 | } |
| 16170 | |
| 16171 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16172 | { |
| 16173 | unsigned int present; |
| 16174 | |
| 16175 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16176 | AC_VERB_GET_PIN_SENSE, 0) |
| 16177 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16178 | 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] | 16179 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16180 | 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] | 16181 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16182 | 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] | 16183 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16184 | 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] | 16185 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16186 | } |
| 16187 | |
| 16188 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16189 | unsigned int res) |
| 16190 | { |
| 16191 | switch (res >> 26) { |
| 16192 | case ALC880_HP_EVENT: |
| 16193 | alc663_m51va_speaker_automute(codec); |
| 16194 | break; |
| 16195 | case ALC880_MIC_EVENT: |
| 16196 | alc663_m51va_mic_automute(codec); |
| 16197 | break; |
| 16198 | } |
| 16199 | } |
| 16200 | |
| 16201 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16202 | { |
| 16203 | alc663_m51va_speaker_automute(codec); |
| 16204 | alc663_m51va_mic_automute(codec); |
| 16205 | } |
| 16206 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16207 | /* ***************** Mode1 ******************************/ |
| 16208 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16209 | unsigned int res) |
| 16210 | { |
| 16211 | switch (res >> 26) { |
| 16212 | case ALC880_HP_EVENT: |
| 16213 | alc663_m51va_speaker_automute(codec); |
| 16214 | break; |
| 16215 | case ALC880_MIC_EVENT: |
| 16216 | alc662_eeepc_mic_automute(codec); |
| 16217 | break; |
| 16218 | } |
| 16219 | } |
| 16220 | |
| 16221 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16222 | { |
| 16223 | alc663_m51va_speaker_automute(codec); |
| 16224 | alc662_eeepc_mic_automute(codec); |
| 16225 | } |
| 16226 | /* ***************** Mode2 ******************************/ |
| 16227 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16228 | unsigned int res) |
| 16229 | { |
| 16230 | switch (res >> 26) { |
| 16231 | case ALC880_HP_EVENT: |
| 16232 | alc662_f5z_speaker_automute(codec); |
| 16233 | break; |
| 16234 | case ALC880_MIC_EVENT: |
| 16235 | alc662_eeepc_mic_automute(codec); |
| 16236 | break; |
| 16237 | } |
| 16238 | } |
| 16239 | |
| 16240 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16241 | { |
| 16242 | alc662_f5z_speaker_automute(codec); |
| 16243 | alc662_eeepc_mic_automute(codec); |
| 16244 | } |
| 16245 | /* ***************** Mode3 ******************************/ |
| 16246 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16247 | unsigned int res) |
| 16248 | { |
| 16249 | switch (res >> 26) { |
| 16250 | case ALC880_HP_EVENT: |
| 16251 | alc663_two_hp_m1_speaker_automute(codec); |
| 16252 | break; |
| 16253 | case ALC880_MIC_EVENT: |
| 16254 | alc662_eeepc_mic_automute(codec); |
| 16255 | break; |
| 16256 | } |
| 16257 | } |
| 16258 | |
| 16259 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16260 | { |
| 16261 | alc663_two_hp_m1_speaker_automute(codec); |
| 16262 | alc662_eeepc_mic_automute(codec); |
| 16263 | } |
| 16264 | /* ***************** Mode4 ******************************/ |
| 16265 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16266 | unsigned int res) |
| 16267 | { |
| 16268 | switch (res >> 26) { |
| 16269 | case ALC880_HP_EVENT: |
| 16270 | alc663_21jd_two_speaker_automute(codec); |
| 16271 | break; |
| 16272 | case ALC880_MIC_EVENT: |
| 16273 | alc662_eeepc_mic_automute(codec); |
| 16274 | break; |
| 16275 | } |
| 16276 | } |
| 16277 | |
| 16278 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16279 | { |
| 16280 | alc663_21jd_two_speaker_automute(codec); |
| 16281 | alc662_eeepc_mic_automute(codec); |
| 16282 | } |
| 16283 | /* ***************** Mode5 ******************************/ |
| 16284 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16285 | unsigned int res) |
| 16286 | { |
| 16287 | switch (res >> 26) { |
| 16288 | case ALC880_HP_EVENT: |
| 16289 | alc663_15jd_two_speaker_automute(codec); |
| 16290 | break; |
| 16291 | case ALC880_MIC_EVENT: |
| 16292 | alc662_eeepc_mic_automute(codec); |
| 16293 | break; |
| 16294 | } |
| 16295 | } |
| 16296 | |
| 16297 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16298 | { |
| 16299 | alc663_15jd_two_speaker_automute(codec); |
| 16300 | alc662_eeepc_mic_automute(codec); |
| 16301 | } |
| 16302 | /* ***************** Mode6 ******************************/ |
| 16303 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16304 | unsigned int res) |
| 16305 | { |
| 16306 | switch (res >> 26) { |
| 16307 | case ALC880_HP_EVENT: |
| 16308 | alc663_two_hp_m2_speaker_automute(codec); |
| 16309 | break; |
| 16310 | case ALC880_MIC_EVENT: |
| 16311 | alc662_eeepc_mic_automute(codec); |
| 16312 | break; |
| 16313 | } |
| 16314 | } |
| 16315 | |
| 16316 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16317 | { |
| 16318 | alc663_two_hp_m2_speaker_automute(codec); |
| 16319 | alc662_eeepc_mic_automute(codec); |
| 16320 | } |
| 16321 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16322 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16323 | { |
| 16324 | unsigned int present; |
| 16325 | unsigned char bits; |
| 16326 | |
| 16327 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16328 | AC_VERB_GET_PIN_SENSE, 0) |
| 16329 | & AC_PINSENSE_PRESENCE; |
| 16330 | bits = present ? HDA_AMP_MUTE : 0; |
| 16331 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16332 | HDA_AMP_MUTE, bits); |
| 16333 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16334 | HDA_AMP_MUTE, bits); |
| 16335 | } |
| 16336 | |
| 16337 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16338 | { |
| 16339 | unsigned int present; |
| 16340 | unsigned char bits; |
| 16341 | |
| 16342 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16343 | AC_VERB_GET_PIN_SENSE, 0) |
| 16344 | & AC_PINSENSE_PRESENCE; |
| 16345 | bits = present ? HDA_AMP_MUTE : 0; |
| 16346 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16347 | HDA_AMP_MUTE, bits); |
| 16348 | } |
| 16349 | |
| 16350 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16351 | unsigned int res) |
| 16352 | { |
| 16353 | switch (res >> 26) { |
| 16354 | case ALC880_HP_EVENT: |
| 16355 | alc663_g71v_hp_automute(codec); |
| 16356 | break; |
| 16357 | case ALC880_FRONT_EVENT: |
| 16358 | alc663_g71v_front_automute(codec); |
| 16359 | break; |
| 16360 | case ALC880_MIC_EVENT: |
| 16361 | alc662_eeepc_mic_automute(codec); |
| 16362 | break; |
| 16363 | } |
| 16364 | } |
| 16365 | |
| 16366 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16367 | { |
| 16368 | alc663_g71v_front_automute(codec); |
| 16369 | alc663_g71v_hp_automute(codec); |
| 16370 | alc662_eeepc_mic_automute(codec); |
| 16371 | } |
| 16372 | |
| 16373 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16374 | unsigned int res) |
| 16375 | { |
| 16376 | switch (res >> 26) { |
| 16377 | case ALC880_HP_EVENT: |
| 16378 | alc663_m51va_speaker_automute(codec); |
| 16379 | break; |
| 16380 | case ALC880_MIC_EVENT: |
| 16381 | alc662_eeepc_mic_automute(codec); |
| 16382 | break; |
| 16383 | } |
| 16384 | } |
| 16385 | |
| 16386 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16387 | { |
| 16388 | alc663_m51va_speaker_automute(codec); |
| 16389 | alc662_eeepc_mic_automute(codec); |
| 16390 | } |
| 16391 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16392 | /* bind hp and internal speaker mute (with plug check) */ |
| 16393 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 16394 | struct snd_ctl_elem_value *ucontrol) |
| 16395 | { |
| 16396 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 16397 | long *valp = ucontrol->value.integer.value; |
| 16398 | int change; |
| 16399 | |
| 16400 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 16401 | HDA_AMP_MUTE, |
| 16402 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 16403 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 16404 | HDA_AMP_MUTE, |
| 16405 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 16406 | if (change) |
| 16407 | alc262_hippo1_automute(codec); |
| 16408 | return change; |
| 16409 | } |
| 16410 | |
| 16411 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16412 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16413 | { |
| 16414 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16415 | .name = "Master Playback Switch", |
| 16416 | .info = snd_hda_mixer_amp_switch_info, |
| 16417 | .get = snd_hda_mixer_amp_switch_get, |
| 16418 | .put = alc662_ecs_master_sw_put, |
| 16419 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16420 | }, |
| 16421 | |
| 16422 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16423 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16424 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16425 | |
| 16426 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16427 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16428 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16429 | { } /* end */ |
| 16430 | }; |
| 16431 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16432 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16433 | #define alc662_loopbacks alc880_loopbacks |
| 16434 | #endif |
| 16435 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16436 | |
| 16437 | /* pcm configuration: identiacal with ALC880 */ |
| 16438 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16439 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16440 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16441 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16442 | |
| 16443 | /* |
| 16444 | * configuration and preset |
| 16445 | */ |
| 16446 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16447 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16448 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16449 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16450 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16451 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16452 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16453 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16454 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16455 | [ALC663_ASUS_M51VA] = "m51va", |
| 16456 | [ALC663_ASUS_G71V] = "g71v", |
| 16457 | [ALC663_ASUS_H13] = "h13", |
| 16458 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16459 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16460 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16461 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16462 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16463 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16464 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16465 | [ALC662_AUTO] = "auto", |
| 16466 | }; |
| 16467 | |
| 16468 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16469 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16470 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16471 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16472 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16473 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16474 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16475 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16476 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16477 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16478 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16479 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16480 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16481 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16482 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16483 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16484 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16485 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16486 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16487 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16488 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16489 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16490 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16491 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16492 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16493 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16494 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16495 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16496 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16497 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16498 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16499 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16500 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16501 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16502 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16503 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16504 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16505 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16506 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16507 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16508 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16509 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16510 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16511 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16512 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16513 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16514 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16515 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16516 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16517 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16518 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16519 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16520 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16521 | ALC662_3ST_6ch_DIG), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16522 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16523 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16524 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16525 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16526 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16527 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16528 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16529 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16530 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16531 | {} |
| 16532 | }; |
| 16533 | |
| 16534 | static struct alc_config_preset alc662_presets[] = { |
| 16535 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16536 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16537 | .init_verbs = { alc662_init_verbs }, |
| 16538 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16539 | .dac_nids = alc662_dac_nids, |
| 16540 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16541 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16542 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16543 | .channel_mode = alc662_3ST_2ch_modes, |
| 16544 | .input_mux = &alc662_capture_source, |
| 16545 | }, |
| 16546 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16547 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16548 | .init_verbs = { alc662_init_verbs }, |
| 16549 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16550 | .dac_nids = alc662_dac_nids, |
| 16551 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16552 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16553 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16554 | .channel_mode = alc662_3ST_6ch_modes, |
| 16555 | .need_dac_fix = 1, |
| 16556 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16557 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16558 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16559 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16560 | .init_verbs = { alc662_init_verbs }, |
| 16561 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16562 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16563 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16564 | .channel_mode = alc662_3ST_6ch_modes, |
| 16565 | .need_dac_fix = 1, |
| 16566 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16567 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16568 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16569 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16570 | .init_verbs = { alc662_init_verbs }, |
| 16571 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16572 | .dac_nids = alc662_dac_nids, |
| 16573 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16574 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16575 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16576 | .channel_mode = alc662_5stack_modes, |
| 16577 | .input_mux = &alc662_capture_source, |
| 16578 | }, |
| 16579 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16580 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16581 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16582 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16583 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16584 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16585 | .channel_mode = alc662_3ST_2ch_modes, |
| 16586 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16587 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16588 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16589 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16590 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16591 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16592 | .init_verbs = { alc662_init_verbs, |
| 16593 | alc662_eeepc_sue_init_verbs }, |
| 16594 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16595 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16596 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16597 | .channel_mode = alc662_3ST_2ch_modes, |
| 16598 | .input_mux = &alc662_eeepc_capture_source, |
| 16599 | .unsol_event = alc662_eeepc_unsol_event, |
| 16600 | .init_hook = alc662_eeepc_inithook, |
| 16601 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16602 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16603 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16604 | alc662_chmode_mixer }, |
| 16605 | .init_verbs = { alc662_init_verbs, |
| 16606 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16607 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16608 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16609 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16610 | .channel_mode = alc662_3ST_6ch_modes, |
| 16611 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16612 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 16613 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16614 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16615 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16616 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16617 | .init_verbs = { alc662_init_verbs, |
| 16618 | alc662_ecs_init_verbs }, |
| 16619 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16620 | .dac_nids = alc662_dac_nids, |
| 16621 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16622 | .channel_mode = alc662_3ST_2ch_modes, |
| 16623 | .input_mux = &alc662_eeepc_capture_source, |
| 16624 | .unsol_event = alc662_eeepc_unsol_event, |
| 16625 | .init_hook = alc662_eeepc_inithook, |
| 16626 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16627 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16628 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16629 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16630 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16631 | .dac_nids = alc662_dac_nids, |
| 16632 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16633 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16634 | .channel_mode = alc662_3ST_2ch_modes, |
| 16635 | .input_mux = &alc663_m51va_capture_source, |
| 16636 | .unsol_event = alc663_m51va_unsol_event, |
| 16637 | .init_hook = alc663_m51va_inithook, |
| 16638 | }, |
| 16639 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16640 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16641 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16642 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16643 | .dac_nids = alc662_dac_nids, |
| 16644 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16645 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16646 | .channel_mode = alc662_3ST_2ch_modes, |
| 16647 | .input_mux = &alc662_eeepc_capture_source, |
| 16648 | .unsol_event = alc663_g71v_unsol_event, |
| 16649 | .init_hook = alc663_g71v_inithook, |
| 16650 | }, |
| 16651 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16652 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16653 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16654 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16655 | .dac_nids = alc662_dac_nids, |
| 16656 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16657 | .channel_mode = alc662_3ST_2ch_modes, |
| 16658 | .input_mux = &alc663_m51va_capture_source, |
| 16659 | .unsol_event = alc663_m51va_unsol_event, |
| 16660 | .init_hook = alc663_m51va_inithook, |
| 16661 | }, |
| 16662 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16663 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16664 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16665 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16666 | .dac_nids = alc662_dac_nids, |
| 16667 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16668 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16669 | .channel_mode = alc662_3ST_6ch_modes, |
| 16670 | .input_mux = &alc663_capture_source, |
| 16671 | .unsol_event = alc663_g50v_unsol_event, |
| 16672 | .init_hook = alc663_g50v_inithook, |
| 16673 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16674 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16675 | .mixers = { alc663_m51va_mixer }, |
| 16676 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16677 | .init_verbs = { alc662_init_verbs, |
| 16678 | alc663_21jd_amic_init_verbs }, |
| 16679 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16680 | .hp_nid = 0x03, |
| 16681 | .dac_nids = alc662_dac_nids, |
| 16682 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16683 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16684 | .channel_mode = alc662_3ST_2ch_modes, |
| 16685 | .input_mux = &alc662_eeepc_capture_source, |
| 16686 | .unsol_event = alc663_mode1_unsol_event, |
| 16687 | .init_hook = alc663_mode1_inithook, |
| 16688 | }, |
| 16689 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16690 | .mixers = { alc662_1bjd_mixer }, |
| 16691 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16692 | .init_verbs = { alc662_init_verbs, |
| 16693 | alc662_1bjd_amic_init_verbs }, |
| 16694 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16695 | .dac_nids = alc662_dac_nids, |
| 16696 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16697 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16698 | .channel_mode = alc662_3ST_2ch_modes, |
| 16699 | .input_mux = &alc662_eeepc_capture_source, |
| 16700 | .unsol_event = alc662_mode2_unsol_event, |
| 16701 | .init_hook = alc662_mode2_inithook, |
| 16702 | }, |
| 16703 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16704 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16705 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16706 | .init_verbs = { alc662_init_verbs, |
| 16707 | alc663_two_hp_amic_m1_init_verbs }, |
| 16708 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16709 | .hp_nid = 0x03, |
| 16710 | .dac_nids = alc662_dac_nids, |
| 16711 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16712 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16713 | .channel_mode = alc662_3ST_2ch_modes, |
| 16714 | .input_mux = &alc662_eeepc_capture_source, |
| 16715 | .unsol_event = alc663_mode3_unsol_event, |
| 16716 | .init_hook = alc663_mode3_inithook, |
| 16717 | }, |
| 16718 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16719 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16720 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16721 | .init_verbs = { alc662_init_verbs, |
| 16722 | alc663_21jd_amic_init_verbs}, |
| 16723 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16724 | .hp_nid = 0x03, |
| 16725 | .dac_nids = alc662_dac_nids, |
| 16726 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16727 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16728 | .channel_mode = alc662_3ST_2ch_modes, |
| 16729 | .input_mux = &alc662_eeepc_capture_source, |
| 16730 | .unsol_event = alc663_mode4_unsol_event, |
| 16731 | .init_hook = alc663_mode4_inithook, |
| 16732 | }, |
| 16733 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16734 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16735 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16736 | .init_verbs = { alc662_init_verbs, |
| 16737 | alc663_15jd_amic_init_verbs }, |
| 16738 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16739 | .hp_nid = 0x03, |
| 16740 | .dac_nids = alc662_dac_nids, |
| 16741 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16742 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16743 | .channel_mode = alc662_3ST_2ch_modes, |
| 16744 | .input_mux = &alc662_eeepc_capture_source, |
| 16745 | .unsol_event = alc663_mode5_unsol_event, |
| 16746 | .init_hook = alc663_mode5_inithook, |
| 16747 | }, |
| 16748 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16749 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16750 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16751 | .init_verbs = { alc662_init_verbs, |
| 16752 | alc663_two_hp_amic_m2_init_verbs }, |
| 16753 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16754 | .hp_nid = 0x03, |
| 16755 | .dac_nids = alc662_dac_nids, |
| 16756 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16757 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16758 | .channel_mode = alc662_3ST_2ch_modes, |
| 16759 | .input_mux = &alc662_eeepc_capture_source, |
| 16760 | .unsol_event = alc663_mode6_unsol_event, |
| 16761 | .init_hook = alc663_mode6_inithook, |
| 16762 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16763 | [ALC272_DELL] = { |
| 16764 | .mixers = { alc663_m51va_mixer }, |
| 16765 | .cap_mixer = alc272_auto_capture_mixer, |
| 16766 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 16767 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16768 | .dac_nids = alc662_dac_nids, |
| 16769 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16770 | .adc_nids = alc272_adc_nids, |
| 16771 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 16772 | .capsrc_nids = alc272_capsrc_nids, |
| 16773 | .channel_mode = alc662_3ST_2ch_modes, |
| 16774 | .input_mux = &alc663_m51va_capture_source, |
| 16775 | .unsol_event = alc663_m51va_unsol_event, |
| 16776 | .init_hook = alc663_m51va_inithook, |
| 16777 | }, |
| 16778 | [ALC272_DELL_ZM1] = { |
| 16779 | .mixers = { alc663_m51va_mixer }, |
| 16780 | .cap_mixer = alc662_auto_capture_mixer, |
| 16781 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 16782 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16783 | .dac_nids = alc662_dac_nids, |
| 16784 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16785 | .adc_nids = alc662_adc_nids, |
| 16786 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 16787 | .capsrc_nids = alc662_capsrc_nids, |
| 16788 | .channel_mode = alc662_3ST_2ch_modes, |
| 16789 | .input_mux = &alc663_m51va_capture_source, |
| 16790 | .unsol_event = alc663_m51va_unsol_event, |
| 16791 | .init_hook = alc663_m51va_inithook, |
| 16792 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16793 | }; |
| 16794 | |
| 16795 | |
| 16796 | /* |
| 16797 | * BIOS auto configuration |
| 16798 | */ |
| 16799 | |
| 16800 | /* add playback controls from the parsed DAC table */ |
| 16801 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16802 | const struct auto_pin_cfg *cfg) |
| 16803 | { |
| 16804 | char name[32]; |
| 16805 | static const char *chname[4] = { |
| 16806 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16807 | }; |
| 16808 | hda_nid_t nid; |
| 16809 | int i, err; |
| 16810 | |
| 16811 | for (i = 0; i < cfg->line_outs; i++) { |
| 16812 | if (!spec->multiout.dac_nids[i]) |
| 16813 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16814 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16815 | if (i == 2) { |
| 16816 | /* Center/LFE */ |
| 16817 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16818 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16819 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 16820 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16821 | if (err < 0) |
| 16822 | return err; |
| 16823 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16824 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16825 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 16826 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16827 | if (err < 0) |
| 16828 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16829 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16830 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16831 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16832 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16833 | if (err < 0) |
| 16834 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16835 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16836 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16837 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16838 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16839 | if (err < 0) |
| 16840 | return err; |
| 16841 | } else { |
| 16842 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16843 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16844 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16845 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16846 | if (err < 0) |
| 16847 | return err; |
| 16848 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16849 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16850 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16851 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16852 | if (err < 0) |
| 16853 | return err; |
| 16854 | } |
| 16855 | } |
| 16856 | return 0; |
| 16857 | } |
| 16858 | |
| 16859 | /* add playback controls for speaker and HP outputs */ |
| 16860 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16861 | const char *pfx) |
| 16862 | { |
| 16863 | hda_nid_t nid; |
| 16864 | int err; |
| 16865 | char name[32]; |
| 16866 | |
| 16867 | if (!pin) |
| 16868 | return 0; |
| 16869 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16870 | if (pin == 0x17) { |
| 16871 | /* ALC663 has a mono output pin on 0x17 */ |
| 16872 | sprintf(name, "%s Playback Switch", pfx); |
| 16873 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16874 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16875 | return err; |
| 16876 | } |
| 16877 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16878 | if (alc880_is_fixed_pin(pin)) { |
| 16879 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 16880 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16881 | /* specify the DAC as the extra output */ |
| 16882 | if (!spec->multiout.hp_nid) |
| 16883 | spec->multiout.hp_nid = nid; |
| 16884 | else |
| 16885 | spec->multiout.extra_out_nid[0] = nid; |
| 16886 | /* control HP volume/switch on the output mixer amp */ |
| 16887 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16888 | sprintf(name, "%s Playback Volume", pfx); |
| 16889 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16890 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16891 | if (err < 0) |
| 16892 | return err; |
| 16893 | sprintf(name, "%s Playback Switch", pfx); |
| 16894 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16895 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16896 | if (err < 0) |
| 16897 | return err; |
| 16898 | } else if (alc880_is_multi_pin(pin)) { |
| 16899 | /* set manual connection */ |
| 16900 | /* we have only a switch on HP-out PIN */ |
| 16901 | sprintf(name, "%s Playback Switch", pfx); |
| 16902 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16903 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16904 | if (err < 0) |
| 16905 | return err; |
| 16906 | } |
| 16907 | return 0; |
| 16908 | } |
| 16909 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16910 | /* return the index of the src widget from the connection list of the nid. |
| 16911 | * return -1 if not found |
| 16912 | */ |
| 16913 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 16914 | hda_nid_t src) |
| 16915 | { |
| 16916 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 16917 | int i, conns; |
| 16918 | |
| 16919 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 16920 | ARRAY_SIZE(conn_list)); |
| 16921 | if (conns < 0) |
| 16922 | return -1; |
| 16923 | for (i = 0; i < conns; i++) |
| 16924 | if (conn_list[i] == src) |
| 16925 | return i; |
| 16926 | return -1; |
| 16927 | } |
| 16928 | |
| 16929 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 16930 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 16931 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16932 | return (pincap & AC_PINCAP_IN) != 0; |
| 16933 | } |
| 16934 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16935 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16936 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16937 | const struct auto_pin_cfg *cfg) |
| 16938 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16939 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16940 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16941 | int i, err, idx; |
| 16942 | |
| 16943 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16944 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 16945 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 16946 | cfg->input_pins[i]); |
| 16947 | if (idx >= 0) { |
| 16948 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16949 | auto_pin_cfg_labels[i], |
| 16950 | idx, 0x0b); |
| 16951 | if (err < 0) |
| 16952 | return err; |
| 16953 | } |
| 16954 | idx = alc662_input_pin_idx(codec, 0x22, |
| 16955 | cfg->input_pins[i]); |
| 16956 | if (idx >= 0) { |
| 16957 | imux->items[imux->num_items].label = |
| 16958 | auto_pin_cfg_labels[i]; |
| 16959 | imux->items[imux->num_items].index = idx; |
| 16960 | imux->num_items++; |
| 16961 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16962 | } |
| 16963 | } |
| 16964 | return 0; |
| 16965 | } |
| 16966 | |
| 16967 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16968 | hda_nid_t nid, int pin_type, |
| 16969 | int dac_idx) |
| 16970 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16971 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16972 | /* need the manual connection? */ |
| 16973 | if (alc880_is_multi_pin(nid)) { |
| 16974 | struct alc_spec *spec = codec->spec; |
| 16975 | int idx = alc880_multi_pin_idx(nid); |
| 16976 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16977 | AC_VERB_SET_CONNECT_SEL, |
| 16978 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16979 | } |
| 16980 | } |
| 16981 | |
| 16982 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16983 | { |
| 16984 | struct alc_spec *spec = codec->spec; |
| 16985 | int i; |
| 16986 | |
| 16987 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16988 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16989 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16990 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16991 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16992 | i); |
| 16993 | } |
| 16994 | } |
| 16995 | |
| 16996 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16997 | { |
| 16998 | struct alc_spec *spec = codec->spec; |
| 16999 | hda_nid_t pin; |
| 17000 | |
| 17001 | pin = spec->autocfg.hp_pins[0]; |
| 17002 | if (pin) /* connect to front */ |
| 17003 | /* use dac 0 */ |
| 17004 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17005 | pin = spec->autocfg.speaker_pins[0]; |
| 17006 | if (pin) |
| 17007 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17008 | } |
| 17009 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17010 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17011 | |
| 17012 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17013 | { |
| 17014 | struct alc_spec *spec = codec->spec; |
| 17015 | int i; |
| 17016 | |
| 17017 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17018 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17019 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17020 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17021 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17022 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17023 | snd_hda_codec_write(codec, nid, 0, |
| 17024 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17025 | AMP_OUT_MUTE); |
| 17026 | } |
| 17027 | } |
| 17028 | } |
| 17029 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17030 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17031 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17032 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17033 | { |
| 17034 | struct alc_spec *spec = codec->spec; |
| 17035 | int err; |
| 17036 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17037 | |
| 17038 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17039 | alc662_ignore); |
| 17040 | if (err < 0) |
| 17041 | return err; |
| 17042 | if (!spec->autocfg.line_outs) |
| 17043 | return 0; /* can't find valid BIOS pin config */ |
| 17044 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17045 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17046 | if (err < 0) |
| 17047 | return err; |
| 17048 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17049 | if (err < 0) |
| 17050 | return err; |
| 17051 | err = alc662_auto_create_extra_out(spec, |
| 17052 | spec->autocfg.speaker_pins[0], |
| 17053 | "Speaker"); |
| 17054 | if (err < 0) |
| 17055 | return err; |
| 17056 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17057 | "Headphone"); |
| 17058 | if (err < 0) |
| 17059 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17060 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17061 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17062 | return err; |
| 17063 | |
| 17064 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17065 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17066 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17067 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17068 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17069 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17070 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17071 | |
| 17072 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17073 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17074 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17075 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17076 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17077 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17078 | |
| 17079 | err = alc_auto_add_mic_boost(codec); |
| 17080 | if (err < 0) |
| 17081 | return err; |
| 17082 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17083 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17084 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17085 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17086 | } |
| 17087 | |
| 17088 | /* additional initialization for auto-configuration model */ |
| 17089 | static void alc662_auto_init(struct hda_codec *codec) |
| 17090 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17091 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17092 | alc662_auto_init_multi_out(codec); |
| 17093 | alc662_auto_init_hp_out(codec); |
| 17094 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17095 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17096 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17097 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17098 | } |
| 17099 | |
| 17100 | static int patch_alc662(struct hda_codec *codec) |
| 17101 | { |
| 17102 | struct alc_spec *spec; |
| 17103 | int err, board_config; |
| 17104 | |
| 17105 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17106 | if (!spec) |
| 17107 | return -ENOMEM; |
| 17108 | |
| 17109 | codec->spec = spec; |
| 17110 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17111 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17112 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17113 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17114 | alc662_models, |
| 17115 | alc662_cfg_tbl); |
| 17116 | if (board_config < 0) { |
| 17117 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 17118 | "trying auto-probe from BIOS...\n"); |
| 17119 | board_config = ALC662_AUTO; |
| 17120 | } |
| 17121 | |
| 17122 | if (board_config == ALC662_AUTO) { |
| 17123 | /* automatic parse from the BIOS config */ |
| 17124 | err = alc662_parse_auto_config(codec); |
| 17125 | if (err < 0) { |
| 17126 | alc_free(codec); |
| 17127 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17128 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17129 | printk(KERN_INFO |
| 17130 | "hda_codec: Cannot set up configuration " |
| 17131 | "from BIOS. Using base mode...\n"); |
| 17132 | board_config = ALC662_3ST_2ch_DIG; |
| 17133 | } |
| 17134 | } |
| 17135 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17136 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17137 | if (err < 0) { |
| 17138 | alc_free(codec); |
| 17139 | return err; |
| 17140 | } |
| 17141 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17142 | if (board_config != ALC662_AUTO) |
| 17143 | setup_preset(spec, &alc662_presets[board_config]); |
| 17144 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17145 | if (codec->vendor_id == 0x10ec0663) { |
| 17146 | spec->stream_name_analog = "ALC663 Analog"; |
| 17147 | spec->stream_name_digital = "ALC663 Digital"; |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17148 | } else if (codec->vendor_id == 0x10ec0272) { |
| 17149 | spec->stream_name_analog = "ALC272 Analog"; |
| 17150 | spec->stream_name_digital = "ALC272 Digital"; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17151 | } else { |
| 17152 | spec->stream_name_analog = "ALC662 Analog"; |
| 17153 | spec->stream_name_digital = "ALC662 Digital"; |
| 17154 | } |
| 17155 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17156 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17157 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17158 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17159 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17160 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17161 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17162 | spec->adc_nids = alc662_adc_nids; |
| 17163 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17164 | spec->capsrc_nids = alc662_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17165 | spec->capture_style = CAPT_MIX; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17166 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17167 | if (!spec->cap_mixer) |
| 17168 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17169 | if (codec->vendor_id == 0x10ec0662) |
| 17170 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17171 | else |
| 17172 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17173 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17174 | spec->vmaster_nid = 0x02; |
| 17175 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17176 | codec->patch_ops = alc_patch_ops; |
| 17177 | if (board_config == ALC662_AUTO) |
| 17178 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17179 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17180 | if (!spec->loopback.amplist) |
| 17181 | spec->loopback.amplist = alc662_loopbacks; |
| 17182 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17183 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17184 | |
| 17185 | return 0; |
| 17186 | } |
| 17187 | |
| 17188 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17189 | * patch entries |
| 17190 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17191 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17192 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17193 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17194 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17195 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17196 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17197 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17198 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17199 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17200 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17201 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17202 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17203 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 17204 | .patch = patch_alc883 }, |
| 17205 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17206 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17207 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17208 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17209 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 17210 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17211 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 17212 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17213 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 17214 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17215 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 17216 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17217 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 17218 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 17219 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17220 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17221 | {} /* terminator */ |
| 17222 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17223 | |
| 17224 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17225 | |
| 17226 | MODULE_LICENSE("GPL"); |
| 17227 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17228 | |
| 17229 | static struct hda_codec_preset_list realtek_list = { |
| 17230 | .preset = snd_hda_preset_realtek, |
| 17231 | .owner = THIS_MODULE, |
| 17232 | }; |
| 17233 | |
| 17234 | static int __init patch_realtek_init(void) |
| 17235 | { |
| 17236 | return snd_hda_add_codec_preset(&realtek_list); |
| 17237 | } |
| 17238 | |
| 17239 | static void __exit patch_realtek_exit(void) |
| 17240 | { |
| 17241 | snd_hda_delete_codec_preset(&realtek_list); |
| 17242 | } |
| 17243 | |
| 17244 | module_init(patch_realtek_init) |
| 17245 | module_exit(patch_realtek_exit) |