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]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1102 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1103 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1104 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1105 | else |
| 1106 | return; |
| 1107 | } |
| 1108 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame^] | 1109 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1110 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1111 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1112 | spec->unsol_event = alc_sku_unsol_event; |
| 1113 | } |
| 1114 | |
| 1115 | /* check subsystem ID and set up device-specific initialization; |
| 1116 | * return 1 if initialized, 0 if invalid SSID |
| 1117 | */ |
| 1118 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1119 | * 31 ~ 16 : Manufacture ID |
| 1120 | * 15 ~ 8 : SKU ID |
| 1121 | * 7 ~ 0 : Assembly ID |
| 1122 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1123 | */ |
| 1124 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1125 | hda_nid_t porta, hda_nid_t porte, |
| 1126 | hda_nid_t portd) |
| 1127 | { |
| 1128 | unsigned int ass, tmp, i; |
| 1129 | unsigned nid; |
| 1130 | struct alc_spec *spec = codec->spec; |
| 1131 | |
| 1132 | ass = codec->subsystem_id & 0xffff; |
| 1133 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1134 | goto do_sku; |
| 1135 | |
| 1136 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1137 | /* |
| 1138 | * 31~30 : port conetcivity |
| 1139 | * 29~21 : reserve |
| 1140 | * 20 : PCBEEP input |
| 1141 | * 19~16 : Check sum (15:1) |
| 1142 | * 15~1 : Custom |
| 1143 | * 0 : override |
| 1144 | */ |
| 1145 | nid = 0x1d; |
| 1146 | if (codec->vendor_id == 0x10ec0260) |
| 1147 | nid = 0x17; |
| 1148 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1149 | snd_printd("realtek: No valid SSID, " |
| 1150 | "checking pincfg 0x%08x for NID 0x%x\n", |
| 1151 | nid, ass); |
| 1152 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1153 | return 0; |
| 1154 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1155 | return 0; |
| 1156 | |
| 1157 | /* check sum */ |
| 1158 | tmp = 0; |
| 1159 | for (i = 1; i < 16; i++) { |
| 1160 | if ((ass >> i) & 1) |
| 1161 | tmp++; |
| 1162 | } |
| 1163 | if (((ass >> 16) & 0xf) != tmp) |
| 1164 | return 0; |
| 1165 | do_sku: |
| 1166 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1167 | ass & 0xffff, codec->vendor_id); |
| 1168 | /* |
| 1169 | * 0 : override |
| 1170 | * 1 : Swap Jack |
| 1171 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1172 | * 3~5 : External Amplifier control |
| 1173 | * 7~6 : Reserved |
| 1174 | */ |
| 1175 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1176 | switch (tmp) { |
| 1177 | case 1: |
| 1178 | spec->init_amp = ALC_INIT_GPIO1; |
| 1179 | break; |
| 1180 | case 3: |
| 1181 | spec->init_amp = ALC_INIT_GPIO2; |
| 1182 | break; |
| 1183 | case 7: |
| 1184 | spec->init_amp = ALC_INIT_GPIO3; |
| 1185 | break; |
| 1186 | case 5: |
| 1187 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1188 | break; |
| 1189 | } |
| 1190 | |
| 1191 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1192 | * when the external headphone out jack is plugged" |
| 1193 | */ |
| 1194 | if (!(ass & 0x8000)) |
| 1195 | return 1; |
| 1196 | /* |
| 1197 | * 10~8 : Jack location |
| 1198 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1199 | * 14~13: Resvered |
| 1200 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1201 | * when the external headphone out jack is plugged" |
| 1202 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1203 | if (!spec->autocfg.hp_pins[0]) { |
| 1204 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1205 | if (tmp == 0) |
| 1206 | spec->autocfg.hp_pins[0] = porta; |
| 1207 | else if (tmp == 1) |
| 1208 | spec->autocfg.hp_pins[0] = porte; |
| 1209 | else if (tmp == 2) |
| 1210 | spec->autocfg.hp_pins[0] = portd; |
| 1211 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame^] | 1212 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1213 | } |
| 1214 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame^] | 1215 | alc_init_auto_hp(codec); |
| 1216 | return 1; |
| 1217 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1218 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame^] | 1219 | static void alc_ssid_check(struct hda_codec *codec, |
| 1220 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1221 | { |
| 1222 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1223 | struct alc_spec *spec = codec->spec; |
| 1224 | snd_printd("realtek: " |
| 1225 | "Enable default setup for auto mode as fallback\n"); |
| 1226 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1227 | alc_init_auto_hp(codec); |
| 1228 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1229 | } |
| 1230 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1231 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1232 | * Fix-up pin default configurations |
| 1233 | */ |
| 1234 | |
| 1235 | struct alc_pincfg { |
| 1236 | hda_nid_t nid; |
| 1237 | u32 val; |
| 1238 | }; |
| 1239 | |
| 1240 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1241 | const struct snd_pci_quirk *quirk, |
| 1242 | const struct alc_pincfg **pinfix) |
| 1243 | { |
| 1244 | const struct alc_pincfg *cfg; |
| 1245 | |
| 1246 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1247 | if (!quirk) |
| 1248 | return; |
| 1249 | |
| 1250 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1251 | for (; cfg->nid; cfg++) |
| 1252 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1253 | } |
| 1254 | |
| 1255 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1256 | * ALC888 |
| 1257 | */ |
| 1258 | |
| 1259 | /* |
| 1260 | * 2ch mode |
| 1261 | */ |
| 1262 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1263 | /* Mic-in jack as mic in */ |
| 1264 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1265 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1266 | /* Line-in jack as Line in */ |
| 1267 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1268 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1269 | /* Line-Out as Front */ |
| 1270 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1271 | { } /* end */ |
| 1272 | }; |
| 1273 | |
| 1274 | /* |
| 1275 | * 4ch mode |
| 1276 | */ |
| 1277 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1278 | /* Mic-in jack as mic in */ |
| 1279 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1280 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1281 | /* Line-in jack as Surround */ |
| 1282 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1283 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1284 | /* Line-Out as Front */ |
| 1285 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1286 | { } /* end */ |
| 1287 | }; |
| 1288 | |
| 1289 | /* |
| 1290 | * 6ch mode |
| 1291 | */ |
| 1292 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1293 | /* Mic-in jack as CLFE */ |
| 1294 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1295 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1296 | /* Line-in jack as Surround */ |
| 1297 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1298 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1299 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1300 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1301 | { } /* end */ |
| 1302 | }; |
| 1303 | |
| 1304 | /* |
| 1305 | * 8ch mode |
| 1306 | */ |
| 1307 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1308 | /* Mic-in jack as CLFE */ |
| 1309 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1310 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1311 | /* Line-in jack as Surround */ |
| 1312 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1313 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1314 | /* Line-Out as Side */ |
| 1315 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1316 | { } /* end */ |
| 1317 | }; |
| 1318 | |
| 1319 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1320 | { 2, alc888_4ST_ch2_intel_init }, |
| 1321 | { 4, alc888_4ST_ch4_intel_init }, |
| 1322 | { 6, alc888_4ST_ch6_intel_init }, |
| 1323 | { 8, alc888_4ST_ch8_intel_init }, |
| 1324 | }; |
| 1325 | |
| 1326 | /* |
| 1327 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1328 | */ |
| 1329 | |
| 1330 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1331 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1332 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1333 | /* Connect Internal HP to Front */ |
| 1334 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1335 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1336 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1337 | /* Connect Bass HP to Front */ |
| 1338 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1339 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1340 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1341 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1342 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1343 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1344 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1345 | /* Connect Mic jack to CLFE */ |
| 1346 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1347 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1348 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1349 | /* Connect Line-in jack to Surround */ |
| 1350 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1351 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1352 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1353 | /* Connect HP out jack to Front */ |
| 1354 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1355 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1356 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1357 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1358 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1359 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1360 | {} |
| 1361 | }; |
| 1362 | |
| 1363 | static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec) |
| 1364 | { |
| 1365 | unsigned int present; |
| 1366 | unsigned int bits; |
| 1367 | /* Line out presence */ |
| 1368 | present = snd_hda_codec_read(codec, 0x17, 0, |
| 1369 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1370 | /* HP out presence */ |
| 1371 | present = present || snd_hda_codec_read(codec, 0x1b, 0, |
| 1372 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1373 | bits = present ? HDA_AMP_MUTE : 0; |
| 1374 | /* Toggle internal speakers muting */ |
| 1375 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1376 | HDA_AMP_MUTE, bits); |
| 1377 | /* Toggle internal bass muting */ |
| 1378 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1379 | HDA_AMP_MUTE, bits); |
| 1380 | } |
| 1381 | |
| 1382 | static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec, |
| 1383 | unsigned int res) |
| 1384 | { |
| 1385 | if (res >> 26 == ALC880_HP_EVENT) |
| 1386 | alc888_fujitsu_xa3530_automute(codec); |
| 1387 | } |
| 1388 | |
| 1389 | |
| 1390 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1391 | * ALC888 Acer Aspire 4930G model |
| 1392 | */ |
| 1393 | |
| 1394 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1395 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1396 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1397 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1399 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1400 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1401 | /* Connect Internal HP to front */ |
| 1402 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1403 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1404 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1405 | /* Connect HP out to front */ |
| 1406 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1407 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1408 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1409 | { } |
| 1410 | }; |
| 1411 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1412 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1413 | /* Front mic only available on one ADC */ |
| 1414 | { |
| 1415 | .num_items = 4, |
| 1416 | .items = { |
| 1417 | { "Mic", 0x0 }, |
| 1418 | { "Line", 0x2 }, |
| 1419 | { "CD", 0x4 }, |
| 1420 | { "Front Mic", 0xb }, |
| 1421 | }, |
| 1422 | }, |
| 1423 | { |
| 1424 | .num_items = 3, |
| 1425 | .items = { |
| 1426 | { "Mic", 0x0 }, |
| 1427 | { "Line", 0x2 }, |
| 1428 | { "CD", 0x4 }, |
| 1429 | }, |
| 1430 | } |
| 1431 | }; |
| 1432 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1433 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1434 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1435 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1436 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1437 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1438 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1439 | HDA_OUTPUT), |
| 1440 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1441 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1442 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1443 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1444 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1445 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1446 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1447 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1448 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1449 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1450 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1451 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1452 | { } /* end */ |
| 1453 | }; |
| 1454 | |
| 1455 | static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec) |
| 1456 | { |
| 1457 | unsigned int present; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1458 | unsigned int bits; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1459 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 1460 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1461 | bits = present ? HDA_AMP_MUTE : 0; |
| 1462 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1463 | HDA_AMP_MUTE, bits); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1464 | } |
| 1465 | |
| 1466 | static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, |
| 1467 | unsigned int res) |
| 1468 | { |
| 1469 | if (res >> 26 == ALC880_HP_EVENT) |
| 1470 | alc888_acer_aspire_4930g_automute(codec); |
| 1471 | } |
| 1472 | |
| 1473 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1474 | * ALC880 3-stack model |
| 1475 | * |
| 1476 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1477 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1478 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1479 | */ |
| 1480 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1481 | static hda_nid_t alc880_dac_nids[4] = { |
| 1482 | /* front, rear, clfe, rear_surr */ |
| 1483 | 0x02, 0x05, 0x04, 0x03 |
| 1484 | }; |
| 1485 | |
| 1486 | static hda_nid_t alc880_adc_nids[3] = { |
| 1487 | /* ADC0-2 */ |
| 1488 | 0x07, 0x08, 0x09, |
| 1489 | }; |
| 1490 | |
| 1491 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1492 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1493 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1494 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1495 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1496 | /* ADC1-2 */ |
| 1497 | 0x08, 0x09, |
| 1498 | }; |
| 1499 | |
| 1500 | #define ALC880_DIGOUT_NID 0x06 |
| 1501 | #define ALC880_DIGIN_NID 0x0a |
| 1502 | |
| 1503 | static struct hda_input_mux alc880_capture_source = { |
| 1504 | .num_items = 4, |
| 1505 | .items = { |
| 1506 | { "Mic", 0x0 }, |
| 1507 | { "Front Mic", 0x3 }, |
| 1508 | { "Line", 0x2 }, |
| 1509 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1510 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1511 | }; |
| 1512 | |
| 1513 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1514 | /* 2ch mode */ |
| 1515 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1516 | /* set line-in to input, mute it */ |
| 1517 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1518 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1519 | /* set mic-in to input vref 80%, mute it */ |
| 1520 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1521 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1522 | { } /* end */ |
| 1523 | }; |
| 1524 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1525 | /* 6ch mode */ |
| 1526 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1527 | /* set line-in to output, unmute it */ |
| 1528 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1529 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1530 | /* set mic-in to output, unmute it */ |
| 1531 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1532 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1533 | { } /* end */ |
| 1534 | }; |
| 1535 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1536 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1537 | { 2, alc880_threestack_ch2_init }, |
| 1538 | { 6, alc880_threestack_ch6_init }, |
| 1539 | }; |
| 1540 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1541 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1542 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1543 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1544 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1545 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1546 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1547 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1548 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1549 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1550 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1551 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1552 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1553 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1554 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1555 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1556 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1557 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1558 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1559 | { |
| 1560 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1561 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1562 | .info = alc_ch_mode_info, |
| 1563 | .get = alc_ch_mode_get, |
| 1564 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1565 | }, |
| 1566 | { } /* end */ |
| 1567 | }; |
| 1568 | |
| 1569 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1570 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1571 | struct snd_ctl_elem_info *uinfo) |
| 1572 | { |
| 1573 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1574 | struct alc_spec *spec = codec->spec; |
| 1575 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1576 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1577 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1578 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1579 | HDA_INPUT); |
| 1580 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1581 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1582 | return err; |
| 1583 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1584 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1585 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1586 | unsigned int size, unsigned int __user *tlv) |
| 1587 | { |
| 1588 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1589 | struct alc_spec *spec = codec->spec; |
| 1590 | int err; |
| 1591 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1592 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1593 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1594 | HDA_INPUT); |
| 1595 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1596 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1597 | return err; |
| 1598 | } |
| 1599 | |
| 1600 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1601 | struct snd_ctl_elem_value *ucontrol); |
| 1602 | |
| 1603 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1604 | struct snd_ctl_elem_value *ucontrol, |
| 1605 | getput_call_t func) |
| 1606 | { |
| 1607 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1608 | struct alc_spec *spec = codec->spec; |
| 1609 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1610 | int err; |
| 1611 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1612 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1613 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1614 | 3, 0, HDA_INPUT); |
| 1615 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1616 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1617 | return err; |
| 1618 | } |
| 1619 | |
| 1620 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1621 | struct snd_ctl_elem_value *ucontrol) |
| 1622 | { |
| 1623 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1624 | snd_hda_mixer_amp_volume_get); |
| 1625 | } |
| 1626 | |
| 1627 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1628 | struct snd_ctl_elem_value *ucontrol) |
| 1629 | { |
| 1630 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1631 | snd_hda_mixer_amp_volume_put); |
| 1632 | } |
| 1633 | |
| 1634 | /* capture mixer elements */ |
| 1635 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1636 | |
| 1637 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1638 | struct snd_ctl_elem_value *ucontrol) |
| 1639 | { |
| 1640 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1641 | snd_hda_mixer_amp_switch_get); |
| 1642 | } |
| 1643 | |
| 1644 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1645 | struct snd_ctl_elem_value *ucontrol) |
| 1646 | { |
| 1647 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1648 | snd_hda_mixer_amp_switch_put); |
| 1649 | } |
| 1650 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1651 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1652 | { \ |
| 1653 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1654 | .name = "Capture Switch", \ |
| 1655 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1656 | .count = num, \ |
| 1657 | .info = alc_cap_sw_info, \ |
| 1658 | .get = alc_cap_sw_get, \ |
| 1659 | .put = alc_cap_sw_put, \ |
| 1660 | }, \ |
| 1661 | { \ |
| 1662 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1663 | .name = "Capture Volume", \ |
| 1664 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1665 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1666 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1667 | .count = num, \ |
| 1668 | .info = alc_cap_vol_info, \ |
| 1669 | .get = alc_cap_vol_get, \ |
| 1670 | .put = alc_cap_vol_put, \ |
| 1671 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1672 | } |
| 1673 | |
| 1674 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1675 | { \ |
| 1676 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1677 | /* .name = "Capture Source", */ \ |
| 1678 | .name = "Input Source", \ |
| 1679 | .count = num, \ |
| 1680 | .info = alc_mux_enum_info, \ |
| 1681 | .get = alc_mux_enum_get, \ |
| 1682 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1683 | } |
| 1684 | |
| 1685 | #define DEFINE_CAPMIX(num) \ |
| 1686 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1687 | _DEFINE_CAPMIX(num), \ |
| 1688 | _DEFINE_CAPSRC(num), \ |
| 1689 | { } /* end */ \ |
| 1690 | } |
| 1691 | |
| 1692 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 1693 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 1694 | _DEFINE_CAPMIX(num), \ |
| 1695 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1696 | } |
| 1697 | |
| 1698 | /* up to three ADCs */ |
| 1699 | DEFINE_CAPMIX(1); |
| 1700 | DEFINE_CAPMIX(2); |
| 1701 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1702 | DEFINE_CAPMIX_NOSRC(1); |
| 1703 | DEFINE_CAPMIX_NOSRC(2); |
| 1704 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1705 | |
| 1706 | /* |
| 1707 | * ALC880 5-stack model |
| 1708 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1709 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1710 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1711 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1712 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1713 | */ |
| 1714 | |
| 1715 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1716 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1717 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1718 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1719 | { } /* end */ |
| 1720 | }; |
| 1721 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1722 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1723 | /* 6ch mode */ |
| 1724 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1725 | /* set line-in to input, mute it */ |
| 1726 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1727 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1728 | { } /* end */ |
| 1729 | }; |
| 1730 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1731 | /* 8ch mode */ |
| 1732 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1733 | /* set line-in to output, unmute it */ |
| 1734 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1735 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1736 | { } /* end */ |
| 1737 | }; |
| 1738 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1739 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1740 | { 6, alc880_fivestack_ch6_init }, |
| 1741 | { 8, alc880_fivestack_ch8_init }, |
| 1742 | }; |
| 1743 | |
| 1744 | |
| 1745 | /* |
| 1746 | * ALC880 6-stack model |
| 1747 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1748 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1749 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1750 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1751 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1752 | */ |
| 1753 | |
| 1754 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1755 | /* front, rear, clfe, rear_surr */ |
| 1756 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1757 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1758 | |
| 1759 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1760 | .num_items = 4, |
| 1761 | .items = { |
| 1762 | { "Mic", 0x0 }, |
| 1763 | { "Front Mic", 0x1 }, |
| 1764 | { "Line", 0x2 }, |
| 1765 | { "CD", 0x4 }, |
| 1766 | }, |
| 1767 | }; |
| 1768 | |
| 1769 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1770 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1771 | { 8, NULL }, |
| 1772 | }; |
| 1773 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1774 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1775 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1776 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1777 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1778 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1779 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1780 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1781 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1782 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1783 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1784 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1785 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1786 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1787 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1788 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1789 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1790 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1791 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1792 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1793 | { |
| 1794 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1795 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1796 | .info = alc_ch_mode_info, |
| 1797 | .get = alc_ch_mode_get, |
| 1798 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1799 | }, |
| 1800 | { } /* end */ |
| 1801 | }; |
| 1802 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1803 | |
| 1804 | /* |
| 1805 | * ALC880 W810 model |
| 1806 | * |
| 1807 | * W810 has rear IO for: |
| 1808 | * Front (DAC 02) |
| 1809 | * Surround (DAC 03) |
| 1810 | * Center/LFE (DAC 04) |
| 1811 | * Digital out (06) |
| 1812 | * |
| 1813 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1814 | * 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] | 1815 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1816 | * There is a variable resistor to control the speaker or headphone |
| 1817 | * volume. This is a hardware-only device without a software API. |
| 1818 | * |
| 1819 | * Plugging headphones in will disable the internal speakers. This is |
| 1820 | * implemented in hardware, not via the driver using jack sense. In |
| 1821 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1822 | * disable both the speakers and headphones. |
| 1823 | * |
| 1824 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1825 | * These may not do anything useful with this driver yet, because I |
| 1826 | * haven't setup any initialization verbs for these yet... |
| 1827 | */ |
| 1828 | |
| 1829 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1830 | /* front, rear/surround, clfe */ |
| 1831 | 0x02, 0x03, 0x04 |
| 1832 | }; |
| 1833 | |
| 1834 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1835 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1836 | { 6, NULL } |
| 1837 | }; |
| 1838 | |
| 1839 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1840 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1841 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1842 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1843 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1844 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1845 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1846 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1847 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1848 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1849 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1850 | { } /* end */ |
| 1851 | }; |
| 1852 | |
| 1853 | |
| 1854 | /* |
| 1855 | * Z710V model |
| 1856 | * |
| 1857 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1858 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1859 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1860 | */ |
| 1861 | |
| 1862 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1863 | 0x02 |
| 1864 | }; |
| 1865 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1866 | |
| 1867 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1868 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1869 | { 2, NULL } |
| 1870 | }; |
| 1871 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1872 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1873 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1874 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1875 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1876 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1877 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1878 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1879 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1880 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1881 | { } /* end */ |
| 1882 | }; |
| 1883 | |
| 1884 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1885 | /* |
| 1886 | * ALC880 F1734 model |
| 1887 | * |
| 1888 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1889 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1890 | */ |
| 1891 | |
| 1892 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1893 | 0x03 |
| 1894 | }; |
| 1895 | #define ALC880_F1734_HP_DAC 0x02 |
| 1896 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1897 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1898 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1899 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1900 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1901 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1902 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1903 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1904 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1905 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1906 | { } /* end */ |
| 1907 | }; |
| 1908 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1909 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1910 | .num_items = 2, |
| 1911 | .items = { |
| 1912 | { "Mic", 0x1 }, |
| 1913 | { "CD", 0x4 }, |
| 1914 | }, |
| 1915 | }; |
| 1916 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1917 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1918 | /* |
| 1919 | * ALC880 ASUS model |
| 1920 | * |
| 1921 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1922 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1923 | * Mic = 0x18, Line = 0x1a |
| 1924 | */ |
| 1925 | |
| 1926 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1927 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1928 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1929 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1930 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1931 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1932 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1933 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1934 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1935 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1936 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1937 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1938 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1939 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1940 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1941 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1943 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1944 | { |
| 1945 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1946 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1947 | .info = alc_ch_mode_info, |
| 1948 | .get = alc_ch_mode_get, |
| 1949 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1950 | }, |
| 1951 | { } /* end */ |
| 1952 | }; |
| 1953 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1954 | /* |
| 1955 | * ALC880 ASUS W1V model |
| 1956 | * |
| 1957 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1958 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1959 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1960 | */ |
| 1961 | |
| 1962 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1963 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1964 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1965 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1966 | { } /* end */ |
| 1967 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1968 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1969 | /* TCL S700 */ |
| 1970 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1971 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1972 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1973 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1974 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1975 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1976 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1977 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1978 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1979 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1980 | { } /* end */ |
| 1981 | }; |
| 1982 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1983 | /* Uniwill */ |
| 1984 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1985 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1986 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1987 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1988 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1989 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1990 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1991 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1992 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1993 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1994 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1995 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1996 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1998 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1999 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2000 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2001 | { |
| 2002 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2003 | .name = "Channel Mode", |
| 2004 | .info = alc_ch_mode_info, |
| 2005 | .get = alc_ch_mode_get, |
| 2006 | .put = alc_ch_mode_put, |
| 2007 | }, |
| 2008 | { } /* end */ |
| 2009 | }; |
| 2010 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2011 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2012 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2013 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2014 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2015 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2016 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2017 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2018 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2019 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2020 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2021 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2022 | { } /* end */ |
| 2023 | }; |
| 2024 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2025 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2026 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2027 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2028 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2029 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2030 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2031 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2032 | { } /* end */ |
| 2033 | }; |
| 2034 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2035 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2036 | * virtual master controls |
| 2037 | */ |
| 2038 | |
| 2039 | /* |
| 2040 | * slave controls for virtual master |
| 2041 | */ |
| 2042 | static const char *alc_slave_vols[] = { |
| 2043 | "Front Playback Volume", |
| 2044 | "Surround Playback Volume", |
| 2045 | "Center Playback Volume", |
| 2046 | "LFE Playback Volume", |
| 2047 | "Side Playback Volume", |
| 2048 | "Headphone Playback Volume", |
| 2049 | "Speaker Playback Volume", |
| 2050 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2051 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2052 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2053 | NULL, |
| 2054 | }; |
| 2055 | |
| 2056 | static const char *alc_slave_sws[] = { |
| 2057 | "Front Playback Switch", |
| 2058 | "Surround Playback Switch", |
| 2059 | "Center Playback Switch", |
| 2060 | "LFE Playback Switch", |
| 2061 | "Side Playback Switch", |
| 2062 | "Headphone Playback Switch", |
| 2063 | "Speaker Playback Switch", |
| 2064 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2065 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2066 | NULL, |
| 2067 | }; |
| 2068 | |
| 2069 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2070 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2071 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2072 | |
| 2073 | static void alc_free_kctls(struct hda_codec *codec); |
| 2074 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2075 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2076 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2077 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2078 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2079 | { } /* end */ |
| 2080 | }; |
| 2081 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2082 | static int alc_build_controls(struct hda_codec *codec) |
| 2083 | { |
| 2084 | struct alc_spec *spec = codec->spec; |
| 2085 | int err; |
| 2086 | int i; |
| 2087 | |
| 2088 | for (i = 0; i < spec->num_mixers; i++) { |
| 2089 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2090 | if (err < 0) |
| 2091 | return err; |
| 2092 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2093 | if (spec->cap_mixer) { |
| 2094 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2095 | if (err < 0) |
| 2096 | return err; |
| 2097 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2098 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2099 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2100 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2101 | if (err < 0) |
| 2102 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2103 | if (!spec->no_analog) { |
| 2104 | err = snd_hda_create_spdif_share_sw(codec, |
| 2105 | &spec->multiout); |
| 2106 | if (err < 0) |
| 2107 | return err; |
| 2108 | spec->multiout.share_spdif = 1; |
| 2109 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2110 | } |
| 2111 | if (spec->dig_in_nid) { |
| 2112 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2113 | if (err < 0) |
| 2114 | return err; |
| 2115 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2116 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2117 | /* create beep controls if needed */ |
| 2118 | if (spec->beep_amp) { |
| 2119 | struct snd_kcontrol_new *knew; |
| 2120 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2121 | struct snd_kcontrol *kctl; |
| 2122 | kctl = snd_ctl_new1(knew, codec); |
| 2123 | if (!kctl) |
| 2124 | return -ENOMEM; |
| 2125 | kctl->private_value = spec->beep_amp; |
| 2126 | err = snd_hda_ctl_add(codec, kctl); |
| 2127 | if (err < 0) |
| 2128 | return err; |
| 2129 | } |
| 2130 | } |
| 2131 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2132 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2133 | if (!spec->no_analog && |
| 2134 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2135 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2136 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2137 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2138 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2139 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2140 | if (err < 0) |
| 2141 | return err; |
| 2142 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2143 | if (!spec->no_analog && |
| 2144 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2145 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2146 | NULL, alc_slave_sws); |
| 2147 | if (err < 0) |
| 2148 | return err; |
| 2149 | } |
| 2150 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2151 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2152 | return 0; |
| 2153 | } |
| 2154 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2155 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2156 | /* |
| 2157 | * initialize the codec volumes, etc |
| 2158 | */ |
| 2159 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2160 | /* |
| 2161 | * generic initialization of ADC, input mixers and output mixers |
| 2162 | */ |
| 2163 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2164 | /* |
| 2165 | * Unmute ADC0-2 and set the default input to mic-in |
| 2166 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2167 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2168 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2169 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2170 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2171 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2172 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2173 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2174 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2175 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2176 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2177 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2178 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2179 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2180 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2181 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2182 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2183 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2184 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2185 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2186 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2187 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2188 | /* |
| 2189 | * Set up output mixers (0x0c - 0x0f) |
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 | /* set vol=0 to output mixers */ |
| 2192 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2193 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2194 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2195 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2196 | /* set up input amps for analog loopback */ |
| 2197 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2198 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2199 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2200 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2201 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2202 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2203 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2204 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2205 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2206 | |
| 2207 | { } |
| 2208 | }; |
| 2209 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2210 | /* |
| 2211 | * 3-stack pin configuration: |
| 2212 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2213 | */ |
| 2214 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2215 | /* |
| 2216 | * preset connection lists of input pins |
| 2217 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2218 | */ |
| 2219 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2220 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2221 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2222 | |
| 2223 | /* |
| 2224 | * Set pin mode and muting |
| 2225 | */ |
| 2226 | /* set front pin widgets 0x14 for output */ |
| 2227 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2228 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2229 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2230 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2231 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2232 | /* Mic2 (as headphone out) for HP output */ |
| 2233 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2234 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2235 | /* Line In pin widget for input */ |
| 2236 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2237 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2238 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2239 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2240 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2241 | /* CD pin widget for input */ |
| 2242 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2243 | |
| 2244 | { } |
| 2245 | }; |
| 2246 | |
| 2247 | /* |
| 2248 | * 5-stack pin configuration: |
| 2249 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2250 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2251 | */ |
| 2252 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2253 | /* |
| 2254 | * preset connection lists of input pins |
| 2255 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2256 | */ |
| 2257 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2258 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2259 | |
| 2260 | /* |
| 2261 | * Set pin mode and muting |
| 2262 | */ |
| 2263 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2264 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2265 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2266 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2267 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2268 | /* unmute pins for output (no gain on this amp) */ |
| 2269 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2270 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2271 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2272 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2273 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2274 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2275 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2276 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2277 | /* Mic2 (as headphone out) for HP output */ |
| 2278 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2279 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2280 | /* Line In pin widget for input */ |
| 2281 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2282 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2283 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2284 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2285 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2286 | /* CD pin widget for input */ |
| 2287 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2288 | |
| 2289 | { } |
| 2290 | }; |
| 2291 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2292 | /* |
| 2293 | * W810 pin configuration: |
| 2294 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2295 | */ |
| 2296 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2297 | /* hphone/speaker input selector: front DAC */ |
| 2298 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2299 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2300 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2301 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2302 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2303 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2304 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2305 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2306 | |
| 2307 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2308 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2309 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2310 | { } |
| 2311 | }; |
| 2312 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2313 | /* |
| 2314 | * Z71V pin configuration: |
| 2315 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2316 | */ |
| 2317 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2318 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2319 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2320 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2321 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2322 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2323 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2324 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2325 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2326 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2327 | |
| 2328 | { } |
| 2329 | }; |
| 2330 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2331 | /* |
| 2332 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2333 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2334 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2335 | */ |
| 2336 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2337 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2338 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2339 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2340 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2341 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2342 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2343 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2344 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2345 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2346 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2347 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2348 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2349 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2350 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2351 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2352 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2353 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2354 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2355 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2356 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2357 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2358 | { } |
| 2359 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2360 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2361 | /* |
| 2362 | * Uniwill pin configuration: |
| 2363 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2364 | * line = 0x1a |
| 2365 | */ |
| 2366 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2367 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2368 | |
| 2369 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2370 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2371 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2372 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2373 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2374 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2375 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2376 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2377 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2378 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2379 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2380 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2381 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2382 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2383 | |
| 2384 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2385 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2386 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2387 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2388 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2389 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2390 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2391 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2392 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2393 | |
| 2394 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2395 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2396 | |
| 2397 | { } |
| 2398 | }; |
| 2399 | |
| 2400 | /* |
| 2401 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2402 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2403 | */ |
| 2404 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2405 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2406 | |
| 2407 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2408 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2409 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2410 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2411 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2412 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2413 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2414 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2415 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2416 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2417 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2418 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2419 | |
| 2420 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2421 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2422 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2423 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2424 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2425 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2426 | |
| 2427 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2428 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2429 | |
| 2430 | { } |
| 2431 | }; |
| 2432 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2433 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2434 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2435 | { } |
| 2436 | }; |
| 2437 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2438 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2439 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2440 | { |
| 2441 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2442 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2443 | |
| 2444 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2445 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2446 | bits = present ? HDA_AMP_MUTE : 0; |
| 2447 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 2448 | HDA_AMP_MUTE, bits); |
| 2449 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 2450 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2451 | } |
| 2452 | |
| 2453 | /* auto-toggle front mic */ |
| 2454 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2455 | { |
| 2456 | unsigned int present; |
| 2457 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2458 | |
| 2459 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2460 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2461 | bits = present ? HDA_AMP_MUTE : 0; |
| 2462 | 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] | 2463 | } |
| 2464 | |
| 2465 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 2466 | { |
| 2467 | alc880_uniwill_hp_automute(codec); |
| 2468 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2469 | } |
| 2470 | |
| 2471 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2472 | unsigned int res) |
| 2473 | { |
| 2474 | /* Looks like the unsol event is incompatible with the standard |
| 2475 | * definition. 4bit tag is placed at 28 bit! |
| 2476 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2477 | switch (res >> 28) { |
| 2478 | case ALC880_HP_EVENT: |
| 2479 | alc880_uniwill_hp_automute(codec); |
| 2480 | break; |
| 2481 | case ALC880_MIC_EVENT: |
| 2482 | alc880_uniwill_mic_automute(codec); |
| 2483 | break; |
| 2484 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2485 | } |
| 2486 | |
| 2487 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 2488 | { |
| 2489 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2490 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2491 | |
| 2492 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2493 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2494 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 2495 | 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] | 2496 | } |
| 2497 | |
| 2498 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2499 | { |
| 2500 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2501 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2502 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2503 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2504 | present &= HDA_AMP_VOLMASK; |
| 2505 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2506 | HDA_AMP_VOLMASK, present); |
| 2507 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2508 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2509 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2510 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2511 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2512 | unsigned int res) |
| 2513 | { |
| 2514 | /* Looks like the unsol event is incompatible with the standard |
| 2515 | * definition. 4bit tag is placed at 28 bit! |
| 2516 | */ |
| 2517 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2518 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2519 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2520 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2521 | } |
| 2522 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2523 | /* |
| 2524 | * F1734 pin configuration: |
| 2525 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2526 | */ |
| 2527 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2528 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2529 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2530 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2531 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2532 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2533 | |
| 2534 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2535 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2536 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2537 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2538 | |
| 2539 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2540 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2541 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2542 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2543 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2544 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2545 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2546 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2547 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2548 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2549 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2550 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2551 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2552 | { } |
| 2553 | }; |
| 2554 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2555 | /* |
| 2556 | * ASUS pin configuration: |
| 2557 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2558 | */ |
| 2559 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2560 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2561 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2562 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2563 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2564 | |
| 2565 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2566 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2567 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2568 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2569 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2570 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2571 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2572 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2573 | |
| 2574 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2575 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2576 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2577 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2578 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2579 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2580 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2581 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2582 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2583 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2584 | { } |
| 2585 | }; |
| 2586 | |
| 2587 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2588 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2589 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2590 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2591 | /* Clevo m520g init */ |
| 2592 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2593 | /* headphone output */ |
| 2594 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2595 | /* line-out */ |
| 2596 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2597 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2598 | /* Line-in */ |
| 2599 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2600 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2601 | /* CD */ |
| 2602 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2603 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2604 | /* Mic1 (rear panel) */ |
| 2605 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2606 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2607 | /* Mic2 (front panel) */ |
| 2608 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2609 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2610 | /* headphone */ |
| 2611 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2612 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2613 | /* change to EAPD mode */ |
| 2614 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2615 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2616 | |
| 2617 | { } |
| 2618 | }; |
| 2619 | |
| 2620 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2621 | /* change to EAPD mode */ |
| 2622 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2623 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2624 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2625 | /* Headphone output */ |
| 2626 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2627 | /* Front output*/ |
| 2628 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2629 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2630 | |
| 2631 | /* Line In pin widget for input */ |
| 2632 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2633 | /* CD pin widget for input */ |
| 2634 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2635 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2636 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2637 | |
| 2638 | /* change to EAPD mode */ |
| 2639 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2640 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2641 | |
| 2642 | { } |
| 2643 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2644 | |
| 2645 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2646 | * LG m1 express dual |
| 2647 | * |
| 2648 | * Pin assignment: |
| 2649 | * Rear Line-In/Out (blue): 0x14 |
| 2650 | * Build-in Mic-In: 0x15 |
| 2651 | * Speaker-out: 0x17 |
| 2652 | * HP-Out (green): 0x1b |
| 2653 | * Mic-In/Out (red): 0x19 |
| 2654 | * SPDIF-Out: 0x1e |
| 2655 | */ |
| 2656 | |
| 2657 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2658 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2659 | 0x05, 0x02, 0x03 |
| 2660 | }; |
| 2661 | |
| 2662 | /* seems analog CD is not working */ |
| 2663 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2664 | .num_items = 3, |
| 2665 | .items = { |
| 2666 | { "Mic", 0x1 }, |
| 2667 | { "Line", 0x5 }, |
| 2668 | { "Internal Mic", 0x6 }, |
| 2669 | }, |
| 2670 | }; |
| 2671 | |
| 2672 | /* 2,4,6 channel modes */ |
| 2673 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2674 | /* set line-in and mic-in to input */ |
| 2675 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2676 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2677 | { } |
| 2678 | }; |
| 2679 | |
| 2680 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2681 | /* set line-in to out and mic-in to input */ |
| 2682 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2683 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2684 | { } |
| 2685 | }; |
| 2686 | |
| 2687 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2688 | /* set line-in and mic-in to output */ |
| 2689 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2690 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2691 | { } |
| 2692 | }; |
| 2693 | |
| 2694 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2695 | { 2, alc880_lg_ch2_init }, |
| 2696 | { 4, alc880_lg_ch4_init }, |
| 2697 | { 6, alc880_lg_ch6_init }, |
| 2698 | }; |
| 2699 | |
| 2700 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2701 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2702 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2703 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2704 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2705 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2706 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2707 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2708 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2709 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2710 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2711 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2712 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2713 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2714 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2715 | { |
| 2716 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2717 | .name = "Channel Mode", |
| 2718 | .info = alc_ch_mode_info, |
| 2719 | .get = alc_ch_mode_get, |
| 2720 | .put = alc_ch_mode_put, |
| 2721 | }, |
| 2722 | { } /* end */ |
| 2723 | }; |
| 2724 | |
| 2725 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2726 | /* set capture source to mic-in */ |
| 2727 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2728 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2729 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2730 | /* mute all amp mixer inputs */ |
| 2731 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2732 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2733 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2734 | /* line-in to input */ |
| 2735 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2736 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2737 | /* built-in mic */ |
| 2738 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2739 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2740 | /* speaker-out */ |
| 2741 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2742 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2743 | /* mic-in to input */ |
| 2744 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2745 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2746 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2747 | /* HP-out */ |
| 2748 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2749 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2750 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2751 | /* jack sense */ |
| 2752 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2753 | { } |
| 2754 | }; |
| 2755 | |
| 2756 | /* toggle speaker-output according to the hp-jack state */ |
| 2757 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2758 | { |
| 2759 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2760 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2761 | |
| 2762 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2763 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2764 | bits = present ? HDA_AMP_MUTE : 0; |
| 2765 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2766 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2767 | } |
| 2768 | |
| 2769 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2770 | { |
| 2771 | /* Looks like the unsol event is incompatible with the standard |
| 2772 | * definition. 4bit tag is placed at 28 bit! |
| 2773 | */ |
| 2774 | if ((res >> 28) == 0x01) |
| 2775 | alc880_lg_automute(codec); |
| 2776 | } |
| 2777 | |
| 2778 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2779 | * LG LW20 |
| 2780 | * |
| 2781 | * Pin assignment: |
| 2782 | * Speaker-out: 0x14 |
| 2783 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2784 | * Built-in Mic-In: 0x19 |
| 2785 | * Line-In: 0x1b |
| 2786 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2787 | * SPDIF-Out: 0x1e |
| 2788 | */ |
| 2789 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2790 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2791 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2792 | .items = { |
| 2793 | { "Mic", 0x0 }, |
| 2794 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2795 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2796 | }, |
| 2797 | }; |
| 2798 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2799 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2800 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2801 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2802 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2803 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2804 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2805 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2806 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2807 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2808 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2809 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2810 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2811 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2812 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2813 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2814 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2815 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2816 | { |
| 2817 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2818 | .name = "Channel Mode", |
| 2819 | .info = alc_ch_mode_info, |
| 2820 | .get = alc_ch_mode_get, |
| 2821 | .put = alc_ch_mode_put, |
| 2822 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2823 | { } /* end */ |
| 2824 | }; |
| 2825 | |
| 2826 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2827 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2828 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2829 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2830 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2831 | /* set capture source to mic-in */ |
| 2832 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2833 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2834 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2835 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2836 | /* speaker-out */ |
| 2837 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2838 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2839 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2840 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2841 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2842 | /* mic-in to input */ |
| 2843 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2844 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2845 | /* built-in mic */ |
| 2846 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2847 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2848 | /* jack sense */ |
| 2849 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2850 | { } |
| 2851 | }; |
| 2852 | |
| 2853 | /* toggle speaker-output according to the hp-jack state */ |
| 2854 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2855 | { |
| 2856 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2857 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2858 | |
| 2859 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2860 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2861 | bits = present ? HDA_AMP_MUTE : 0; |
| 2862 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2863 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2864 | } |
| 2865 | |
| 2866 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2867 | { |
| 2868 | /* Looks like the unsol event is incompatible with the standard |
| 2869 | * definition. 4bit tag is placed at 28 bit! |
| 2870 | */ |
| 2871 | if ((res >> 28) == 0x01) |
| 2872 | alc880_lg_lw_automute(codec); |
| 2873 | } |
| 2874 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2875 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2876 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2877 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2880 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2881 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2882 | { } /* end */ |
| 2883 | }; |
| 2884 | |
| 2885 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2886 | .num_items = 2, |
| 2887 | .items = { |
| 2888 | { "Mic", 0x0 }, |
| 2889 | { "Internal Mic", 0x1 }, |
| 2890 | }, |
| 2891 | }; |
| 2892 | |
| 2893 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2894 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2895 | |
| 2896 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2897 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2898 | |
| 2899 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2900 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2901 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2902 | /* Mic2 (as headphone out) for HP output */ |
| 2903 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2904 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2905 | /* Internal Speaker */ |
| 2906 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2907 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2908 | |
| 2909 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2910 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2911 | |
| 2912 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2913 | { } |
| 2914 | }; |
| 2915 | |
| 2916 | /* toggle speaker-output according to the hp-jack state */ |
| 2917 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2918 | { |
| 2919 | unsigned int present; |
| 2920 | unsigned char bits; |
| 2921 | |
| 2922 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2923 | AC_VERB_GET_PIN_SENSE, 0) |
| 2924 | & AC_PINSENSE_PRESENCE; |
| 2925 | bits = present ? HDA_AMP_MUTE : 0; |
| 2926 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2927 | HDA_AMP_MUTE, bits); |
| 2928 | if (present) |
| 2929 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2930 | else |
| 2931 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2932 | } |
| 2933 | |
| 2934 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2935 | unsigned int res) |
| 2936 | { |
| 2937 | /* Looks like the unsol event is incompatible with the standard |
| 2938 | * definition. 4bit tag is placed at 28 bit! |
| 2939 | */ |
| 2940 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2941 | alc880_medion_rim_automute(codec); |
| 2942 | } |
| 2943 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2944 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2945 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2946 | { 0x0b, HDA_INPUT, 0 }, |
| 2947 | { 0x0b, HDA_INPUT, 1 }, |
| 2948 | { 0x0b, HDA_INPUT, 2 }, |
| 2949 | { 0x0b, HDA_INPUT, 3 }, |
| 2950 | { 0x0b, HDA_INPUT, 4 }, |
| 2951 | { } /* end */ |
| 2952 | }; |
| 2953 | |
| 2954 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2955 | { 0x0b, HDA_INPUT, 1 }, |
| 2956 | { 0x0b, HDA_INPUT, 6 }, |
| 2957 | { 0x0b, HDA_INPUT, 7 }, |
| 2958 | { } /* end */ |
| 2959 | }; |
| 2960 | #endif |
| 2961 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2962 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2963 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2964 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2965 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2966 | static int alc_init(struct hda_codec *codec) |
| 2967 | { |
| 2968 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2969 | unsigned int i; |
| 2970 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2971 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame^] | 2972 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2973 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2974 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2975 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2976 | |
| 2977 | if (spec->init_hook) |
| 2978 | spec->init_hook(codec); |
| 2979 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2980 | return 0; |
| 2981 | } |
| 2982 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2983 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2984 | { |
| 2985 | struct alc_spec *spec = codec->spec; |
| 2986 | |
| 2987 | if (spec->unsol_event) |
| 2988 | spec->unsol_event(codec, res); |
| 2989 | } |
| 2990 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2991 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2992 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2993 | { |
| 2994 | struct alc_spec *spec = codec->spec; |
| 2995 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2996 | } |
| 2997 | #endif |
| 2998 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2999 | /* |
| 3000 | * Analog playback callbacks |
| 3001 | */ |
| 3002 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3003 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3004 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3005 | { |
| 3006 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3007 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3008 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3009 | } |
| 3010 | |
| 3011 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3012 | struct hda_codec *codec, |
| 3013 | unsigned int stream_tag, |
| 3014 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3015 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3016 | { |
| 3017 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3018 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3019 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3020 | } |
| 3021 | |
| 3022 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3023 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3024 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3025 | { |
| 3026 | struct alc_spec *spec = codec->spec; |
| 3027 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3028 | } |
| 3029 | |
| 3030 | /* |
| 3031 | * Digital out |
| 3032 | */ |
| 3033 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3034 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3035 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3036 | { |
| 3037 | struct alc_spec *spec = codec->spec; |
| 3038 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3039 | } |
| 3040 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3041 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3042 | struct hda_codec *codec, |
| 3043 | unsigned int stream_tag, |
| 3044 | unsigned int format, |
| 3045 | struct snd_pcm_substream *substream) |
| 3046 | { |
| 3047 | struct alc_spec *spec = codec->spec; |
| 3048 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3049 | stream_tag, format, substream); |
| 3050 | } |
| 3051 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3052 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3053 | struct hda_codec *codec, |
| 3054 | struct snd_pcm_substream *substream) |
| 3055 | { |
| 3056 | struct alc_spec *spec = codec->spec; |
| 3057 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3058 | } |
| 3059 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3060 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3061 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3062 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3063 | { |
| 3064 | struct alc_spec *spec = codec->spec; |
| 3065 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3066 | } |
| 3067 | |
| 3068 | /* |
| 3069 | * Analog capture |
| 3070 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3071 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3072 | struct hda_codec *codec, |
| 3073 | unsigned int stream_tag, |
| 3074 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3075 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3076 | { |
| 3077 | struct alc_spec *spec = codec->spec; |
| 3078 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3079 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3080 | stream_tag, 0, format); |
| 3081 | return 0; |
| 3082 | } |
| 3083 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3084 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3085 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3086 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3087 | { |
| 3088 | struct alc_spec *spec = codec->spec; |
| 3089 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3090 | snd_hda_codec_cleanup_stream(codec, |
| 3091 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3092 | return 0; |
| 3093 | } |
| 3094 | |
| 3095 | |
| 3096 | /* |
| 3097 | */ |
| 3098 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3099 | .substreams = 1, |
| 3100 | .channels_min = 2, |
| 3101 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3102 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3103 | .ops = { |
| 3104 | .open = alc880_playback_pcm_open, |
| 3105 | .prepare = alc880_playback_pcm_prepare, |
| 3106 | .cleanup = alc880_playback_pcm_cleanup |
| 3107 | }, |
| 3108 | }; |
| 3109 | |
| 3110 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3111 | .substreams = 1, |
| 3112 | .channels_min = 2, |
| 3113 | .channels_max = 2, |
| 3114 | /* NID is set in alc_build_pcms */ |
| 3115 | }; |
| 3116 | |
| 3117 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3118 | .substreams = 1, |
| 3119 | .channels_min = 2, |
| 3120 | .channels_max = 2, |
| 3121 | /* NID is set in alc_build_pcms */ |
| 3122 | }; |
| 3123 | |
| 3124 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3125 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3126 | .channels_min = 2, |
| 3127 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3128 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3129 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3130 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3131 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3132 | }, |
| 3133 | }; |
| 3134 | |
| 3135 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3136 | .substreams = 1, |
| 3137 | .channels_min = 2, |
| 3138 | .channels_max = 2, |
| 3139 | /* NID is set in alc_build_pcms */ |
| 3140 | .ops = { |
| 3141 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3142 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3143 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3144 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3145 | }, |
| 3146 | }; |
| 3147 | |
| 3148 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3149 | .substreams = 1, |
| 3150 | .channels_min = 2, |
| 3151 | .channels_max = 2, |
| 3152 | /* NID is set in alc_build_pcms */ |
| 3153 | }; |
| 3154 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3155 | /* 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] | 3156 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3157 | .substreams = 0, |
| 3158 | .channels_min = 0, |
| 3159 | .channels_max = 0, |
| 3160 | }; |
| 3161 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3162 | static int alc_build_pcms(struct hda_codec *codec) |
| 3163 | { |
| 3164 | struct alc_spec *spec = codec->spec; |
| 3165 | struct hda_pcm *info = spec->pcm_rec; |
| 3166 | int i; |
| 3167 | |
| 3168 | codec->num_pcms = 1; |
| 3169 | codec->pcm_info = info; |
| 3170 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3171 | if (spec->no_analog) |
| 3172 | goto skip_analog; |
| 3173 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3174 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3175 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3176 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3177 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3178 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3179 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3180 | } |
| 3181 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3182 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3183 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3184 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3185 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3186 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3187 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3188 | if (spec->channel_mode) { |
| 3189 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3190 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3191 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3192 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3193 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3194 | } |
| 3195 | } |
| 3196 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3197 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3198 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3199 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3200 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3201 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3202 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3203 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3204 | if (spec->dig_out_type) |
| 3205 | info->pcm_type = spec->dig_out_type; |
| 3206 | else |
| 3207 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3208 | if (spec->multiout.dig_out_nid && |
| 3209 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3210 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3211 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3212 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3213 | if (spec->dig_in_nid && |
| 3214 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3215 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3216 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3217 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3218 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3219 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3220 | } |
| 3221 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3222 | if (spec->no_analog) |
| 3223 | return 0; |
| 3224 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3225 | /* If the use of more than one ADC is requested for the current |
| 3226 | * model, configure a second analog capture-only PCM. |
| 3227 | */ |
| 3228 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3229 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3230 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3231 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3232 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3233 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3234 | if (spec->alt_dac_nid) { |
| 3235 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3236 | *spec->stream_analog_alt_playback; |
| 3237 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3238 | spec->alt_dac_nid; |
| 3239 | } else { |
| 3240 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3241 | alc_pcm_null_stream; |
| 3242 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3243 | } |
| 3244 | if (spec->num_adc_nids > 1) { |
| 3245 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3246 | *spec->stream_analog_alt_capture; |
| 3247 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3248 | spec->adc_nids[1]; |
| 3249 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3250 | spec->num_adc_nids - 1; |
| 3251 | } else { |
| 3252 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3253 | alc_pcm_null_stream; |
| 3254 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3255 | } |
| 3256 | } |
| 3257 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3258 | return 0; |
| 3259 | } |
| 3260 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3261 | static void alc_free_kctls(struct hda_codec *codec) |
| 3262 | { |
| 3263 | struct alc_spec *spec = codec->spec; |
| 3264 | |
| 3265 | if (spec->kctls.list) { |
| 3266 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3267 | int i; |
| 3268 | for (i = 0; i < spec->kctls.used; i++) |
| 3269 | kfree(kctl[i].name); |
| 3270 | } |
| 3271 | snd_array_free(&spec->kctls); |
| 3272 | } |
| 3273 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3274 | static void alc_free(struct hda_codec *codec) |
| 3275 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3276 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3277 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3278 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3279 | return; |
| 3280 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3281 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3282 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3283 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3284 | } |
| 3285 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3286 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3287 | static int alc_resume(struct hda_codec *codec) |
| 3288 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3289 | codec->patch_ops.init(codec); |
| 3290 | snd_hda_codec_resume_amp(codec); |
| 3291 | snd_hda_codec_resume_cache(codec); |
| 3292 | return 0; |
| 3293 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3294 | #endif |
| 3295 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3296 | /* |
| 3297 | */ |
| 3298 | static struct hda_codec_ops alc_patch_ops = { |
| 3299 | .build_controls = alc_build_controls, |
| 3300 | .build_pcms = alc_build_pcms, |
| 3301 | .init = alc_init, |
| 3302 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3303 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3304 | #ifdef SND_HDA_NEEDS_RESUME |
| 3305 | .resume = alc_resume, |
| 3306 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3307 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3308 | .check_power_status = alc_check_power_status, |
| 3309 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3310 | }; |
| 3311 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3312 | |
| 3313 | /* |
| 3314 | * Test configuration for debugging |
| 3315 | * |
| 3316 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3317 | * enum controls. |
| 3318 | */ |
| 3319 | #ifdef CONFIG_SND_DEBUG |
| 3320 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3321 | 0x02, 0x03, 0x04, 0x05 |
| 3322 | }; |
| 3323 | |
| 3324 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3325 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3326 | .items = { |
| 3327 | { "In-1", 0x0 }, |
| 3328 | { "In-2", 0x1 }, |
| 3329 | { "In-3", 0x2 }, |
| 3330 | { "In-4", 0x3 }, |
| 3331 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3332 | { "Front", 0x5 }, |
| 3333 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3334 | }, |
| 3335 | }; |
| 3336 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3337 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3338 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3339 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3340 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3341 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3342 | }; |
| 3343 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3344 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3345 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3346 | { |
| 3347 | static char *texts[] = { |
| 3348 | "N/A", "Line Out", "HP Out", |
| 3349 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3350 | }; |
| 3351 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3352 | uinfo->count = 1; |
| 3353 | uinfo->value.enumerated.items = 8; |
| 3354 | if (uinfo->value.enumerated.item >= 8) |
| 3355 | uinfo->value.enumerated.item = 7; |
| 3356 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3357 | return 0; |
| 3358 | } |
| 3359 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3360 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3361 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3362 | { |
| 3363 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3364 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3365 | unsigned int pin_ctl, item = 0; |
| 3366 | |
| 3367 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3368 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3369 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3370 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3371 | item = 2; |
| 3372 | else |
| 3373 | item = 1; |
| 3374 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3375 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3376 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3377 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3378 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3379 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3380 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3381 | } |
| 3382 | } |
| 3383 | ucontrol->value.enumerated.item[0] = item; |
| 3384 | return 0; |
| 3385 | } |
| 3386 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3387 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3388 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3389 | { |
| 3390 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3391 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3392 | static unsigned int ctls[] = { |
| 3393 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3394 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3395 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3396 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3397 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3398 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3399 | }; |
| 3400 | unsigned int old_ctl, new_ctl; |
| 3401 | |
| 3402 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3403 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3404 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3405 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3406 | int val; |
| 3407 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3408 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3409 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3410 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3411 | HDA_AMP_MUTE : 0; |
| 3412 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3413 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3414 | return 1; |
| 3415 | } |
| 3416 | return 0; |
| 3417 | } |
| 3418 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3419 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3420 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3421 | { |
| 3422 | static char *texts[] = { |
| 3423 | "Front", "Surround", "CLFE", "Side" |
| 3424 | }; |
| 3425 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3426 | uinfo->count = 1; |
| 3427 | uinfo->value.enumerated.items = 4; |
| 3428 | if (uinfo->value.enumerated.item >= 4) |
| 3429 | uinfo->value.enumerated.item = 3; |
| 3430 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3431 | return 0; |
| 3432 | } |
| 3433 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3434 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3435 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3436 | { |
| 3437 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3438 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3439 | unsigned int sel; |
| 3440 | |
| 3441 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3442 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3443 | return 0; |
| 3444 | } |
| 3445 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3446 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3447 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3448 | { |
| 3449 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3450 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3451 | unsigned int sel; |
| 3452 | |
| 3453 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3454 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3455 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3456 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3457 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3458 | return 1; |
| 3459 | } |
| 3460 | return 0; |
| 3461 | } |
| 3462 | |
| 3463 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3464 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3465 | .name = xname, \ |
| 3466 | .info = alc_test_pin_ctl_info, \ |
| 3467 | .get = alc_test_pin_ctl_get, \ |
| 3468 | .put = alc_test_pin_ctl_put, \ |
| 3469 | .private_value = nid \ |
| 3470 | } |
| 3471 | |
| 3472 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3473 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3474 | .name = xname, \ |
| 3475 | .info = alc_test_pin_src_info, \ |
| 3476 | .get = alc_test_pin_src_get, \ |
| 3477 | .put = alc_test_pin_src_put, \ |
| 3478 | .private_value = nid \ |
| 3479 | } |
| 3480 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3481 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3482 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3483 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3484 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3485 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3486 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3487 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3488 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3489 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3490 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3491 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3492 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3493 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3494 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3495 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3496 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3497 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3498 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3499 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3500 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3501 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3502 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3503 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3504 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3505 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3506 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3507 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3508 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3509 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3510 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3511 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3512 | { |
| 3513 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3514 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3515 | .info = alc_ch_mode_info, |
| 3516 | .get = alc_ch_mode_get, |
| 3517 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3518 | }, |
| 3519 | { } /* end */ |
| 3520 | }; |
| 3521 | |
| 3522 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3523 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3524 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3525 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3526 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3527 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3528 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3529 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3530 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3531 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3532 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3533 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3534 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3535 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3536 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3537 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3538 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3539 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3540 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3541 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3542 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3543 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3544 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3545 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3546 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3547 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3548 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3549 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3550 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3551 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3552 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3553 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3554 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3555 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3556 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3557 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3558 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3559 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3560 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3561 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3562 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3563 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3564 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3565 | /* Analog input/passthru */ |
| 3566 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3567 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3569 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3570 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3571 | { } |
| 3572 | }; |
| 3573 | #endif |
| 3574 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3575 | /* |
| 3576 | */ |
| 3577 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3578 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3579 | [ALC880_3ST] = "3stack", |
| 3580 | [ALC880_TCL_S700] = "tcl", |
| 3581 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3582 | [ALC880_CLEVO] = "clevo", |
| 3583 | [ALC880_5ST] = "5stack", |
| 3584 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3585 | [ALC880_W810] = "w810", |
| 3586 | [ALC880_Z71V] = "z71v", |
| 3587 | [ALC880_6ST] = "6stack", |
| 3588 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3589 | [ALC880_ASUS] = "asus", |
| 3590 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3591 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3592 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3593 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3594 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3595 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3596 | [ALC880_F1734] = "F1734", |
| 3597 | [ALC880_LG] = "lg", |
| 3598 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3599 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3600 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3601 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3602 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3603 | [ALC880_AUTO] = "auto", |
| 3604 | }; |
| 3605 | |
| 3606 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3607 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3608 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3609 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3610 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3611 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3612 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3613 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3614 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3615 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3616 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3617 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3618 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3619 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3620 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3621 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3622 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3623 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3624 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3625 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3626 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3627 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3628 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3629 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3630 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3631 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3632 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3633 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3634 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3635 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3636 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3637 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3638 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3639 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3640 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3641 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3642 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3643 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3644 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3645 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3646 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3647 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3648 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3649 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3650 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3651 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3652 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3653 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3654 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3655 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3656 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3657 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3658 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3659 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3660 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3661 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3662 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3663 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3664 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3665 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3666 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3667 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3668 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3669 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3670 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3671 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3672 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3673 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3674 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3675 | /* default Intel */ |
| 3676 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3677 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3678 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3679 | {} |
| 3680 | }; |
| 3681 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3682 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3683 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3684 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3685 | static struct alc_config_preset alc880_presets[] = { |
| 3686 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3687 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3688 | .init_verbs = { alc880_volume_init_verbs, |
| 3689 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3690 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3691 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3692 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3693 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3694 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3695 | .input_mux = &alc880_capture_source, |
| 3696 | }, |
| 3697 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3698 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3699 | .init_verbs = { alc880_volume_init_verbs, |
| 3700 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3701 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3702 | .dac_nids = alc880_dac_nids, |
| 3703 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3704 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3705 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3706 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3707 | .input_mux = &alc880_capture_source, |
| 3708 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3709 | [ALC880_TCL_S700] = { |
| 3710 | .mixers = { alc880_tcl_s700_mixer }, |
| 3711 | .init_verbs = { alc880_volume_init_verbs, |
| 3712 | alc880_pin_tcl_S700_init_verbs, |
| 3713 | alc880_gpio2_init_verbs }, |
| 3714 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3715 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3716 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3717 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3718 | .hp_nid = 0x03, |
| 3719 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3720 | .channel_mode = alc880_2_jack_modes, |
| 3721 | .input_mux = &alc880_capture_source, |
| 3722 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3723 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3724 | .mixers = { alc880_three_stack_mixer, |
| 3725 | alc880_five_stack_mixer}, |
| 3726 | .init_verbs = { alc880_volume_init_verbs, |
| 3727 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3728 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3729 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3730 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3731 | .channel_mode = alc880_fivestack_modes, |
| 3732 | .input_mux = &alc880_capture_source, |
| 3733 | }, |
| 3734 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3735 | .mixers = { alc880_three_stack_mixer, |
| 3736 | alc880_five_stack_mixer }, |
| 3737 | .init_verbs = { alc880_volume_init_verbs, |
| 3738 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3739 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3740 | .dac_nids = alc880_dac_nids, |
| 3741 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3742 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3743 | .channel_mode = alc880_fivestack_modes, |
| 3744 | .input_mux = &alc880_capture_source, |
| 3745 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3746 | [ALC880_6ST] = { |
| 3747 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3748 | .init_verbs = { alc880_volume_init_verbs, |
| 3749 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3750 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3751 | .dac_nids = alc880_6st_dac_nids, |
| 3752 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3753 | .channel_mode = alc880_sixstack_modes, |
| 3754 | .input_mux = &alc880_6stack_capture_source, |
| 3755 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3756 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3757 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3758 | .init_verbs = { alc880_volume_init_verbs, |
| 3759 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3760 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3761 | .dac_nids = alc880_6st_dac_nids, |
| 3762 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3763 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3764 | .channel_mode = alc880_sixstack_modes, |
| 3765 | .input_mux = &alc880_6stack_capture_source, |
| 3766 | }, |
| 3767 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3768 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3769 | .init_verbs = { alc880_volume_init_verbs, |
| 3770 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3771 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3772 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3773 | .dac_nids = alc880_w810_dac_nids, |
| 3774 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3775 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3776 | .channel_mode = alc880_w810_modes, |
| 3777 | .input_mux = &alc880_capture_source, |
| 3778 | }, |
| 3779 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3780 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3781 | .init_verbs = { alc880_volume_init_verbs, |
| 3782 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3783 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3784 | .dac_nids = alc880_z71v_dac_nids, |
| 3785 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3786 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3787 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3788 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3789 | .input_mux = &alc880_capture_source, |
| 3790 | }, |
| 3791 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3792 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3793 | .init_verbs = { alc880_volume_init_verbs, |
| 3794 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3795 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3796 | .dac_nids = alc880_f1734_dac_nids, |
| 3797 | .hp_nid = 0x02, |
| 3798 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3799 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3800 | .input_mux = &alc880_f1734_capture_source, |
| 3801 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3802 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3803 | }, |
| 3804 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3805 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3806 | .init_verbs = { alc880_volume_init_verbs, |
| 3807 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3808 | alc880_gpio1_init_verbs }, |
| 3809 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3810 | .dac_nids = alc880_asus_dac_nids, |
| 3811 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3812 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3813 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3814 | .input_mux = &alc880_capture_source, |
| 3815 | }, |
| 3816 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3817 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3818 | .init_verbs = { alc880_volume_init_verbs, |
| 3819 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3820 | alc880_gpio1_init_verbs }, |
| 3821 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3822 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3823 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3824 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3825 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3826 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3827 | .input_mux = &alc880_capture_source, |
| 3828 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3829 | [ALC880_ASUS_DIG2] = { |
| 3830 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3831 | .init_verbs = { alc880_volume_init_verbs, |
| 3832 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3833 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3834 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3835 | .dac_nids = alc880_asus_dac_nids, |
| 3836 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3837 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3838 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3839 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3840 | .input_mux = &alc880_capture_source, |
| 3841 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3842 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3843 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3844 | .init_verbs = { alc880_volume_init_verbs, |
| 3845 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3846 | alc880_gpio1_init_verbs }, |
| 3847 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3848 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3849 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3850 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3851 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3852 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3853 | .input_mux = &alc880_capture_source, |
| 3854 | }, |
| 3855 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3856 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3857 | .init_verbs = { alc880_volume_init_verbs, |
| 3858 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3859 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3860 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3861 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3862 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3863 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3864 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3865 | .input_mux = &alc880_capture_source, |
| 3866 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3867 | [ALC880_UNIWILL] = { |
| 3868 | .mixers = { alc880_uniwill_mixer }, |
| 3869 | .init_verbs = { alc880_volume_init_verbs, |
| 3870 | alc880_uniwill_init_verbs }, |
| 3871 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3872 | .dac_nids = alc880_asus_dac_nids, |
| 3873 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3874 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3875 | .channel_mode = alc880_threestack_modes, |
| 3876 | .need_dac_fix = 1, |
| 3877 | .input_mux = &alc880_capture_source, |
| 3878 | .unsol_event = alc880_uniwill_unsol_event, |
| 3879 | .init_hook = alc880_uniwill_automute, |
| 3880 | }, |
| 3881 | [ALC880_UNIWILL_P53] = { |
| 3882 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3883 | .init_verbs = { alc880_volume_init_verbs, |
| 3884 | alc880_uniwill_p53_init_verbs }, |
| 3885 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3886 | .dac_nids = alc880_asus_dac_nids, |
| 3887 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3888 | .channel_mode = alc880_threestack_modes, |
| 3889 | .input_mux = &alc880_capture_source, |
| 3890 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3891 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3892 | }, |
| 3893 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3894 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3895 | .init_verbs = { alc880_volume_init_verbs, |
| 3896 | alc880_uniwill_p53_init_verbs, |
| 3897 | alc880_beep_init_verbs }, |
| 3898 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3899 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3900 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3901 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3902 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3903 | .input_mux = &alc880_capture_source, |
| 3904 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3905 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3906 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3907 | [ALC880_CLEVO] = { |
| 3908 | .mixers = { alc880_three_stack_mixer }, |
| 3909 | .init_verbs = { alc880_volume_init_verbs, |
| 3910 | alc880_pin_clevo_init_verbs }, |
| 3911 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3912 | .dac_nids = alc880_dac_nids, |
| 3913 | .hp_nid = 0x03, |
| 3914 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3915 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3916 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3917 | .input_mux = &alc880_capture_source, |
| 3918 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3919 | [ALC880_LG] = { |
| 3920 | .mixers = { alc880_lg_mixer }, |
| 3921 | .init_verbs = { alc880_volume_init_verbs, |
| 3922 | alc880_lg_init_verbs }, |
| 3923 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3924 | .dac_nids = alc880_lg_dac_nids, |
| 3925 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3926 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3927 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3928 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3929 | .input_mux = &alc880_lg_capture_source, |
| 3930 | .unsol_event = alc880_lg_unsol_event, |
| 3931 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3932 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3933 | .loopbacks = alc880_lg_loopbacks, |
| 3934 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3935 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3936 | [ALC880_LG_LW] = { |
| 3937 | .mixers = { alc880_lg_lw_mixer }, |
| 3938 | .init_verbs = { alc880_volume_init_verbs, |
| 3939 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3940 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3941 | .dac_nids = alc880_dac_nids, |
| 3942 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3943 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3944 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3945 | .input_mux = &alc880_lg_lw_capture_source, |
| 3946 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3947 | .init_hook = alc880_lg_lw_automute, |
| 3948 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3949 | [ALC880_MEDION_RIM] = { |
| 3950 | .mixers = { alc880_medion_rim_mixer }, |
| 3951 | .init_verbs = { alc880_volume_init_verbs, |
| 3952 | alc880_medion_rim_init_verbs, |
| 3953 | alc_gpio2_init_verbs }, |
| 3954 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3955 | .dac_nids = alc880_dac_nids, |
| 3956 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3957 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3958 | .channel_mode = alc880_2_jack_modes, |
| 3959 | .input_mux = &alc880_medion_rim_capture_source, |
| 3960 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3961 | .init_hook = alc880_medion_rim_automute, |
| 3962 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3963 | #ifdef CONFIG_SND_DEBUG |
| 3964 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3965 | .mixers = { alc880_test_mixer }, |
| 3966 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3967 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3968 | .dac_nids = alc880_test_dac_nids, |
| 3969 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3970 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3971 | .channel_mode = alc880_test_modes, |
| 3972 | .input_mux = &alc880_test_capture_source, |
| 3973 | }, |
| 3974 | #endif |
| 3975 | }; |
| 3976 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3977 | /* |
| 3978 | * Automatic parse of I/O pins from the BIOS configuration |
| 3979 | */ |
| 3980 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3981 | enum { |
| 3982 | ALC_CTL_WIDGET_VOL, |
| 3983 | ALC_CTL_WIDGET_MUTE, |
| 3984 | ALC_CTL_BIND_MUTE, |
| 3985 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3986 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3987 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3988 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3989 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3990 | }; |
| 3991 | |
| 3992 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3993 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3994 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3995 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3996 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3997 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3998 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 3999 | knew = snd_array_new(&spec->kctls); |
| 4000 | if (!knew) |
| 4001 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4002 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4003 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4004 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4005 | return -ENOMEM; |
| 4006 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4007 | return 0; |
| 4008 | } |
| 4009 | |
| 4010 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4011 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4012 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4013 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4014 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4015 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4016 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4017 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4018 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4019 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4020 | #define ALC880_PIN_CD_NID 0x1c |
| 4021 | |
| 4022 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4023 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4024 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4025 | { |
| 4026 | hda_nid_t nid; |
| 4027 | int assigned[4]; |
| 4028 | int i, j; |
| 4029 | |
| 4030 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4031 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4032 | |
| 4033 | /* check the pins hardwired to audio widget */ |
| 4034 | for (i = 0; i < cfg->line_outs; i++) { |
| 4035 | nid = cfg->line_out_pins[i]; |
| 4036 | if (alc880_is_fixed_pin(nid)) { |
| 4037 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4038 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4039 | assigned[idx] = 1; |
| 4040 | } |
| 4041 | } |
| 4042 | /* left pins can be connect to any audio widget */ |
| 4043 | for (i = 0; i < cfg->line_outs; i++) { |
| 4044 | nid = cfg->line_out_pins[i]; |
| 4045 | if (alc880_is_fixed_pin(nid)) |
| 4046 | continue; |
| 4047 | /* search for an empty channel */ |
| 4048 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4049 | if (!assigned[j]) { |
| 4050 | spec->multiout.dac_nids[i] = |
| 4051 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4052 | assigned[j] = 1; |
| 4053 | break; |
| 4054 | } |
| 4055 | } |
| 4056 | } |
| 4057 | spec->multiout.num_dacs = cfg->line_outs; |
| 4058 | return 0; |
| 4059 | } |
| 4060 | |
| 4061 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4062 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4063 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4064 | { |
| 4065 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4066 | static const char *chname[4] = { |
| 4067 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4068 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4069 | hda_nid_t nid; |
| 4070 | int i, err; |
| 4071 | |
| 4072 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4073 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4074 | continue; |
| 4075 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4076 | if (i == 2) { |
| 4077 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4078 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4079 | "Center Playback Volume", |
| 4080 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4081 | HDA_OUTPUT)); |
| 4082 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4083 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4084 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4085 | "LFE Playback Volume", |
| 4086 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4087 | HDA_OUTPUT)); |
| 4088 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4089 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4090 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4091 | "Center Playback Switch", |
| 4092 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4093 | HDA_INPUT)); |
| 4094 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4095 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4096 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4097 | "LFE Playback Switch", |
| 4098 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4099 | HDA_INPUT)); |
| 4100 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4101 | return err; |
| 4102 | } else { |
| 4103 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4104 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4105 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4106 | HDA_OUTPUT)); |
| 4107 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4108 | return err; |
| 4109 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4110 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4111 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4112 | HDA_INPUT)); |
| 4113 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4114 | return err; |
| 4115 | } |
| 4116 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4117 | return 0; |
| 4118 | } |
| 4119 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4120 | /* add playback controls for speaker and HP outputs */ |
| 4121 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4122 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4123 | { |
| 4124 | hda_nid_t nid; |
| 4125 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4126 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4127 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4128 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4129 | return 0; |
| 4130 | |
| 4131 | if (alc880_is_fixed_pin(pin)) { |
| 4132 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4133 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4134 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4135 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4136 | else |
| 4137 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4138 | /* control HP volume/switch on the output mixer amp */ |
| 4139 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4140 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4141 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4142 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4143 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4144 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4145 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4146 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4147 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4148 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4149 | return err; |
| 4150 | } else if (alc880_is_multi_pin(pin)) { |
| 4151 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4152 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4153 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4154 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4155 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4156 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4157 | return err; |
| 4158 | } |
| 4159 | return 0; |
| 4160 | } |
| 4161 | |
| 4162 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4163 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4164 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4165 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4166 | { |
| 4167 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4168 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4169 | |
| 4170 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4171 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4172 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4173 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4174 | return err; |
| 4175 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4176 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4177 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4178 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4179 | return err; |
| 4180 | return 0; |
| 4181 | } |
| 4182 | |
| 4183 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4184 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4185 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4186 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4187 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4188 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4189 | |
| 4190 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4191 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4192 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4193 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4194 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4195 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4196 | if (err < 0) |
| 4197 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4198 | imux->items[imux->num_items].label = |
| 4199 | auto_pin_cfg_labels[i]; |
| 4200 | imux->items[imux->num_items].index = |
| 4201 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4202 | imux->num_items++; |
| 4203 | } |
| 4204 | } |
| 4205 | return 0; |
| 4206 | } |
| 4207 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4208 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4209 | unsigned int pin_type) |
| 4210 | { |
| 4211 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4212 | pin_type); |
| 4213 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4214 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4215 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4216 | } |
| 4217 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4218 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4219 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4220 | int dac_idx) |
| 4221 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4222 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4223 | /* need the manual connection? */ |
| 4224 | if (alc880_is_multi_pin(nid)) { |
| 4225 | struct alc_spec *spec = codec->spec; |
| 4226 | int idx = alc880_multi_pin_idx(nid); |
| 4227 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4228 | AC_VERB_SET_CONNECT_SEL, |
| 4229 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4230 | } |
| 4231 | } |
| 4232 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4233 | static int get_pin_type(int line_out_type) |
| 4234 | { |
| 4235 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4236 | return PIN_HP; |
| 4237 | else |
| 4238 | return PIN_OUT; |
| 4239 | } |
| 4240 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4241 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4242 | { |
| 4243 | struct alc_spec *spec = codec->spec; |
| 4244 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4245 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4246 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4247 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4248 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4249 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4250 | } |
| 4251 | } |
| 4252 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4253 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4254 | { |
| 4255 | struct alc_spec *spec = codec->spec; |
| 4256 | hda_nid_t pin; |
| 4257 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4258 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4259 | if (pin) /* connect to front */ |
| 4260 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4261 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4262 | if (pin) /* connect to front */ |
| 4263 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4264 | } |
| 4265 | |
| 4266 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4267 | { |
| 4268 | struct alc_spec *spec = codec->spec; |
| 4269 | int i; |
| 4270 | |
| 4271 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4272 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4273 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4274 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4275 | if (nid != ALC880_PIN_CD_NID && |
| 4276 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4277 | snd_hda_codec_write(codec, nid, 0, |
| 4278 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4279 | AMP_OUT_MUTE); |
| 4280 | } |
| 4281 | } |
| 4282 | } |
| 4283 | |
| 4284 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4285 | /* return 1 if successful, 0 if the proper config is not found, |
| 4286 | * or a negative error code |
| 4287 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4288 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4289 | { |
| 4290 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4291 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4292 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4293 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4294 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4295 | alc880_ignore); |
| 4296 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4297 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4298 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4299 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4300 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4301 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4302 | if (err < 0) |
| 4303 | return err; |
| 4304 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4305 | if (err < 0) |
| 4306 | return err; |
| 4307 | err = alc880_auto_create_extra_out(spec, |
| 4308 | spec->autocfg.speaker_pins[0], |
| 4309 | "Speaker"); |
| 4310 | if (err < 0) |
| 4311 | return err; |
| 4312 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4313 | "Headphone"); |
| 4314 | if (err < 0) |
| 4315 | return err; |
| 4316 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4317 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4318 | return err; |
| 4319 | |
| 4320 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4321 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4322 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4323 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4324 | hda_nid_t dig_nid; |
| 4325 | err = snd_hda_get_connections(codec, |
| 4326 | spec->autocfg.dig_out_pins[i], |
| 4327 | &dig_nid, 1); |
| 4328 | if (err < 0) |
| 4329 | continue; |
| 4330 | if (!i) |
| 4331 | spec->multiout.dig_out_nid = dig_nid; |
| 4332 | else { |
| 4333 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4334 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4335 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4336 | break; |
| 4337 | } |
| 4338 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4339 | if (spec->autocfg.dig_in_pin) |
| 4340 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4341 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4342 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4343 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4344 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4345 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4346 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4347 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4348 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4349 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame^] | 4350 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4351 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4352 | return 1; |
| 4353 | } |
| 4354 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4355 | /* additional initialization for auto-configuration model */ |
| 4356 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4358 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4359 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4360 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4361 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4362 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4363 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4364 | } |
| 4365 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4366 | static void set_capture_mixer(struct alc_spec *spec) |
| 4367 | { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4368 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4369 | { alc_capture_mixer_nosrc1, |
| 4370 | alc_capture_mixer_nosrc2, |
| 4371 | alc_capture_mixer_nosrc3 }, |
| 4372 | { alc_capture_mixer1, |
| 4373 | alc_capture_mixer2, |
| 4374 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4375 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4376 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4377 | int mux; |
| 4378 | if (spec->input_mux && spec->input_mux->num_items > 1) |
| 4379 | mux = 1; |
| 4380 | else |
| 4381 | mux = 0; |
| 4382 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4383 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4384 | } |
| 4385 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4386 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4387 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4388 | |
| 4389 | /* |
| 4390 | * OK, here we have finally the patch for ALC880 |
| 4391 | */ |
| 4392 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4393 | static int patch_alc880(struct hda_codec *codec) |
| 4394 | { |
| 4395 | struct alc_spec *spec; |
| 4396 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4397 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4398 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4399 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4400 | if (spec == NULL) |
| 4401 | return -ENOMEM; |
| 4402 | |
| 4403 | codec->spec = spec; |
| 4404 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4405 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4406 | alc880_models, |
| 4407 | alc880_cfg_tbl); |
| 4408 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4409 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 4410 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4411 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4412 | } |
| 4413 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4414 | if (board_config == ALC880_AUTO) { |
| 4415 | /* automatic parse from the BIOS config */ |
| 4416 | err = alc880_parse_auto_config(codec); |
| 4417 | if (err < 0) { |
| 4418 | alc_free(codec); |
| 4419 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4420 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4421 | printk(KERN_INFO |
| 4422 | "hda_codec: Cannot set up configuration " |
| 4423 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4424 | board_config = ALC880_3ST; |
| 4425 | } |
| 4426 | } |
| 4427 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4428 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4429 | if (err < 0) { |
| 4430 | alc_free(codec); |
| 4431 | return err; |
| 4432 | } |
| 4433 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4434 | if (board_config != ALC880_AUTO) |
| 4435 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4436 | |
| 4437 | spec->stream_name_analog = "ALC880 Analog"; |
| 4438 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4439 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4440 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4441 | |
| 4442 | spec->stream_name_digital = "ALC880 Digital"; |
| 4443 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4444 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4445 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4446 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4447 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4448 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4449 | /* get type */ |
| 4450 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4451 | if (wcap != AC_WID_AUD_IN) { |
| 4452 | spec->adc_nids = alc880_adc_nids_alt; |
| 4453 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4454 | } else { |
| 4455 | spec->adc_nids = alc880_adc_nids; |
| 4456 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4457 | } |
| 4458 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4459 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4460 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4461 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4462 | spec->vmaster_nid = 0x0c; |
| 4463 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4464 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4465 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4466 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4467 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4468 | if (!spec->loopback.amplist) |
| 4469 | spec->loopback.amplist = alc880_loopbacks; |
| 4470 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4471 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4472 | |
| 4473 | return 0; |
| 4474 | } |
| 4475 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4476 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4477 | /* |
| 4478 | * ALC260 support |
| 4479 | */ |
| 4480 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4481 | static hda_nid_t alc260_dac_nids[1] = { |
| 4482 | /* front */ |
| 4483 | 0x02, |
| 4484 | }; |
| 4485 | |
| 4486 | static hda_nid_t alc260_adc_nids[1] = { |
| 4487 | /* ADC0 */ |
| 4488 | 0x04, |
| 4489 | }; |
| 4490 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4491 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4492 | /* ADC1 */ |
| 4493 | 0x05, |
| 4494 | }; |
| 4495 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4496 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4497 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4498 | */ |
| 4499 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4500 | /* ADC0, ADC1 */ |
| 4501 | 0x04, 0x05 |
| 4502 | }; |
| 4503 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4504 | #define ALC260_DIGOUT_NID 0x03 |
| 4505 | #define ALC260_DIGIN_NID 0x06 |
| 4506 | |
| 4507 | static struct hda_input_mux alc260_capture_source = { |
| 4508 | .num_items = 4, |
| 4509 | .items = { |
| 4510 | { "Mic", 0x0 }, |
| 4511 | { "Front Mic", 0x1 }, |
| 4512 | { "Line", 0x2 }, |
| 4513 | { "CD", 0x4 }, |
| 4514 | }, |
| 4515 | }; |
| 4516 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4517 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4518 | * headphone jack and the internal CD lines since these are the only pins at |
| 4519 | * which audio can appear. For flexibility, also allow the option of |
| 4520 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4521 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4522 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4523 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4524 | { |
| 4525 | .num_items = 3, |
| 4526 | .items = { |
| 4527 | { "Mic/Line", 0x0 }, |
| 4528 | { "CD", 0x4 }, |
| 4529 | { "Headphone", 0x2 }, |
| 4530 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4531 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4532 | { |
| 4533 | .num_items = 4, |
| 4534 | .items = { |
| 4535 | { "Mic/Line", 0x0 }, |
| 4536 | { "CD", 0x4 }, |
| 4537 | { "Headphone", 0x2 }, |
| 4538 | { "Mixer", 0x5 }, |
| 4539 | }, |
| 4540 | }, |
| 4541 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4542 | }; |
| 4543 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4544 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4545 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4546 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4547 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4548 | { |
| 4549 | .num_items = 4, |
| 4550 | .items = { |
| 4551 | { "Mic", 0x0 }, |
| 4552 | { "Line", 0x2 }, |
| 4553 | { "CD", 0x4 }, |
| 4554 | { "Headphone", 0x5 }, |
| 4555 | }, |
| 4556 | }, |
| 4557 | { |
| 4558 | .num_items = 5, |
| 4559 | .items = { |
| 4560 | { "Mic", 0x0 }, |
| 4561 | { "Line", 0x2 }, |
| 4562 | { "CD", 0x4 }, |
| 4563 | { "Headphone", 0x6 }, |
| 4564 | { "Mixer", 0x5 }, |
| 4565 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4566 | }, |
| 4567 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4568 | |
| 4569 | /* Maxdata Favorit 100XS */ |
| 4570 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4571 | { |
| 4572 | .num_items = 2, |
| 4573 | .items = { |
| 4574 | { "Line/Mic", 0x0 }, |
| 4575 | { "CD", 0x4 }, |
| 4576 | }, |
| 4577 | }, |
| 4578 | { |
| 4579 | .num_items = 3, |
| 4580 | .items = { |
| 4581 | { "Line/Mic", 0x0 }, |
| 4582 | { "CD", 0x4 }, |
| 4583 | { "Mixer", 0x5 }, |
| 4584 | }, |
| 4585 | }, |
| 4586 | }; |
| 4587 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4588 | /* |
| 4589 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4590 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4591 | * element which allows changing the channel mode, so the verb list is |
| 4592 | * never used. |
| 4593 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4594 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4595 | { 2, NULL }, |
| 4596 | }; |
| 4597 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4598 | |
| 4599 | /* Mixer combinations |
| 4600 | * |
| 4601 | * basic: base_output + input + pc_beep + capture |
| 4602 | * HP: base_output + input + capture_alt |
| 4603 | * HP_3013: hp_3013 + input + capture |
| 4604 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4605 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4606 | */ |
| 4607 | |
| 4608 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4609 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4610 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4611 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4612 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4613 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4614 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4615 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4616 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4617 | |
| 4618 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4619 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4620 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4621 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4622 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4623 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4624 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4625 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4626 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4627 | { } /* end */ |
| 4628 | }; |
| 4629 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4630 | /* update HP, line and mono out pins according to the master switch */ |
| 4631 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4632 | hda_nid_t hp, hda_nid_t line, |
| 4633 | hda_nid_t mono) |
| 4634 | { |
| 4635 | struct alc_spec *spec = codec->spec; |
| 4636 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4637 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4638 | 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] | 4639 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4640 | 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] | 4641 | val); |
| 4642 | /* mono (speaker) depending on the HP jack sense */ |
| 4643 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4644 | 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] | 4645 | val); |
| 4646 | } |
| 4647 | |
| 4648 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4649 | struct snd_ctl_elem_value *ucontrol) |
| 4650 | { |
| 4651 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4652 | struct alc_spec *spec = codec->spec; |
| 4653 | *ucontrol->value.integer.value = spec->master_sw; |
| 4654 | return 0; |
| 4655 | } |
| 4656 | |
| 4657 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4658 | struct snd_ctl_elem_value *ucontrol) |
| 4659 | { |
| 4660 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4661 | struct alc_spec *spec = codec->spec; |
| 4662 | int val = !!*ucontrol->value.integer.value; |
| 4663 | hda_nid_t hp, line, mono; |
| 4664 | |
| 4665 | if (val == spec->master_sw) |
| 4666 | return 0; |
| 4667 | spec->master_sw = val; |
| 4668 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4669 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4670 | mono = kcontrol->private_value & 0xff; |
| 4671 | alc260_hp_master_update(codec, hp, line, mono); |
| 4672 | return 1; |
| 4673 | } |
| 4674 | |
| 4675 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4676 | { |
| 4677 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4678 | .name = "Master Playback Switch", |
| 4679 | .info = snd_ctl_boolean_mono_info, |
| 4680 | .get = alc260_hp_master_sw_get, |
| 4681 | .put = alc260_hp_master_sw_put, |
| 4682 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4683 | }, |
| 4684 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4685 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4686 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4687 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4688 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4689 | HDA_OUTPUT), |
| 4690 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4691 | { } /* end */ |
| 4692 | }; |
| 4693 | |
| 4694 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4695 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4696 | {}, |
| 4697 | }; |
| 4698 | |
| 4699 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4700 | { |
| 4701 | struct alc_spec *spec = codec->spec; |
| 4702 | unsigned int present; |
| 4703 | |
| 4704 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4705 | AC_VERB_GET_PIN_SENSE, 0); |
| 4706 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4707 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4708 | } |
| 4709 | |
| 4710 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4711 | { |
| 4712 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4713 | alc260_hp_automute(codec); |
| 4714 | } |
| 4715 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4716 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4717 | { |
| 4718 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4719 | .name = "Master Playback Switch", |
| 4720 | .info = snd_ctl_boolean_mono_info, |
| 4721 | .get = alc260_hp_master_sw_get, |
| 4722 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4723 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4724 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4725 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4726 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4727 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4728 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4729 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4730 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4731 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4732 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4733 | { } /* end */ |
| 4734 | }; |
| 4735 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4736 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4737 | .ops = &snd_hda_bind_vol, |
| 4738 | .values = { |
| 4739 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4740 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4741 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4742 | 0 |
| 4743 | }, |
| 4744 | }; |
| 4745 | |
| 4746 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4747 | .ops = &snd_hda_bind_sw, |
| 4748 | .values = { |
| 4749 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4750 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4751 | 0 |
| 4752 | }, |
| 4753 | }; |
| 4754 | |
| 4755 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4756 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4757 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4758 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4759 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4760 | { } /* end */ |
| 4761 | }; |
| 4762 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4763 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4764 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4765 | {}, |
| 4766 | }; |
| 4767 | |
| 4768 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4769 | { |
| 4770 | struct alc_spec *spec = codec->spec; |
| 4771 | unsigned int present; |
| 4772 | |
| 4773 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4774 | AC_VERB_GET_PIN_SENSE, 0); |
| 4775 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4776 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4777 | } |
| 4778 | |
| 4779 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4780 | unsigned int res) |
| 4781 | { |
| 4782 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4783 | alc260_hp_3013_automute(codec); |
| 4784 | } |
| 4785 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4786 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4787 | { |
| 4788 | unsigned int present, bits; |
| 4789 | |
| 4790 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4791 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4792 | |
| 4793 | bits = present ? 0 : PIN_OUT; |
| 4794 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4795 | bits); |
| 4796 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4797 | bits); |
| 4798 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4799 | bits); |
| 4800 | } |
| 4801 | |
| 4802 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4803 | unsigned int res) |
| 4804 | { |
| 4805 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4806 | alc260_hp_3012_automute(codec); |
| 4807 | } |
| 4808 | |
| 4809 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4810 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4811 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4812 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4813 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4814 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4815 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4816 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4817 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4818 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4819 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4820 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4821 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4822 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4823 | { } /* end */ |
| 4824 | }; |
| 4825 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4826 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4827 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4828 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4829 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4830 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4831 | * revisions available in early 2006. Therefore for now allow the |
| 4832 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4833 | * that the lack of mic bias for this NID is intentional we could change the |
| 4834 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4835 | * |
| 4836 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4837 | * don't appear to make the mic bias available from the "line" jack, even |
| 4838 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4839 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4840 | * and the output jack. If this turns out to be the case for all such |
| 4841 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4842 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4843 | * |
| 4844 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4845 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4846 | * controls for such models. On models without a "mono speaker" the control |
| 4847 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4848 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4849 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4850 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4851 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4852 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4853 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4854 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4855 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4856 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4857 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4858 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4859 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4860 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4861 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4862 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4863 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4864 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4865 | { } /* end */ |
| 4866 | }; |
| 4867 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4868 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 4869 | */ |
| 4870 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 4871 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4872 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 4873 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4874 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4875 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4876 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4877 | { } /* end */ |
| 4878 | }; |
| 4879 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4880 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4881 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4882 | */ |
| 4883 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4884 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4885 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4886 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4887 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4888 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4889 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4890 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4891 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4892 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4893 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4894 | { } /* end */ |
| 4895 | }; |
| 4896 | |
| 4897 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4898 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4899 | */ |
| 4900 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4901 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4902 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4903 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4904 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4905 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4906 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4907 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4908 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4909 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4910 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4911 | { } /* end */ |
| 4912 | }; |
| 4913 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4914 | /* |
| 4915 | * initialization verbs |
| 4916 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4917 | static struct hda_verb alc260_init_verbs[] = { |
| 4918 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4919 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4920 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4921 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4922 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4923 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4924 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4925 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4926 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4927 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4928 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4929 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4930 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4931 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4932 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4933 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4934 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4935 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4936 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4937 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4938 | /* set connection select to line in (default select for this ADC) */ |
| 4939 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4940 | /* mute capture amp left and right */ |
| 4941 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4942 | /* set connection select to line in (default select for this ADC) */ |
| 4943 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4944 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4945 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4946 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4947 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4948 | /* set vol=0 HP mixer amp left and right */ |
| 4949 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4950 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4951 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4952 | /* set vol=0 Mono mixer amp left and right */ |
| 4953 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4954 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4955 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4956 | /* unmute LINE-2 out pin */ |
| 4957 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4958 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4959 | * Line In 2 = 0x03 |
| 4960 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4961 | /* mute analog inputs */ |
| 4962 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4963 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4964 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4965 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4966 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4967 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4968 | /* mute Front out path */ |
| 4969 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4970 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4971 | /* mute Headphone out path */ |
| 4972 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4973 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4974 | /* mute Mono out path */ |
| 4975 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4976 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4977 | { } |
| 4978 | }; |
| 4979 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4980 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4981 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4982 | /* Headphone and output */ |
| 4983 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4984 | /* mono output */ |
| 4985 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4986 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4987 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4988 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4989 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4990 | /* Line In pin widget for input */ |
| 4991 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4992 | /* Line-2 pin widget for output */ |
| 4993 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4994 | /* CD pin widget for input */ |
| 4995 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4996 | /* unmute amp left and right */ |
| 4997 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4998 | /* set connection select to line in (default select for this ADC) */ |
| 4999 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5000 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5001 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5002 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5003 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5004 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5005 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5006 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5007 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5008 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5009 | * Line In 2 = 0x03 |
| 5010 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5011 | /* mute analog inputs */ |
| 5012 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5013 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5014 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5015 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5016 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5017 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5018 | /* Unmute Front out path */ |
| 5019 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5020 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5021 | /* Unmute Headphone out path */ |
| 5022 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5023 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5024 | /* Unmute Mono out path */ |
| 5025 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5026 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5027 | { } |
| 5028 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5029 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5030 | |
| 5031 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5032 | /* Line out and output */ |
| 5033 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5034 | /* mono output */ |
| 5035 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5036 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5037 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5038 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5039 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5040 | /* Line In pin widget for input */ |
| 5041 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5042 | /* Headphone pin widget for output */ |
| 5043 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5044 | /* CD pin widget for input */ |
| 5045 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5046 | /* unmute amp left and right */ |
| 5047 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5048 | /* set connection select to line in (default select for this ADC) */ |
| 5049 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5050 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5051 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5052 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5053 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5054 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5055 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5056 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5057 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5058 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5059 | * Line In 2 = 0x03 |
| 5060 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5061 | /* mute analog inputs */ |
| 5062 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5063 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5064 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5065 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5066 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5067 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5068 | /* Unmute Front out path */ |
| 5069 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5070 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5071 | /* Unmute Headphone out path */ |
| 5072 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5073 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5074 | /* Unmute Mono out path */ |
| 5075 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5076 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5077 | { } |
| 5078 | }; |
| 5079 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5080 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5081 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5082 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5083 | */ |
| 5084 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5085 | /* Disable all GPIOs */ |
| 5086 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5087 | /* Internal speaker is connected to headphone pin */ |
| 5088 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5089 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5090 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5091 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5092 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5093 | /* Ensure all other unused pins are disabled and muted. */ |
| 5094 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5095 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5096 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5097 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5098 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5099 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5100 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5101 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5102 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5103 | /* Disable digital (SPDIF) pins */ |
| 5104 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5105 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5106 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5107 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5108 | * when acting as an output. |
| 5109 | */ |
| 5110 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5111 | |
| 5112 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5113 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5114 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5115 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5116 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5117 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5118 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5119 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5120 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5121 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5122 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5123 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5124 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5125 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5126 | * If the pin mode is changed by the user the pin mode control will |
| 5127 | * take care of enabling the pin's input/output buffers as needed. |
| 5128 | * Therefore there's no need to enable the input buffer at this |
| 5129 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5130 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5131 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5132 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5133 | * mixer ctrl) |
| 5134 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5135 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5136 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5137 | /* Mute capture amp left and right */ |
| 5138 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5139 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5140 | * in (on mic1 pin) |
| 5141 | */ |
| 5142 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5143 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5144 | /* Do the same for the second ADC: mute capture input amp and |
| 5145 | * set ADC connection to line in (on mic1 pin) |
| 5146 | */ |
| 5147 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5148 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5149 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5150 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5151 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5152 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5153 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5154 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5155 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5156 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5157 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5158 | {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] | 5159 | |
| 5160 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5161 | }; |
| 5162 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5163 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5164 | * similar laptops (adapted from Fujitsu init verbs). |
| 5165 | */ |
| 5166 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5167 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5168 | * the headphone jack. Turn this on and rely on the standard mute |
| 5169 | * methods whenever the user wants to turn these outputs off. |
| 5170 | */ |
| 5171 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5172 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5173 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5174 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5175 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5176 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5177 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5178 | /* Line In jack is connected to Line1 pin */ |
| 5179 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5180 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5181 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5182 | /* Ensure all other unused pins are disabled and muted. */ |
| 5183 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5184 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5185 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5186 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5187 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5188 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5189 | /* Disable digital (SPDIF) pins */ |
| 5190 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5191 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5192 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5193 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5194 | * bus when acting as outputs. |
| 5195 | */ |
| 5196 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5197 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5198 | |
| 5199 | /* Start with output sum widgets muted and their output gains at min */ |
| 5200 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5201 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5202 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5203 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5204 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5205 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5206 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5207 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5208 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5209 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5210 | /* Unmute Line-out pin widget amp left and right |
| 5211 | * (no equiv mixer ctrl) |
| 5212 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5213 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5214 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5215 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5216 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5217 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5218 | * will take care of enabling the pin's input/output buffers as needed. |
| 5219 | * Therefore there's no need to enable the input buffer at this |
| 5220 | * stage. |
| 5221 | */ |
| 5222 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5223 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5224 | |
| 5225 | /* Mute capture amp left and right */ |
| 5226 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5227 | /* Set ADC connection select to match default mixer setting - mic |
| 5228 | * (on mic1 pin) |
| 5229 | */ |
| 5230 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5231 | |
| 5232 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5233 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5234 | */ |
| 5235 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5236 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5237 | |
| 5238 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5239 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5240 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5241 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5242 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5243 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5244 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5245 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5246 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5247 | |
| 5248 | { } |
| 5249 | }; |
| 5250 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5251 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5252 | * (adapted from Acer init verbs). |
| 5253 | */ |
| 5254 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5255 | /* GPIO 0 enables the output jack. |
| 5256 | * Turn this on and rely on the standard mute |
| 5257 | * methods whenever the user wants to turn these outputs off. |
| 5258 | */ |
| 5259 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5260 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5261 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5262 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5263 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5264 | /* Ensure all other unused pins are disabled and muted. */ |
| 5265 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5266 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5267 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5268 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5269 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5270 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5271 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5272 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5273 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5274 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5275 | /* Disable digital (SPDIF) pins */ |
| 5276 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5277 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5278 | |
| 5279 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5280 | * bus when acting as outputs. |
| 5281 | */ |
| 5282 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5283 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5284 | |
| 5285 | /* Start with output sum widgets muted and their output gains at min */ |
| 5286 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5287 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5288 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5289 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5290 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5291 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5292 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5293 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5294 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5295 | |
| 5296 | /* Unmute Line-out pin widget amp left and right |
| 5297 | * (no equiv mixer ctrl) |
| 5298 | */ |
| 5299 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5300 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5301 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5302 | * will take care of enabling the pin's input/output buffers as needed. |
| 5303 | * Therefore there's no need to enable the input buffer at this |
| 5304 | * stage. |
| 5305 | */ |
| 5306 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5307 | |
| 5308 | /* Mute capture amp left and right */ |
| 5309 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5310 | /* Set ADC connection select to match default mixer setting - mic |
| 5311 | * (on mic1 pin) |
| 5312 | */ |
| 5313 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5314 | |
| 5315 | /* Do similar with the second ADC: mute capture input amp and |
| 5316 | * set ADC connection to mic to match ALSA's default state. |
| 5317 | */ |
| 5318 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5319 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5320 | |
| 5321 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5322 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5323 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5324 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5325 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5326 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5327 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5328 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5329 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5330 | |
| 5331 | { } |
| 5332 | }; |
| 5333 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5334 | static struct hda_verb alc260_will_verbs[] = { |
| 5335 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5336 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5337 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5338 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5339 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5340 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5341 | {} |
| 5342 | }; |
| 5343 | |
| 5344 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5345 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5346 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5347 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5348 | |
| 5349 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5350 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5351 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5352 | |
| 5353 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5354 | {} |
| 5355 | }; |
| 5356 | |
| 5357 | /* toggle speaker-output according to the hp-jack state */ |
| 5358 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5359 | { |
| 5360 | unsigned int present; |
| 5361 | |
| 5362 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5363 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5364 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5365 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5366 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5367 | AC_VERB_SET_GPIO_DATA, 1); |
| 5368 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5369 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5370 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5371 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5372 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5373 | AC_VERB_SET_GPIO_DATA, 0); |
| 5374 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5375 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5376 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5377 | } |
| 5378 | } |
| 5379 | |
| 5380 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5381 | unsigned int res) |
| 5382 | { |
| 5383 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5384 | alc260_replacer_672v_automute(codec); |
| 5385 | } |
| 5386 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5387 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5388 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5389 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5390 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5391 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5392 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5393 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5394 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5395 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5396 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5397 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5398 | {} |
| 5399 | }; |
| 5400 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5401 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5402 | * configuration. |
| 5403 | */ |
| 5404 | #ifdef CONFIG_SND_DEBUG |
| 5405 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5406 | 0x02, |
| 5407 | }; |
| 5408 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5409 | 0x04, 0x05, |
| 5410 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5411 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5412 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5413 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5414 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5415 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5416 | { |
| 5417 | .num_items = 7, |
| 5418 | .items = { |
| 5419 | { "MIC1 pin", 0x0 }, |
| 5420 | { "MIC2 pin", 0x1 }, |
| 5421 | { "LINE1 pin", 0x2 }, |
| 5422 | { "LINE2 pin", 0x3 }, |
| 5423 | { "CD pin", 0x4 }, |
| 5424 | { "LINE-OUT pin", 0x5 }, |
| 5425 | { "HP-OUT pin", 0x6 }, |
| 5426 | }, |
| 5427 | }, |
| 5428 | { |
| 5429 | .num_items = 8, |
| 5430 | .items = { |
| 5431 | { "MIC1 pin", 0x0 }, |
| 5432 | { "MIC2 pin", 0x1 }, |
| 5433 | { "LINE1 pin", 0x2 }, |
| 5434 | { "LINE2 pin", 0x3 }, |
| 5435 | { "CD pin", 0x4 }, |
| 5436 | { "Mixer", 0x5 }, |
| 5437 | { "LINE-OUT pin", 0x6 }, |
| 5438 | { "HP-OUT pin", 0x7 }, |
| 5439 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5440 | }, |
| 5441 | }; |
| 5442 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5443 | /* Output driver widgets */ |
| 5444 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5445 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5446 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5447 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5448 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5449 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5450 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5451 | /* Modes for retasking pin widgets |
| 5452 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5453 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5454 | * mention this restriction. At this stage it's not clear whether |
| 5455 | * this behaviour is intentional or is a hardware bug in chip |
| 5456 | * revisions available at least up until early 2006. Therefore for |
| 5457 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5458 | * choices, but if it turns out that the lack of mic bias for these |
| 5459 | * NIDs is intentional we could change their modes from |
| 5460 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5461 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5462 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5463 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5464 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5465 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5466 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5467 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5468 | |
| 5469 | /* Loopback mixer controls */ |
| 5470 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5471 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5472 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5473 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5474 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5475 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5476 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5477 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5478 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5479 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5480 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5481 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5482 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5483 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5484 | |
| 5485 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5486 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5487 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5488 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5489 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5490 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5491 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5492 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5493 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5494 | */ |
| 5495 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5496 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5497 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5498 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5499 | * this output to turn on an external amplifier. |
| 5500 | */ |
| 5501 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5502 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5503 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5504 | { } /* end */ |
| 5505 | }; |
| 5506 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5507 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5508 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5509 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5510 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5511 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5512 | /* Enable retasking pins as output, initially without power amp */ |
| 5513 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5514 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5515 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5516 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5517 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5518 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5519 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5520 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5521 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5522 | * payload also sets the generation to 0, output to be in "consumer" |
| 5523 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5524 | * control. |
| 5525 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5526 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5527 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5528 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5529 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5530 | * OUT1 sum bus when acting as an output. |
| 5531 | */ |
| 5532 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5533 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5534 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5535 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5536 | |
| 5537 | /* Start with output sum widgets muted and their output gains at min */ |
| 5538 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5539 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5540 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5541 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5542 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5543 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5544 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5545 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5546 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5547 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5548 | /* Unmute retasking pin widget output buffers since the default |
| 5549 | * state appears to be output. As the pin mode is changed by the |
| 5550 | * user the pin mode control will take care of enabling the pin's |
| 5551 | * input/output buffers as needed. |
| 5552 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5553 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5554 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5555 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5556 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5557 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5558 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5559 | /* Also unmute the mono-out pin widget */ |
| 5560 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5561 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5562 | /* Mute capture amp left and right */ |
| 5563 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5564 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5565 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5566 | */ |
| 5567 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5568 | |
| 5569 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5570 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5571 | */ |
| 5572 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5573 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5574 | |
| 5575 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5576 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5577 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5578 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5579 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5580 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5581 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5582 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5583 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5584 | |
| 5585 | { } |
| 5586 | }; |
| 5587 | #endif |
| 5588 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5589 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5590 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5591 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5592 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5593 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5594 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5595 | /* |
| 5596 | * for BIOS auto-configuration |
| 5597 | */ |
| 5598 | |
| 5599 | 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] | 5600 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5601 | { |
| 5602 | hda_nid_t nid_vol; |
| 5603 | unsigned long vol_val, sw_val; |
| 5604 | char name[32]; |
| 5605 | int err; |
| 5606 | |
| 5607 | if (nid >= 0x0f && nid < 0x11) { |
| 5608 | nid_vol = nid - 0x7; |
| 5609 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5610 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5611 | } else if (nid == 0x11) { |
| 5612 | nid_vol = nid - 0x7; |
| 5613 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5614 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5615 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5616 | nid_vol = 0x08; |
| 5617 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5618 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5619 | } else |
| 5620 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5621 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5622 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5623 | /* first control for the volume widget */ |
| 5624 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5625 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5626 | if (err < 0) |
| 5627 | return err; |
| 5628 | *vol_bits |= (1 << nid_vol); |
| 5629 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5630 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5631 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5632 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5633 | return err; |
| 5634 | return 1; |
| 5635 | } |
| 5636 | |
| 5637 | /* add playback controls from the parsed DAC table */ |
| 5638 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5639 | const struct auto_pin_cfg *cfg) |
| 5640 | { |
| 5641 | hda_nid_t nid; |
| 5642 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5643 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5644 | |
| 5645 | spec->multiout.num_dacs = 1; |
| 5646 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5647 | spec->multiout.dac_nids[0] = 0x02; |
| 5648 | |
| 5649 | nid = cfg->line_out_pins[0]; |
| 5650 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5651 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5652 | if (err < 0) |
| 5653 | return err; |
| 5654 | } |
| 5655 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5656 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5657 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5658 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5659 | if (err < 0) |
| 5660 | return err; |
| 5661 | } |
| 5662 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5663 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5664 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5665 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5666 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5667 | if (err < 0) |
| 5668 | return err; |
| 5669 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5670 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5671 | } |
| 5672 | |
| 5673 | /* create playback/capture controls for input pins */ |
| 5674 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5675 | const struct auto_pin_cfg *cfg) |
| 5676 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5677 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5678 | int i, err, idx; |
| 5679 | |
| 5680 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5681 | if (cfg->input_pins[i] >= 0x12) { |
| 5682 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5683 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5684 | auto_pin_cfg_labels[i], idx, |
| 5685 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5686 | if (err < 0) |
| 5687 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5688 | imux->items[imux->num_items].label = |
| 5689 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5690 | imux->items[imux->num_items].index = idx; |
| 5691 | imux->num_items++; |
| 5692 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5693 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5694 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5695 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5696 | auto_pin_cfg_labels[i], idx, |
| 5697 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5698 | if (err < 0) |
| 5699 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5700 | imux->items[imux->num_items].label = |
| 5701 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5702 | imux->items[imux->num_items].index = idx; |
| 5703 | imux->num_items++; |
| 5704 | } |
| 5705 | } |
| 5706 | return 0; |
| 5707 | } |
| 5708 | |
| 5709 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5710 | hda_nid_t nid, int pin_type, |
| 5711 | int sel_idx) |
| 5712 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5713 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5714 | /* need the manual connection? */ |
| 5715 | if (nid >= 0x12) { |
| 5716 | int idx = nid - 0x12; |
| 5717 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5718 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5719 | } |
| 5720 | } |
| 5721 | |
| 5722 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5723 | { |
| 5724 | struct alc_spec *spec = codec->spec; |
| 5725 | hda_nid_t nid; |
| 5726 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5727 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5728 | if (nid) { |
| 5729 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5730 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5731 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5732 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5733 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5734 | if (nid) |
| 5735 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5736 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5737 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5738 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5739 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5740 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5741 | |
| 5742 | #define ALC260_PIN_CD_NID 0x16 |
| 5743 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5744 | { |
| 5745 | struct alc_spec *spec = codec->spec; |
| 5746 | int i; |
| 5747 | |
| 5748 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5749 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5750 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5751 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5752 | if (nid != ALC260_PIN_CD_NID && |
| 5753 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5754 | snd_hda_codec_write(codec, nid, 0, |
| 5755 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5756 | AMP_OUT_MUTE); |
| 5757 | } |
| 5758 | } |
| 5759 | } |
| 5760 | |
| 5761 | /* |
| 5762 | * generic initialization of ADC, input mixers and output mixers |
| 5763 | */ |
| 5764 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5765 | /* |
| 5766 | * Unmute ADC0-1 and set the default input to mic-in |
| 5767 | */ |
| 5768 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5769 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5770 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5771 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5772 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5773 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5774 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5775 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5776 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5777 | */ |
| 5778 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5779 | /* mute analog inputs */ |
| 5780 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5781 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5782 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5783 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5784 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5785 | |
| 5786 | /* |
| 5787 | * Set up output mixers (0x08 - 0x0a) |
| 5788 | */ |
| 5789 | /* set vol=0 to output mixers */ |
| 5790 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5791 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5792 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5793 | /* set up input amps for analog loopback */ |
| 5794 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5795 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5796 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5797 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5798 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5799 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5800 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5801 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5802 | { } |
| 5803 | }; |
| 5804 | |
| 5805 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5806 | { |
| 5807 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5808 | int err; |
| 5809 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5810 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5811 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5812 | alc260_ignore); |
| 5813 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5814 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5815 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5816 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5817 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5818 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5819 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5820 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5821 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5822 | return err; |
| 5823 | |
| 5824 | spec->multiout.max_channels = 2; |
| 5825 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 5826 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5827 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5828 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5829 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5830 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5831 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5832 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5833 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5834 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5835 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame^] | 5836 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 5837 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5838 | return 1; |
| 5839 | } |
| 5840 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5841 | /* additional initialization for auto-configuration model */ |
| 5842 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5843 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5844 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5845 | alc260_auto_init_multi_out(codec); |
| 5846 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5847 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5848 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5849 | } |
| 5850 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5851 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5852 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5853 | { 0x07, HDA_INPUT, 0 }, |
| 5854 | { 0x07, HDA_INPUT, 1 }, |
| 5855 | { 0x07, HDA_INPUT, 2 }, |
| 5856 | { 0x07, HDA_INPUT, 3 }, |
| 5857 | { 0x07, HDA_INPUT, 4 }, |
| 5858 | { } /* end */ |
| 5859 | }; |
| 5860 | #endif |
| 5861 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5862 | /* |
| 5863 | * ALC260 configurations |
| 5864 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5865 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5866 | [ALC260_BASIC] = "basic", |
| 5867 | [ALC260_HP] = "hp", |
| 5868 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5869 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5870 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5871 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5872 | [ALC260_WILL] = "will", |
| 5873 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5874 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5875 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5876 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5877 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5878 | [ALC260_AUTO] = "auto", |
| 5879 | }; |
| 5880 | |
| 5881 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5882 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5883 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5884 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5885 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5886 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5887 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5888 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5889 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5890 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5891 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5892 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5893 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5894 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5895 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5896 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5897 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5898 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5899 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5900 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5901 | {} |
| 5902 | }; |
| 5903 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5904 | static struct alc_config_preset alc260_presets[] = { |
| 5905 | [ALC260_BASIC] = { |
| 5906 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5907 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5908 | .init_verbs = { alc260_init_verbs }, |
| 5909 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5910 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5911 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5912 | .adc_nids = alc260_adc_nids, |
| 5913 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5914 | .channel_mode = alc260_modes, |
| 5915 | .input_mux = &alc260_capture_source, |
| 5916 | }, |
| 5917 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5918 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5919 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5920 | .init_verbs = { alc260_init_verbs, |
| 5921 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5922 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5923 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5924 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5925 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5926 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5927 | .channel_mode = alc260_modes, |
| 5928 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5929 | .unsol_event = alc260_hp_unsol_event, |
| 5930 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5931 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5932 | [ALC260_HP_DC7600] = { |
| 5933 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5934 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5935 | .init_verbs = { alc260_init_verbs, |
| 5936 | alc260_hp_dc7600_verbs }, |
| 5937 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5938 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5939 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5940 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5941 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5942 | .channel_mode = alc260_modes, |
| 5943 | .input_mux = &alc260_capture_source, |
| 5944 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5945 | .init_hook = alc260_hp_3012_automute, |
| 5946 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5947 | [ALC260_HP_3013] = { |
| 5948 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5949 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5950 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5951 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5952 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5953 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5954 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5955 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5956 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5957 | .channel_mode = alc260_modes, |
| 5958 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5959 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5960 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5961 | }, |
| 5962 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5963 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5964 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5965 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5966 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5967 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5968 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5969 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5970 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5971 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5972 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5973 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5974 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5975 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5976 | .init_verbs = { alc260_acer_init_verbs }, |
| 5977 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5978 | .dac_nids = alc260_dac_nids, |
| 5979 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5980 | .adc_nids = alc260_dual_adc_nids, |
| 5981 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5982 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5983 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5984 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5985 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5986 | [ALC260_FAVORIT100] = { |
| 5987 | .mixers = { alc260_favorit100_mixer }, |
| 5988 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 5989 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5990 | .dac_nids = alc260_dac_nids, |
| 5991 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5992 | .adc_nids = alc260_dual_adc_nids, |
| 5993 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5994 | .channel_mode = alc260_modes, |
| 5995 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 5996 | .input_mux = alc260_favorit100_capture_sources, |
| 5997 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5998 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5999 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6000 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6001 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6002 | .dac_nids = alc260_dac_nids, |
| 6003 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6004 | .adc_nids = alc260_adc_nids, |
| 6005 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6006 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6007 | .channel_mode = alc260_modes, |
| 6008 | .input_mux = &alc260_capture_source, |
| 6009 | }, |
| 6010 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6011 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6012 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6013 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6014 | .dac_nids = alc260_dac_nids, |
| 6015 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6016 | .adc_nids = alc260_adc_nids, |
| 6017 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6018 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6019 | .channel_mode = alc260_modes, |
| 6020 | .input_mux = &alc260_capture_source, |
| 6021 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6022 | .init_hook = alc260_replacer_672v_automute, |
| 6023 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6024 | #ifdef CONFIG_SND_DEBUG |
| 6025 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6026 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6027 | .init_verbs = { alc260_test_init_verbs }, |
| 6028 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6029 | .dac_nids = alc260_test_dac_nids, |
| 6030 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6031 | .adc_nids = alc260_test_adc_nids, |
| 6032 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6033 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6034 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6035 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6036 | }, |
| 6037 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6038 | }; |
| 6039 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6040 | static int patch_alc260(struct hda_codec *codec) |
| 6041 | { |
| 6042 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6043 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6044 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6045 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6046 | if (spec == NULL) |
| 6047 | return -ENOMEM; |
| 6048 | |
| 6049 | codec->spec = spec; |
| 6050 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6051 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6052 | alc260_models, |
| 6053 | alc260_cfg_tbl); |
| 6054 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6055 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 6056 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6057 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6058 | } |
| 6059 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6060 | if (board_config == ALC260_AUTO) { |
| 6061 | /* automatic parse from the BIOS config */ |
| 6062 | err = alc260_parse_auto_config(codec); |
| 6063 | if (err < 0) { |
| 6064 | alc_free(codec); |
| 6065 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6066 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6067 | printk(KERN_INFO |
| 6068 | "hda_codec: Cannot set up configuration " |
| 6069 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6070 | board_config = ALC260_BASIC; |
| 6071 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6072 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6073 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6074 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6075 | if (err < 0) { |
| 6076 | alc_free(codec); |
| 6077 | return err; |
| 6078 | } |
| 6079 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6080 | if (board_config != ALC260_AUTO) |
| 6081 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6082 | |
| 6083 | spec->stream_name_analog = "ALC260 Analog"; |
| 6084 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6085 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6086 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6087 | spec->stream_name_digital = "ALC260 Digital"; |
| 6088 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6089 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6090 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6091 | if (!spec->adc_nids && spec->input_mux) { |
| 6092 | /* check whether NID 0x04 is valid */ |
| 6093 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 6094 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 6095 | /* get type */ |
| 6096 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6097 | spec->adc_nids = alc260_adc_nids_alt; |
| 6098 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6099 | } else { |
| 6100 | spec->adc_nids = alc260_adc_nids; |
| 6101 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6102 | } |
| 6103 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6104 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6105 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6106 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6107 | spec->vmaster_nid = 0x08; |
| 6108 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6109 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6110 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6111 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6112 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6113 | if (!spec->loopback.amplist) |
| 6114 | spec->loopback.amplist = alc260_loopbacks; |
| 6115 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6116 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6117 | |
| 6118 | return 0; |
| 6119 | } |
| 6120 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6121 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6122 | /* |
| 6123 | * ALC882 support |
| 6124 | * |
| 6125 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6126 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6127 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6128 | * 6-channel independent captures. |
| 6129 | * |
| 6130 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6131 | * driver yet). |
| 6132 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6133 | #define ALC882_DIGOUT_NID 0x06 |
| 6134 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6135 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6136 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6137 | { 8, NULL } |
| 6138 | }; |
| 6139 | |
| 6140 | static hda_nid_t alc882_dac_nids[4] = { |
| 6141 | /* front, rear, clfe, rear_surr */ |
| 6142 | 0x02, 0x03, 0x04, 0x05 |
| 6143 | }; |
| 6144 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6145 | /* identical with ALC880 */ |
| 6146 | #define alc882_adc_nids alc880_adc_nids |
| 6147 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6148 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6149 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6150 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 6151 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6152 | /* input MUX */ |
| 6153 | /* FIXME: should be a matrix-type input source selection */ |
| 6154 | |
| 6155 | static struct hda_input_mux alc882_capture_source = { |
| 6156 | .num_items = 4, |
| 6157 | .items = { |
| 6158 | { "Mic", 0x0 }, |
| 6159 | { "Front Mic", 0x1 }, |
| 6160 | { "Line", 0x2 }, |
| 6161 | { "CD", 0x4 }, |
| 6162 | }, |
| 6163 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6164 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6165 | * 2ch mode |
| 6166 | */ |
| 6167 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6168 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6169 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6170 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6171 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6172 | { } /* end */ |
| 6173 | }; |
| 6174 | |
| 6175 | /* |
| 6176 | * 6ch mode |
| 6177 | */ |
| 6178 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6179 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6180 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6181 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6182 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6183 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6184 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6185 | { } /* end */ |
| 6186 | }; |
| 6187 | |
| 6188 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 6189 | { 2, alc882_3ST_ch2_init }, |
| 6190 | { 6, alc882_3ST_ch6_init }, |
| 6191 | }; |
| 6192 | |
| 6193 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6194 | * 6ch mode |
| 6195 | */ |
| 6196 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6197 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6198 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6199 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6200 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6201 | { } /* end */ |
| 6202 | }; |
| 6203 | |
| 6204 | /* |
| 6205 | * 8ch mode |
| 6206 | */ |
| 6207 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6208 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6209 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6210 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6211 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6212 | { } /* end */ |
| 6213 | }; |
| 6214 | |
| 6215 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6216 | { 6, alc882_sixstack_ch6_init }, |
| 6217 | { 8, alc882_sixstack_ch8_init }, |
| 6218 | }; |
| 6219 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6220 | /* |
| 6221 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 6222 | */ |
| 6223 | |
| 6224 | /* |
| 6225 | * 2ch mode |
| 6226 | */ |
| 6227 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6228 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6229 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6230 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6231 | { } /* end */ |
| 6232 | }; |
| 6233 | |
| 6234 | /* |
| 6235 | * 6ch mode |
| 6236 | */ |
| 6237 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6238 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6239 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6240 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6241 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6242 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6243 | { } /* end */ |
| 6244 | }; |
| 6245 | |
| 6246 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6247 | { 2, alc885_mbp_ch2_init }, |
| 6248 | { 6, alc885_mbp_ch6_init }, |
| 6249 | }; |
| 6250 | |
| 6251 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6252 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6253 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6254 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6255 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6256 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6257 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6258 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6259 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6260 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6261 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6262 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6263 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6264 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6265 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6266 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6267 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6268 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6269 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6270 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6271 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6272 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6273 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6274 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6275 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6276 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6277 | { } /* end */ |
| 6278 | }; |
| 6279 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6280 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6281 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6282 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6283 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6284 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6285 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6286 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6287 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6288 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6289 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6290 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6291 | { } /* end */ |
| 6292 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6293 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6294 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6295 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6296 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6297 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6298 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6299 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6300 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6301 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6302 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6303 | { } /* end */ |
| 6304 | }; |
| 6305 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6306 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6307 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6308 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6309 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6310 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6311 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6312 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6313 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6314 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6315 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6316 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6317 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6318 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6319 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6320 | { } /* end */ |
| 6321 | }; |
| 6322 | |
| 6323 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6324 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6325 | */ |
| 6326 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6327 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6328 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6329 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6330 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6331 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6332 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6333 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6334 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6335 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6336 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6337 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6338 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6339 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6340 | { } /* end */ |
| 6341 | }; |
| 6342 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6343 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6344 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6345 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6346 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6347 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6348 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6349 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6350 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6351 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6352 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6353 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6354 | { } /* end */ |
| 6355 | }; |
| 6356 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6357 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6358 | { |
| 6359 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6360 | .name = "Channel Mode", |
| 6361 | .info = alc_ch_mode_info, |
| 6362 | .get = alc_ch_mode_get, |
| 6363 | .put = alc_ch_mode_put, |
| 6364 | }, |
| 6365 | { } /* end */ |
| 6366 | }; |
| 6367 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6368 | static struct hda_verb alc882_init_verbs[] = { |
| 6369 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6370 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6371 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6372 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6373 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6374 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6375 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6376 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6377 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6378 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6379 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6380 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6381 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6382 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6383 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6384 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6385 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6386 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6387 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6388 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6389 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6390 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6392 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6393 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6394 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6395 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6396 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6397 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6398 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6399 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6400 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6401 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6402 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6403 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6404 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6405 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6406 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6407 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6408 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6409 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6410 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6411 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6412 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6413 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6414 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6415 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6416 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6417 | |
| 6418 | /* FIXME: use matrix-type input source selection */ |
| 6419 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6420 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6421 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6422 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6423 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6424 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6425 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6426 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6427 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6428 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6429 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6430 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6431 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6432 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6433 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6434 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6435 | /* ADC1: mute amp left and right */ |
| 6436 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6437 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6438 | /* ADC2: mute amp left and right */ |
| 6439 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6440 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6441 | /* ADC3: mute amp left and right */ |
| 6442 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6443 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6444 | |
| 6445 | { } |
| 6446 | }; |
| 6447 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6448 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6449 | /* change to EAPD mode */ |
| 6450 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6451 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6452 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6453 | }; |
| 6454 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6455 | /* Mac Pro test */ |
| 6456 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6457 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6458 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6459 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6460 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6461 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6462 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6463 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6464 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6465 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6466 | { } /* end */ |
| 6467 | }; |
| 6468 | |
| 6469 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6470 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6471 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6472 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6473 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6474 | /* Front Pin: output 0 (0x0c) */ |
| 6475 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6476 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6477 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6478 | /* Front Mic pin: input vref at 80% */ |
| 6479 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6480 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6481 | /* Speaker: output */ |
| 6482 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6483 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6484 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6485 | /* Headphone output (output 0 - 0x0c) */ |
| 6486 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6487 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6488 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6489 | |
| 6490 | /* FIXME: use matrix-type input source selection */ |
| 6491 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6492 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6493 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6494 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6495 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6496 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6497 | /* Input mixer2 */ |
| 6498 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6499 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6500 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6501 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6502 | /* Input mixer3 */ |
| 6503 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6504 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6505 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6506 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6507 | /* ADC1: mute amp left and right */ |
| 6508 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6509 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6510 | /* ADC2: mute amp left and right */ |
| 6511 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6512 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6513 | /* ADC3: mute amp left and right */ |
| 6514 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6515 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6516 | |
| 6517 | { } |
| 6518 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6519 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6520 | /* Macbook Pro rev3 */ |
| 6521 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6522 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6523 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6524 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6525 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6526 | /* Rear mixer */ |
| 6527 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6528 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6529 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6530 | /* Front Pin: output 0 (0x0c) */ |
| 6531 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6532 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6533 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6534 | /* HP Pin: output 0 (0x0d) */ |
| 6535 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6536 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6537 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6538 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6539 | /* Mic (rear) pin: input vref at 80% */ |
| 6540 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6541 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6542 | /* Front Mic pin: input vref at 80% */ |
| 6543 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6544 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6545 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6546 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6547 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6548 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6549 | |
| 6550 | /* FIXME: use matrix-type input source selection */ |
| 6551 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6552 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6553 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6554 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6555 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6556 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6557 | /* Input mixer2 */ |
| 6558 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6559 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6560 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6561 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6562 | /* Input mixer3 */ |
| 6563 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6564 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6565 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6566 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6567 | /* ADC1: mute amp left and right */ |
| 6568 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6569 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6570 | /* ADC2: mute amp left and right */ |
| 6571 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6572 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6573 | /* ADC3: mute amp left and right */ |
| 6574 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6575 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6576 | |
| 6577 | { } |
| 6578 | }; |
| 6579 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6580 | /* iMac 24 mixer. */ |
| 6581 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6582 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6583 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6584 | { } /* end */ |
| 6585 | }; |
| 6586 | |
| 6587 | /* iMac 24 init verbs. */ |
| 6588 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6589 | /* Internal speakers: output 0 (0x0c) */ |
| 6590 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6591 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6592 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6593 | /* Internal speakers: output 0 (0x0c) */ |
| 6594 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6595 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6596 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6597 | /* Headphone: output 0 (0x0c) */ |
| 6598 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6599 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6600 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6601 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6602 | /* Front Mic: input vref at 80% */ |
| 6603 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6604 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6605 | { } |
| 6606 | }; |
| 6607 | |
| 6608 | /* Toggle speaker-output according to the hp-jack state */ |
| 6609 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 6610 | { |
| 6611 | unsigned int present; |
| 6612 | |
| 6613 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6614 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6615 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 6616 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6617 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 6618 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6619 | } |
| 6620 | |
| 6621 | /* Processes unsolicited events. */ |
| 6622 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 6623 | unsigned int res) |
| 6624 | { |
| 6625 | /* Headphone insertion or removal. */ |
| 6626 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6627 | alc885_imac24_automute(codec); |
| 6628 | } |
| 6629 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6630 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6631 | { |
| 6632 | unsigned int present; |
| 6633 | |
| 6634 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6635 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6636 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6637 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6638 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6639 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6640 | |
| 6641 | } |
| 6642 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6643 | unsigned int res) |
| 6644 | { |
| 6645 | /* Headphone insertion or removal. */ |
| 6646 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6647 | alc885_mbp3_automute(codec); |
| 6648 | } |
| 6649 | |
| 6650 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6651 | static struct hda_verb alc882_targa_verbs[] = { |
| 6652 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6653 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6654 | |
| 6655 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6656 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6657 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6658 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6659 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6660 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6661 | |
| 6662 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6663 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6664 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6665 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6666 | { } /* end */ |
| 6667 | }; |
| 6668 | |
| 6669 | /* toggle speaker-output according to the hp-jack state */ |
| 6670 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6671 | { |
| 6672 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6673 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6674 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6675 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6676 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6677 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6678 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6679 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6680 | } |
| 6681 | |
| 6682 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6683 | { |
| 6684 | /* Looks like the unsol event is incompatible with the standard |
| 6685 | * definition. 4bit tag is placed at 26 bit! |
| 6686 | */ |
| 6687 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6688 | alc882_targa_automute(codec); |
| 6689 | } |
| 6690 | } |
| 6691 | |
| 6692 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6693 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6694 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6695 | |
| 6696 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6697 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6698 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6699 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6700 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6701 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6702 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6703 | |
| 6704 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6705 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6706 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6707 | { } /* end */ |
| 6708 | }; |
| 6709 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6710 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6711 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6712 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6713 | |
| 6714 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6715 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6716 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6717 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6718 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6719 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6720 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6721 | |
| 6722 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6723 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6724 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6725 | { } /* end */ |
| 6726 | }; |
| 6727 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6728 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6729 | { |
| 6730 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6731 | |
| 6732 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6733 | AC_VERB_GET_GPIO_DATA, 0); |
| 6734 | |
| 6735 | if (!muted) |
| 6736 | gpiostate |= (1 << pin); |
| 6737 | else |
| 6738 | gpiostate &= ~(1 << pin); |
| 6739 | |
| 6740 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6741 | AC_VERB_GET_GPIO_MASK, 0); |
| 6742 | gpiomask |= (1 << pin); |
| 6743 | |
| 6744 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6745 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6746 | gpiodir |= (1 << pin); |
| 6747 | |
| 6748 | |
| 6749 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6750 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6751 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6752 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6753 | |
| 6754 | msleep(1); |
| 6755 | |
| 6756 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6757 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6758 | } |
| 6759 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6760 | /* set up GPIO at initialization */ |
| 6761 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6762 | { |
| 6763 | alc882_gpio_mute(codec, 0, 0); |
| 6764 | alc882_gpio_mute(codec, 1, 0); |
| 6765 | } |
| 6766 | |
| 6767 | /* set up GPIO and update auto-muting at initialization */ |
| 6768 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6769 | { |
| 6770 | alc885_macpro_init_hook(codec); |
| 6771 | alc885_imac24_automute(codec); |
| 6772 | } |
| 6773 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6774 | /* |
| 6775 | * generic initialization of ADC, input mixers and output mixers |
| 6776 | */ |
| 6777 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6778 | /* |
| 6779 | * Unmute ADC0-2 and set the default input to mic-in |
| 6780 | */ |
| 6781 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6782 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6783 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6784 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6785 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6786 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6787 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6788 | /* 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] | 6789 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6790 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6791 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6792 | */ |
| 6793 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6794 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6795 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6796 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6797 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6798 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6799 | |
| 6800 | /* |
| 6801 | * Set up output mixers (0x0c - 0x0f) |
| 6802 | */ |
| 6803 | /* set vol=0 to output mixers */ |
| 6804 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6805 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6806 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6807 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6808 | /* set up input amps for analog loopback */ |
| 6809 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6810 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6811 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6812 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6813 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6814 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6815 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6816 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6817 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6818 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6819 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6820 | |
| 6821 | /* FIXME: use matrix-type input source selection */ |
| 6822 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6823 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6824 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6825 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6826 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6827 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6828 | /* Input mixer2 */ |
| 6829 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6830 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6831 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6832 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6833 | /* Input mixer3 */ |
| 6834 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6835 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6836 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6837 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6838 | |
| 6839 | { } |
| 6840 | }; |
| 6841 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6842 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6843 | #define alc882_loopbacks alc880_loopbacks |
| 6844 | #endif |
| 6845 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6846 | /* pcm configuration: identiacal with ALC880 */ |
| 6847 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6848 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6849 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6850 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6851 | |
| 6852 | /* |
| 6853 | * configuration and preset |
| 6854 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6855 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6856 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6857 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6858 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6859 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6860 | [ALC882_TARGA] = "targa", |
| 6861 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6862 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6863 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6864 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6865 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6866 | [ALC882_AUTO] = "auto", |
| 6867 | }; |
| 6868 | |
| 6869 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6870 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6871 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6872 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6873 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6874 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6875 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6876 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6877 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6878 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6879 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6880 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6881 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6882 | {} |
| 6883 | }; |
| 6884 | |
| 6885 | static struct alc_config_preset alc882_presets[] = { |
| 6886 | [ALC882_3ST_DIG] = { |
| 6887 | .mixers = { alc882_base_mixer }, |
| 6888 | .init_verbs = { alc882_init_verbs }, |
| 6889 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6890 | .dac_nids = alc882_dac_nids, |
| 6891 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6892 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6893 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6894 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6895 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6896 | .input_mux = &alc882_capture_source, |
| 6897 | }, |
| 6898 | [ALC882_6ST_DIG] = { |
| 6899 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6900 | .init_verbs = { alc882_init_verbs }, |
| 6901 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6902 | .dac_nids = alc882_dac_nids, |
| 6903 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6904 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6905 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6906 | .channel_mode = alc882_sixstack_modes, |
| 6907 | .input_mux = &alc882_capture_source, |
| 6908 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6909 | [ALC882_ARIMA] = { |
| 6910 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6911 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6912 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6913 | .dac_nids = alc882_dac_nids, |
| 6914 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6915 | .channel_mode = alc882_sixstack_modes, |
| 6916 | .input_mux = &alc882_capture_source, |
| 6917 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6918 | [ALC882_W2JC] = { |
| 6919 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6920 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6921 | alc880_gpio1_init_verbs }, |
| 6922 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6923 | .dac_nids = alc882_dac_nids, |
| 6924 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6925 | .channel_mode = alc880_threestack_modes, |
| 6926 | .need_dac_fix = 1, |
| 6927 | .input_mux = &alc882_capture_source, |
| 6928 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6929 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6930 | [ALC885_MBP3] = { |
| 6931 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6932 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6933 | alc880_gpio1_init_verbs }, |
| 6934 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6935 | .dac_nids = alc882_dac_nids, |
| 6936 | .channel_mode = alc885_mbp_6ch_modes, |
| 6937 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6938 | .input_mux = &alc882_capture_source, |
| 6939 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6940 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6941 | .unsol_event = alc885_mbp3_unsol_event, |
| 6942 | .init_hook = alc885_mbp3_automute, |
| 6943 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6944 | [ALC885_MACPRO] = { |
| 6945 | .mixers = { alc882_macpro_mixer }, |
| 6946 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6947 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6948 | .dac_nids = alc882_dac_nids, |
| 6949 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6950 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6951 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6952 | .channel_mode = alc882_ch_modes, |
| 6953 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6954 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6955 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6956 | [ALC885_IMAC24] = { |
| 6957 | .mixers = { alc885_imac24_mixer }, |
| 6958 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6959 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6960 | .dac_nids = alc882_dac_nids, |
| 6961 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6962 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6963 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6964 | .channel_mode = alc882_ch_modes, |
| 6965 | .input_mux = &alc882_capture_source, |
| 6966 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6967 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6968 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6969 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6970 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6971 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6972 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6973 | .dac_nids = alc882_dac_nids, |
| 6974 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6975 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6976 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6977 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6978 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6979 | .channel_mode = alc882_3ST_6ch_modes, |
| 6980 | .need_dac_fix = 1, |
| 6981 | .input_mux = &alc882_capture_source, |
| 6982 | .unsol_event = alc882_targa_unsol_event, |
| 6983 | .init_hook = alc882_targa_automute, |
| 6984 | }, |
| 6985 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6986 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6987 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6988 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6989 | .dac_nids = alc882_dac_nids, |
| 6990 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6991 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6992 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6993 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6994 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6995 | .channel_mode = alc882_3ST_6ch_modes, |
| 6996 | .need_dac_fix = 1, |
| 6997 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6998 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6999 | [ALC882_ASUS_A7M] = { |
| 7000 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 7001 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 7002 | alc880_gpio1_init_verbs, |
| 7003 | alc882_asus_a7m_verbs }, |
| 7004 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7005 | .dac_nids = alc882_dac_nids, |
| 7006 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7007 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 7008 | .channel_mode = alc880_threestack_modes, |
| 7009 | .need_dac_fix = 1, |
| 7010 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7011 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7012 | }; |
| 7013 | |
| 7014 | |
| 7015 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7016 | * Pin config fixes |
| 7017 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7018 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7019 | PINFIX_ABIT_AW9D_MAX |
| 7020 | }; |
| 7021 | |
| 7022 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 7023 | { 0x15, 0x01080104 }, /* side */ |
| 7024 | { 0x16, 0x01011012 }, /* rear */ |
| 7025 | { 0x17, 0x01016011 }, /* clfe */ |
| 7026 | { } |
| 7027 | }; |
| 7028 | |
| 7029 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 7030 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 7031 | }; |
| 7032 | |
| 7033 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 7034 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 7035 | {} |
| 7036 | }; |
| 7037 | |
| 7038 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7039 | * BIOS auto configuration |
| 7040 | */ |
| 7041 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7042 | hda_nid_t nid, int pin_type, |
| 7043 | int dac_idx) |
| 7044 | { |
| 7045 | /* set as output */ |
| 7046 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7047 | int idx; |
| 7048 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7049 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7050 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7051 | idx = 4; |
| 7052 | else |
| 7053 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7054 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7055 | |
| 7056 | } |
| 7057 | |
| 7058 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 7059 | { |
| 7060 | struct alc_spec *spec = codec->spec; |
| 7061 | int i; |
| 7062 | |
| 7063 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7064 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7065 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7066 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7067 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7068 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7069 | } |
| 7070 | } |
| 7071 | |
| 7072 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 7073 | { |
| 7074 | struct alc_spec *spec = codec->spec; |
| 7075 | hda_nid_t pin; |
| 7076 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7077 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7078 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7079 | /* use dac 0 */ |
| 7080 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7081 | pin = spec->autocfg.speaker_pins[0]; |
| 7082 | if (pin) |
| 7083 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7084 | } |
| 7085 | |
| 7086 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7087 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 7088 | |
| 7089 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 7090 | { |
| 7091 | struct alc_spec *spec = codec->spec; |
| 7092 | int i; |
| 7093 | |
| 7094 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7095 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7096 | if (!nid) |
| 7097 | continue; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 7098 | alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7099 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 7100 | snd_hda_codec_write(codec, nid, 0, |
| 7101 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7102 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7103 | } |
| 7104 | } |
| 7105 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7106 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 7107 | { |
| 7108 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7109 | int c; |
| 7110 | |
| 7111 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 7112 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 7113 | hda_nid_t nid = spec->capsrc_nids[c]; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7114 | unsigned int mux_idx; |
| 7115 | const struct hda_input_mux *imux; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7116 | int conns, mute, idx, item; |
| 7117 | |
| 7118 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 7119 | ARRAY_SIZE(conn_list)); |
| 7120 | if (conns < 0) |
| 7121 | continue; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7122 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 7123 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7124 | for (idx = 0; idx < conns; idx++) { |
| 7125 | /* if the current connection is the selected one, |
| 7126 | * unmute it as default - otherwise mute it |
| 7127 | */ |
| 7128 | mute = AMP_IN_MUTE(idx); |
| 7129 | for (item = 0; item < imux->num_items; item++) { |
| 7130 | if (imux->items[item].index == idx) { |
| 7131 | if (spec->cur_mux[c] == item) |
| 7132 | mute = AMP_IN_UNMUTE(idx); |
| 7133 | break; |
| 7134 | } |
| 7135 | } |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7136 | /* check if we have a selector or mixer |
| 7137 | * we could check for the widget type instead, but |
| 7138 | * just check for Amp-In presence (in case of mixer |
| 7139 | * without amp-in there is something wrong, this |
| 7140 | * function shouldn't be used or capsrc nid is wrong) |
| 7141 | */ |
| 7142 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
| 7143 | snd_hda_codec_write(codec, nid, 0, |
| 7144 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7145 | mute); |
| 7146 | else if (mute != AMP_IN_MUTE(idx)) |
| 7147 | snd_hda_codec_write(codec, nid, 0, |
| 7148 | AC_VERB_SET_CONNECT_SEL, |
| 7149 | idx); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7150 | } |
| 7151 | } |
| 7152 | } |
| 7153 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7154 | /* add mic boosts if needed */ |
| 7155 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 7156 | { |
| 7157 | struct alc_spec *spec = codec->spec; |
| 7158 | int err; |
| 7159 | hda_nid_t nid; |
| 7160 | |
| 7161 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7162 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7163 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7164 | "Mic Boost", |
| 7165 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7166 | if (err < 0) |
| 7167 | return err; |
| 7168 | } |
| 7169 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7170 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7171 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7172 | "Front Mic Boost", |
| 7173 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7174 | if (err < 0) |
| 7175 | return err; |
| 7176 | } |
| 7177 | return 0; |
| 7178 | } |
| 7179 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7180 | /* almost identical with ALC880 parser... */ |
| 7181 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 7182 | { |
| 7183 | struct alc_spec *spec = codec->spec; |
| 7184 | int err = alc880_parse_auto_config(codec); |
| 7185 | |
| 7186 | if (err < 0) |
| 7187 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7188 | else if (!err) |
| 7189 | return 0; /* no config found */ |
| 7190 | |
| 7191 | err = alc_auto_add_mic_boost(codec); |
| 7192 | if (err < 0) |
| 7193 | return err; |
| 7194 | |
| 7195 | /* hack - override the init verbs */ |
| 7196 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7197 | |
| 7198 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7199 | } |
| 7200 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7201 | /* additional initialization for auto-configuration model */ |
| 7202 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7203 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7204 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7205 | alc882_auto_init_multi_out(codec); |
| 7206 | alc882_auto_init_hp_out(codec); |
| 7207 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7208 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7209 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7210 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7211 | } |
| 7212 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7213 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7214 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7215 | static int patch_alc882(struct hda_codec *codec) |
| 7216 | { |
| 7217 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7218 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7219 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7220 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7221 | if (spec == NULL) |
| 7222 | return -ENOMEM; |
| 7223 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7224 | codec->spec = spec; |
| 7225 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7226 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7227 | alc882_models, |
| 7228 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7229 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7230 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7231 | /* Pick up systems that don't supply PCI SSID */ |
| 7232 | switch (codec->subsystem_id) { |
| 7233 | case 0x106b0c00: /* Mac Pro */ |
| 7234 | board_config = ALC885_MACPRO; |
| 7235 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7236 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7237 | case 0x106b2800: /* AppleTV */ |
Mark Eggleston | 3077e44 | 2009-01-31 17:57:54 +0100 | [diff] [blame] | 7238 | case 0x106b3e00: /* iMac 24 Aluminium */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7239 | board_config = ALC885_IMAC24; |
| 7240 | break; |
Luke Yelavich | 2d46638 | 2009-02-23 13:00:33 +1100 | [diff] [blame] | 7241 | case 0x106b00a0: /* MacBookPro3,1 - Another revision */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7242 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7243 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7244 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7245 | case 0x106b3600: /* Macbook 3.1 */ |
Luke Yelavich | 2a88464 | 2009-01-28 15:58:38 +1100 | [diff] [blame] | 7246 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7247 | board_config = ALC885_MBP3; |
| 7248 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7249 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7250 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7251 | if (codec->revision_id == 0x100101 || |
| 7252 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7253 | alc_free(codec); |
| 7254 | return patch_alc883(codec); |
| 7255 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7256 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 7257 | "trying auto-probe from BIOS...\n"); |
| 7258 | board_config = ALC882_AUTO; |
| 7259 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7260 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7261 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7262 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7263 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7264 | if (board_config == ALC882_AUTO) { |
| 7265 | /* automatic parse from the BIOS config */ |
| 7266 | err = alc882_parse_auto_config(codec); |
| 7267 | if (err < 0) { |
| 7268 | alc_free(codec); |
| 7269 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7270 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7271 | printk(KERN_INFO |
| 7272 | "hda_codec: Cannot set up configuration " |
| 7273 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7274 | board_config = ALC882_3ST_DIG; |
| 7275 | } |
| 7276 | } |
| 7277 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7278 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7279 | if (err < 0) { |
| 7280 | alc_free(codec); |
| 7281 | return err; |
| 7282 | } |
| 7283 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7284 | if (board_config != ALC882_AUTO) |
| 7285 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7286 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 7287 | if (codec->vendor_id == 0x10ec0885) { |
| 7288 | spec->stream_name_analog = "ALC885 Analog"; |
| 7289 | spec->stream_name_digital = "ALC885 Digital"; |
| 7290 | } else { |
| 7291 | spec->stream_name_analog = "ALC882 Analog"; |
| 7292 | spec->stream_name_digital = "ALC882 Digital"; |
| 7293 | } |
| 7294 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7295 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7296 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7297 | /* FIXME: setup DAC5 */ |
| 7298 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7299 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7300 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7301 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7302 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7303 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7304 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7305 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7306 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7307 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7308 | /* get type */ |
| 7309 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7310 | if (wcap != AC_WID_AUD_IN) { |
| 7311 | spec->adc_nids = alc882_adc_nids_alt; |
| 7312 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7313 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7314 | } else { |
| 7315 | spec->adc_nids = alc882_adc_nids; |
| 7316 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7317 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7318 | } |
| 7319 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7320 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7321 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7322 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7323 | spec->vmaster_nid = 0x0c; |
| 7324 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7325 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7326 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7327 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7328 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7329 | if (!spec->loopback.amplist) |
| 7330 | spec->loopback.amplist = alc882_loopbacks; |
| 7331 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7332 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7333 | |
| 7334 | return 0; |
| 7335 | } |
| 7336 | |
| 7337 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7338 | * ALC883 support |
| 7339 | * |
| 7340 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7341 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7342 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7343 | * 6-channel independent captures. |
| 7344 | * |
| 7345 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7346 | * driver yet). |
| 7347 | */ |
| 7348 | #define ALC883_DIGOUT_NID 0x06 |
| 7349 | #define ALC883_DIGIN_NID 0x0a |
| 7350 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7351 | #define ALC1200_DIGOUT_NID 0x10 |
| 7352 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7353 | static hda_nid_t alc883_dac_nids[4] = { |
| 7354 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7355 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7356 | }; |
| 7357 | |
| 7358 | static hda_nid_t alc883_adc_nids[2] = { |
| 7359 | /* ADC1-2 */ |
| 7360 | 0x08, 0x09, |
| 7361 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7362 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7363 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7364 | /* ADC1 */ |
| 7365 | 0x08, |
| 7366 | }; |
| 7367 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7368 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7369 | /* ADC2-1 */ |
| 7370 | 0x09, 0x08 |
| 7371 | }; |
| 7372 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7373 | #define alc889_adc_nids alc880_adc_nids |
| 7374 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7375 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7376 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7377 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7378 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7379 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7380 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7381 | /* input MUX */ |
| 7382 | /* FIXME: should be a matrix-type input source selection */ |
| 7383 | |
| 7384 | static struct hda_input_mux alc883_capture_source = { |
| 7385 | .num_items = 4, |
| 7386 | .items = { |
| 7387 | { "Mic", 0x0 }, |
| 7388 | { "Front Mic", 0x1 }, |
| 7389 | { "Line", 0x2 }, |
| 7390 | { "CD", 0x4 }, |
| 7391 | }, |
| 7392 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7393 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7394 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7395 | .num_items = 4, |
| 7396 | .items = { |
| 7397 | { "Mic", 0x1 }, |
| 7398 | { "Front Mic", 0x0 }, |
| 7399 | { "Line", 0x2 }, |
| 7400 | { "CD", 0x4 }, |
| 7401 | }, |
| 7402 | }; |
| 7403 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7404 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7405 | .num_items = 2, |
| 7406 | .items = { |
| 7407 | { "Mic", 0x1 }, |
| 7408 | { "Line", 0x2 }, |
| 7409 | }, |
| 7410 | }; |
| 7411 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7412 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7413 | .num_items = 4, |
| 7414 | .items = { |
| 7415 | { "Mic", 0x0 }, |
| 7416 | { "iMic", 0x1 }, |
| 7417 | { "Line", 0x2 }, |
| 7418 | { "CD", 0x4 }, |
| 7419 | }, |
| 7420 | }; |
| 7421 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7422 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7423 | .num_items = 2, |
| 7424 | .items = { |
| 7425 | { "Mic", 0x0 }, |
| 7426 | { "Int Mic", 0x1 }, |
| 7427 | }, |
| 7428 | }; |
| 7429 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7430 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7431 | .num_items = 3, |
| 7432 | .items = { |
| 7433 | { "Mic", 0x0 }, |
| 7434 | { "Front Mic", 0x1 }, |
| 7435 | { "Line", 0x4 }, |
| 7436 | }, |
| 7437 | }; |
| 7438 | |
| 7439 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7440 | .num_items = 2, |
| 7441 | .items = { |
| 7442 | { "Mic", 0x0 }, |
| 7443 | { "Line", 0x2 }, |
| 7444 | }, |
| 7445 | }; |
| 7446 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7447 | /* |
| 7448 | * 2ch mode |
| 7449 | */ |
| 7450 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7451 | { 2, NULL } |
| 7452 | }; |
| 7453 | |
| 7454 | /* |
| 7455 | * 2ch mode |
| 7456 | */ |
| 7457 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7458 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7459 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7460 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7461 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7462 | { } /* end */ |
| 7463 | }; |
| 7464 | |
| 7465 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7466 | * 4ch mode |
| 7467 | */ |
| 7468 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7469 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7470 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7471 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7472 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7473 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7474 | { } /* end */ |
| 7475 | }; |
| 7476 | |
| 7477 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7478 | * 6ch mode |
| 7479 | */ |
| 7480 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7481 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7482 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7483 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7484 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7485 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7486 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7487 | { } /* end */ |
| 7488 | }; |
| 7489 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7490 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7491 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7492 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7493 | { 6, alc883_3ST_ch6_init }, |
| 7494 | }; |
| 7495 | |
| 7496 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7497 | * 2ch mode |
| 7498 | */ |
| 7499 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7500 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7501 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7502 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7503 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7504 | { } /* end */ |
| 7505 | }; |
| 7506 | |
| 7507 | /* |
| 7508 | * 4ch mode |
| 7509 | */ |
| 7510 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7511 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7512 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7513 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7514 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7515 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7516 | { } /* end */ |
| 7517 | }; |
| 7518 | |
| 7519 | /* |
| 7520 | * 6ch mode |
| 7521 | */ |
| 7522 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7523 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7524 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7525 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7526 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7527 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7528 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7529 | { } /* end */ |
| 7530 | }; |
| 7531 | |
| 7532 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7533 | { 2, alc883_3ST_ch2_intel_init }, |
| 7534 | { 4, alc883_3ST_ch4_intel_init }, |
| 7535 | { 6, alc883_3ST_ch6_intel_init }, |
| 7536 | }; |
| 7537 | |
| 7538 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7539 | * 6ch mode |
| 7540 | */ |
| 7541 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7542 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7543 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7544 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7545 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7546 | { } /* end */ |
| 7547 | }; |
| 7548 | |
| 7549 | /* |
| 7550 | * 8ch mode |
| 7551 | */ |
| 7552 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7553 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7554 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7555 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7556 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7557 | { } /* end */ |
| 7558 | }; |
| 7559 | |
| 7560 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7561 | { 6, alc883_sixstack_ch6_init }, |
| 7562 | { 8, alc883_sixstack_ch8_init }, |
| 7563 | }; |
| 7564 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7565 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7566 | /* eanable EAPD on medion laptop */ |
| 7567 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7568 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7569 | { } |
| 7570 | }; |
| 7571 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7572 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7573 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7574 | */ |
| 7575 | |
| 7576 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7577 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7578 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7579 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7580 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7581 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7582 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7583 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7584 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7585 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7586 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7587 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7588 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7589 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7590 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7591 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7592 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7593 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7594 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7595 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7596 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7597 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7598 | { } /* end */ |
| 7599 | }; |
| 7600 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7601 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7602 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7603 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7604 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7605 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7606 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7607 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7608 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7609 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7610 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7611 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7612 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7613 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7614 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7615 | { } /* end */ |
| 7616 | }; |
| 7617 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7618 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7619 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7620 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7621 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7622 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7623 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7624 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7625 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7626 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7627 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7628 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7629 | { } /* end */ |
| 7630 | }; |
| 7631 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7632 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7633 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7634 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7635 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7636 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7637 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7638 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7640 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7641 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7642 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7643 | { } /* end */ |
| 7644 | }; |
| 7645 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7646 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7647 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7648 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7649 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7650 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7651 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7652 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7653 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7654 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7655 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7656 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7657 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7658 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7659 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7660 | { } /* end */ |
| 7661 | }; |
| 7662 | |
| 7663 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7664 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7665 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7666 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7667 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7668 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7669 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7670 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7671 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7672 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7673 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7674 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7675 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7676 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7677 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7678 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7679 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7680 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7681 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7682 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7683 | { } /* end */ |
| 7684 | }; |
| 7685 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7686 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7687 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7688 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7689 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7690 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7691 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7692 | HDA_OUTPUT), |
| 7693 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7694 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7695 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7696 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7697 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7698 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7699 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7700 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7701 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7702 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7703 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7704 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7705 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7706 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7707 | { } /* end */ |
| 7708 | }; |
| 7709 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7710 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7711 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7712 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7713 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7714 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7715 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7716 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7717 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7718 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7719 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7720 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7721 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7722 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7723 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7724 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7725 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7726 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7727 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7728 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7729 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7730 | { } /* end */ |
| 7731 | }; |
| 7732 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7733 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7734 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7735 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7736 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7737 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7738 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7739 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7740 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7741 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7742 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7743 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7744 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7745 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7746 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7747 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7748 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7749 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7750 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7751 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7752 | |
| 7753 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7754 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7755 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7756 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7757 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7758 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7759 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7760 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7761 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7762 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7763 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7764 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7765 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7766 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7767 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7768 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7769 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7770 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7771 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7772 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7773 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7774 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7775 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7776 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7777 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7778 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7779 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7780 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7781 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7782 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7783 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7784 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7785 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7786 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7787 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7788 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7789 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7790 | { } /* end */ |
| 7791 | }; |
| 7792 | |
| 7793 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7794 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7795 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7796 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7797 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7798 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7799 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7800 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7801 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7802 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7803 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7804 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7805 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7806 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7807 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7808 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7809 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7810 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7811 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7812 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7813 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7814 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7815 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7816 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7817 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7818 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7819 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7820 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7821 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7822 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7823 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7824 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7825 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7826 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7827 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7828 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7829 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7830 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7831 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7832 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7833 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7834 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7835 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7836 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7837 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7838 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7839 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7840 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7841 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7842 | { } /* end */ |
| 7843 | }; |
| 7844 | |
| 7845 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7846 | .ops = &snd_hda_bind_vol, |
| 7847 | .values = { |
| 7848 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7849 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7850 | 0 |
| 7851 | }, |
| 7852 | }; |
| 7853 | |
| 7854 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7855 | .ops = &snd_hda_bind_sw, |
| 7856 | .values = { |
| 7857 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7858 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7859 | 0 |
| 7860 | }, |
| 7861 | }; |
| 7862 | |
| 7863 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7864 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7865 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7866 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7867 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7868 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7869 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7870 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7871 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7872 | { } /* end */ |
| 7873 | }; |
| 7874 | |
| 7875 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7876 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7877 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7878 | { |
| 7879 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7880 | /* .name = "Capture Source", */ |
| 7881 | .name = "Input Source", |
| 7882 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7883 | .info = alc_mux_enum_info, |
| 7884 | .get = alc_mux_enum_get, |
| 7885 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7886 | }, |
| 7887 | { } /* end */ |
| 7888 | }; |
| 7889 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7890 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7891 | { |
| 7892 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7893 | .name = "Channel Mode", |
| 7894 | .info = alc_ch_mode_info, |
| 7895 | .get = alc_ch_mode_get, |
| 7896 | .put = alc_ch_mode_put, |
| 7897 | }, |
| 7898 | { } /* end */ |
| 7899 | }; |
| 7900 | |
| 7901 | static struct hda_verb alc883_init_verbs[] = { |
| 7902 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7903 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7904 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7905 | /* ADC2: mute amp left and right */ |
| 7906 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7907 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7908 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7909 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7910 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7911 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7912 | /* Rear mixer */ |
| 7913 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7914 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7915 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7916 | /* CLFE mixer */ |
| 7917 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7918 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7919 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7920 | /* Side mixer */ |
| 7921 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7922 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7923 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7924 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7925 | /* mute analog input loopbacks */ |
| 7926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7927 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7928 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7929 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7930 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7931 | |
| 7932 | /* Front Pin: output 0 (0x0c) */ |
| 7933 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7934 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7935 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7936 | /* Rear Pin: output 1 (0x0d) */ |
| 7937 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7938 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7939 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7940 | /* CLFE Pin: output 2 (0x0e) */ |
| 7941 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7942 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7943 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7944 | /* Side Pin: output 3 (0x0f) */ |
| 7945 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7946 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7947 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7948 | /* Mic (rear) pin: input vref at 80% */ |
| 7949 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7950 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7951 | /* Front Mic pin: input vref at 80% */ |
| 7952 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7953 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7954 | /* Line In pin: input */ |
| 7955 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7956 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7957 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7958 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7959 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7960 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7961 | /* CD pin widget for input */ |
| 7962 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7963 | |
| 7964 | /* FIXME: use matrix-type input source selection */ |
| 7965 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7966 | /* Input mixer2 */ |
| 7967 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7968 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7969 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7970 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7971 | /* Input mixer3 */ |
| 7972 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7973 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7974 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7975 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7976 | { } |
| 7977 | }; |
| 7978 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7979 | /* toggle speaker-output according to the hp-jack state */ |
| 7980 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7981 | { |
| 7982 | unsigned int present; |
| 7983 | |
| 7984 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7985 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7986 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7987 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7988 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7989 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7990 | } |
| 7991 | |
| 7992 | /* auto-toggle front mic */ |
| 7993 | /* |
| 7994 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7995 | { |
| 7996 | unsigned int present; |
| 7997 | unsigned char bits; |
| 7998 | |
| 7999 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8000 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8001 | bits = present ? HDA_AMP_MUTE : 0; |
| 8002 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8003 | } |
| 8004 | */ |
| 8005 | |
| 8006 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 8007 | { |
| 8008 | alc883_mitac_hp_automute(codec); |
| 8009 | /* alc883_mitac_mic_automute(codec); */ |
| 8010 | } |
| 8011 | |
| 8012 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 8013 | unsigned int res) |
| 8014 | { |
| 8015 | switch (res >> 26) { |
| 8016 | case ALC880_HP_EVENT: |
| 8017 | alc883_mitac_hp_automute(codec); |
| 8018 | break; |
| 8019 | case ALC880_MIC_EVENT: |
| 8020 | /* alc883_mitac_mic_automute(codec); */ |
| 8021 | break; |
| 8022 | } |
| 8023 | } |
| 8024 | |
| 8025 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8026 | /* HP */ |
| 8027 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8028 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8029 | /* Subwoofer */ |
| 8030 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8031 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8032 | |
| 8033 | /* enable unsolicited event */ |
| 8034 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8035 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8036 | |
| 8037 | { } /* end */ |
| 8038 | }; |
| 8039 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8040 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8041 | /* HP */ |
| 8042 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8043 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8044 | /* Int speaker */ |
| 8045 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8046 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8047 | |
| 8048 | /* enable unsolicited event */ |
| 8049 | {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] | 8050 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8051 | |
| 8052 | { } /* end */ |
| 8053 | }; |
| 8054 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8055 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8056 | /* HP */ |
| 8057 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8058 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8059 | /* Subwoofer */ |
| 8060 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8061 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8062 | |
| 8063 | /* enable unsolicited event */ |
| 8064 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8065 | |
| 8066 | { } /* end */ |
| 8067 | }; |
| 8068 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8069 | static struct hda_verb alc883_tagra_verbs[] = { |
| 8070 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8071 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8072 | |
| 8073 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8074 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8075 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8076 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8077 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8078 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8079 | |
| 8080 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8081 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 8082 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 8083 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8084 | |
| 8085 | { } /* end */ |
| 8086 | }; |
| 8087 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8088 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8089 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8090 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8091 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8092 | { } /* end */ |
| 8093 | }; |
| 8094 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8095 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8096 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8097 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8098 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8099 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8100 | { } /* end */ |
| 8101 | }; |
| 8102 | |
| 8103 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8104 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8105 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8106 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8107 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8108 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8109 | { } /* end */ |
| 8110 | }; |
| 8111 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8112 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8113 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8114 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8115 | |
| 8116 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8117 | |
| 8118 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8119 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8120 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8121 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8122 | { } /* end */ |
| 8123 | }; |
| 8124 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8125 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8126 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8127 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8128 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8129 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8130 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8131 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8132 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8133 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8134 | { } /* end */ |
| 8135 | }; |
| 8136 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8137 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8138 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8139 | { } |
| 8140 | }; |
| 8141 | |
| 8142 | static void alc888_3st_hp_front_automute(struct hda_codec *codec) |
| 8143 | { |
| 8144 | unsigned int present, bits; |
| 8145 | |
| 8146 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8147 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8148 | bits = present ? HDA_AMP_MUTE : 0; |
| 8149 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8150 | HDA_AMP_MUTE, bits); |
| 8151 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8152 | HDA_AMP_MUTE, bits); |
| 8153 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 8154 | HDA_AMP_MUTE, bits); |
| 8155 | } |
| 8156 | |
| 8157 | static void alc888_3st_hp_unsol_event(struct hda_codec *codec, |
| 8158 | unsigned int res) |
| 8159 | { |
| 8160 | switch (res >> 26) { |
| 8161 | case ALC880_HP_EVENT: |
| 8162 | alc888_3st_hp_front_automute(codec); |
| 8163 | break; |
| 8164 | } |
| 8165 | } |
| 8166 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8167 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8168 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8169 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8170 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8171 | {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] | 8172 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8173 | }; |
| 8174 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8175 | /* |
| 8176 | * 2ch mode |
| 8177 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8178 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8179 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8180 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8181 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8182 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8183 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8184 | }; |
| 8185 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8186 | /* |
| 8187 | * 4ch mode |
| 8188 | */ |
| 8189 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8190 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8191 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8192 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8193 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8194 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8195 | { } /* end */ |
| 8196 | }; |
| 8197 | |
| 8198 | /* |
| 8199 | * 6ch mode |
| 8200 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8201 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8202 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8203 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8204 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8205 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8206 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8207 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8208 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8209 | }; |
| 8210 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8211 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8212 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8213 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8214 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8215 | }; |
| 8216 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8217 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8218 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8219 | { |
| 8220 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8221 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8222 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8223 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8224 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8225 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8226 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8227 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8228 | } |
| 8229 | |
| 8230 | /* toggle RCA according to the front-jack state */ |
| 8231 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8232 | { |
| 8233 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8234 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8235 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8236 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8237 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8238 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8239 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8240 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8241 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8242 | unsigned int res) |
| 8243 | { |
| 8244 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8245 | alc888_lenovo_ms7195_front_automute(codec); |
| 8246 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8247 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8248 | } |
| 8249 | |
| 8250 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8251 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8253 | |
| 8254 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8255 | |
| 8256 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8257 | { } /* end */ |
| 8258 | }; |
| 8259 | |
| 8260 | /* toggle speaker-output according to the hp-jack state */ |
| 8261 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 8262 | { |
| 8263 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8264 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8265 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8266 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8267 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8268 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8269 | } |
| 8270 | |
| 8271 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 8272 | unsigned int res) |
| 8273 | { |
| 8274 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8275 | alc883_medion_md2_automute(codec); |
| 8276 | } |
| 8277 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8278 | /* toggle speaker-output according to the hp-jack state */ |
| 8279 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 8280 | { |
| 8281 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8282 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8283 | |
| 8284 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8285 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8286 | bits = present ? HDA_AMP_MUTE : 0; |
| 8287 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8288 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8289 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 8290 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8291 | } |
| 8292 | |
| 8293 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8294 | { |
| 8295 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8296 | alc883_tagra_automute(codec); |
| 8297 | } |
| 8298 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8299 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8300 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8301 | { |
| 8302 | unsigned int present; |
| 8303 | unsigned char bits; |
| 8304 | |
| 8305 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8306 | & AC_PINSENSE_PRESENCE; |
| 8307 | bits = present ? HDA_AMP_MUTE : 0; |
| 8308 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8309 | HDA_AMP_MUTE, bits); |
| 8310 | } |
| 8311 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8312 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8313 | { |
| 8314 | unsigned int present; |
| 8315 | |
| 8316 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8317 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8318 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8319 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8320 | } |
| 8321 | |
| 8322 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 8323 | { |
| 8324 | alc883_clevo_m720_hp_automute(codec); |
| 8325 | alc883_clevo_m720_mic_automute(codec); |
| 8326 | } |
| 8327 | |
| 8328 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8329 | unsigned int res) |
| 8330 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8331 | switch (res >> 26) { |
| 8332 | case ALC880_HP_EVENT: |
| 8333 | alc883_clevo_m720_hp_automute(codec); |
| 8334 | break; |
| 8335 | case ALC880_MIC_EVENT: |
| 8336 | alc883_clevo_m720_mic_automute(codec); |
| 8337 | break; |
| 8338 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8339 | } |
| 8340 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8341 | /* toggle speaker-output according to the hp-jack state */ |
| 8342 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 8343 | { |
| 8344 | unsigned int present; |
| 8345 | unsigned char bits; |
| 8346 | |
| 8347 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8348 | & AC_PINSENSE_PRESENCE; |
| 8349 | bits = present ? HDA_AMP_MUTE : 0; |
| 8350 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8351 | HDA_AMP_MUTE, bits); |
| 8352 | } |
| 8353 | |
| 8354 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 8355 | unsigned int res) |
| 8356 | { |
| 8357 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8358 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 8359 | } |
| 8360 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8361 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 8362 | { |
| 8363 | unsigned int present; |
| 8364 | unsigned char bits; |
| 8365 | |
| 8366 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8367 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8368 | bits = present ? 0x80 : 0; |
| 8369 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8370 | 0x80, bits); |
| 8371 | } |
| 8372 | |
| 8373 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 8374 | unsigned int res) |
| 8375 | { |
| 8376 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8377 | alc883_haier_w66_automute(codec); |
| 8378 | } |
| 8379 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8380 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8381 | { |
| 8382 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8383 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8384 | |
| 8385 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8386 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8387 | bits = present ? HDA_AMP_MUTE : 0; |
| 8388 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8389 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8390 | } |
| 8391 | |
| 8392 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8393 | { |
| 8394 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8395 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8396 | |
| 8397 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8398 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8399 | bits = present ? HDA_AMP_MUTE : 0; |
| 8400 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8401 | HDA_AMP_MUTE, bits); |
| 8402 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8403 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8404 | } |
| 8405 | |
| 8406 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8407 | unsigned int res) |
| 8408 | { |
| 8409 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8410 | alc883_lenovo_101e_all_automute(codec); |
| 8411 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8412 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8413 | } |
| 8414 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8415 | /* toggle speaker-output according to the hp-jack state */ |
| 8416 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 8417 | { |
| 8418 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8419 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8420 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8421 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8422 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8423 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8424 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8425 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8426 | } |
| 8427 | |
| 8428 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 8429 | unsigned int res) |
| 8430 | { |
| 8431 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8432 | alc883_acer_aspire_automute(codec); |
| 8433 | } |
| 8434 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8435 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8436 | /* HP Pin: output 0 (0x0c) */ |
| 8437 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8438 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8439 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8440 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8441 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8442 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8443 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8444 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8445 | /* eanable EAPD on medion laptop */ |
| 8446 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8447 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8448 | /* enable unsolicited event */ |
| 8449 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8450 | { } |
| 8451 | }; |
| 8452 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8453 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 8454 | { |
| 8455 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8456 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8457 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8458 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8459 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8460 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8461 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8462 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8463 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8464 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8465 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8466 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8467 | } |
| 8468 | |
| 8469 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 8470 | unsigned int res) |
| 8471 | { |
| 8472 | switch (res >> 26) { |
| 8473 | case ALC880_HP_EVENT: |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 8474 | /* printk(KERN_DEBUG "hp_event\n"); */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8475 | alc888_6st_dell_front_automute(codec); |
| 8476 | break; |
| 8477 | } |
| 8478 | } |
| 8479 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8480 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 8481 | { |
| 8482 | unsigned int mute; |
| 8483 | unsigned int present; |
| 8484 | |
| 8485 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8486 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8487 | AC_VERB_GET_PIN_SENSE, 0); |
| 8488 | present = (present & 0x80000000) != 0; |
| 8489 | if (present) { |
| 8490 | /* mute internal speaker */ |
| 8491 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8492 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8493 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8494 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8495 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8496 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8497 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8498 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8499 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8500 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8501 | } else { |
| 8502 | /* unmute internal speaker if necessary */ |
| 8503 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8504 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8505 | HDA_AMP_MUTE, mute); |
| 8506 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8507 | HDA_AMP_MUTE, mute); |
| 8508 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8509 | HDA_AMP_MUTE, mute); |
| 8510 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8511 | HDA_AMP_MUTE, mute); |
| 8512 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8513 | HDA_AMP_MUTE, mute); |
| 8514 | } |
| 8515 | } |
| 8516 | |
| 8517 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 8518 | unsigned int res) |
| 8519 | { |
| 8520 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8521 | alc888_lenovo_sky_front_automute(codec); |
| 8522 | } |
| 8523 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8524 | /* |
| 8525 | * generic initialization of ADC, input mixers and output mixers |
| 8526 | */ |
| 8527 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8528 | /* |
| 8529 | * Unmute ADC0-2 and set the default input to mic-in |
| 8530 | */ |
| 8531 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8532 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8533 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8534 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8535 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8536 | /* 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] | 8537 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8538 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8539 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8540 | */ |
| 8541 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8542 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8543 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8544 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8545 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8546 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8547 | |
| 8548 | /* |
| 8549 | * Set up output mixers (0x0c - 0x0f) |
| 8550 | */ |
| 8551 | /* set vol=0 to output mixers */ |
| 8552 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8553 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8554 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8555 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8556 | /* set up input amps for analog loopback */ |
| 8557 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8558 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8559 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8560 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8561 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8562 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8563 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8564 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8565 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8566 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8567 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8568 | |
| 8569 | /* FIXME: use matrix-type input source selection */ |
| 8570 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8571 | /* Input mixer1 */ |
| 8572 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8573 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8574 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8575 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8576 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8577 | /* Input mixer2 */ |
| 8578 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8579 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8580 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8581 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8582 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8583 | |
| 8584 | { } |
| 8585 | }; |
| 8586 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8587 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8588 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8589 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8590 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8591 | /* enable unsolicited event */ |
| 8592 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8593 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8594 | { } /* end */ |
| 8595 | }; |
| 8596 | |
| 8597 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8598 | { |
| 8599 | unsigned int present; |
| 8600 | |
| 8601 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8602 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8603 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8604 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8605 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8606 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8607 | } |
| 8608 | |
| 8609 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8610 | { |
| 8611 | unsigned int present; |
| 8612 | unsigned char bits; |
| 8613 | |
| 8614 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8615 | AC_VERB_GET_PIN_SENSE, 0) |
| 8616 | & AC_PINSENSE_PRESENCE; |
| 8617 | bits = present ? 0 : PIN_OUT; |
| 8618 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8619 | bits); |
| 8620 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8621 | bits); |
| 8622 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8623 | bits); |
| 8624 | } |
| 8625 | |
| 8626 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8627 | unsigned int res) |
| 8628 | { |
| 8629 | switch (res >> 26) { |
| 8630 | case ALC880_HP_EVENT: |
| 8631 | alc883_M90V_speaker_automute(codec); |
| 8632 | break; |
| 8633 | case ALC880_MIC_EVENT: |
| 8634 | alc883_nb_mic_automute(codec); |
| 8635 | break; |
| 8636 | } |
| 8637 | } |
| 8638 | |
| 8639 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8640 | { |
| 8641 | alc883_M90V_speaker_automute(codec); |
| 8642 | alc883_nb_mic_automute(codec); |
| 8643 | } |
| 8644 | |
| 8645 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8646 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8647 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8648 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8649 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8650 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8651 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8652 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8653 | /* enable unsolicited event */ |
| 8654 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8655 | { } /* end */ |
| 8656 | }; |
| 8657 | |
| 8658 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8659 | { |
| 8660 | unsigned int present; |
| 8661 | unsigned char bits; |
| 8662 | |
| 8663 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8664 | AC_VERB_GET_PIN_SENSE, 0) |
| 8665 | & AC_PINSENSE_PRESENCE; |
| 8666 | bits = present ? 0 : PIN_OUT; |
| 8667 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8668 | bits); |
| 8669 | } |
| 8670 | |
| 8671 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8672 | unsigned int res) |
| 8673 | { |
| 8674 | switch (res >> 26) { |
| 8675 | case ALC880_HP_EVENT: |
| 8676 | alc883_eee1601_speaker_automute(codec); |
| 8677 | break; |
| 8678 | } |
| 8679 | } |
| 8680 | |
| 8681 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8682 | { |
| 8683 | alc883_eee1601_speaker_automute(codec); |
| 8684 | } |
| 8685 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8686 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8687 | #define alc883_loopbacks alc880_loopbacks |
| 8688 | #endif |
| 8689 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8690 | /* pcm configuration: identiacal with ALC880 */ |
| 8691 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8692 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8693 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8694 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8695 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8696 | |
| 8697 | /* |
| 8698 | * configuration and preset |
| 8699 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8700 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8701 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8702 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8703 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8704 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8705 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8706 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8707 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8708 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8709 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8710 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8711 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8712 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8713 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8714 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8715 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8716 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8717 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8718 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8719 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8720 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8721 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8722 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8723 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8724 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8725 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8726 | [ALC883_AUTO] = "auto", |
| 8727 | }; |
| 8728 | |
| 8729 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8730 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8731 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8732 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8733 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8734 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8735 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8736 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8737 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8738 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8739 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8740 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | b3bdb30 | 2009-02-18 13:16:26 +0100 | [diff] [blame] | 8741 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), |
Takashi Iwai | 9468350 | 2009-02-13 09:31:20 +0100 | [diff] [blame] | 8742 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8743 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 8744 | ALC888_ACER_ASPIRE_4930G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8745 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
| 8746 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8747 | /* default Acer */ |
| 8748 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8749 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8750 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8751 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8752 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8753 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8754 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8755 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8756 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8757 | 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] | 8758 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8759 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8760 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8761 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8762 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8763 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8764 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8765 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8766 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8767 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8768 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8769 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8770 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8771 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8772 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8773 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8774 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8775 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8776 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8777 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8778 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8779 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8780 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8781 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8782 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8783 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8784 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8785 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8786 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8787 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8788 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8789 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8790 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8791 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8792 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8793 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8794 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8795 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8796 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8797 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8798 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8799 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8800 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8801 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8802 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8803 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8804 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8805 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8806 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8807 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8808 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8809 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8810 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8811 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8812 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8813 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 8814 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8815 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8816 | {} |
| 8817 | }; |
| 8818 | |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8819 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8820 | ALC1200_DIGOUT_NID, 0, |
| 8821 | }; |
| 8822 | |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 8823 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8824 | ALC883_DIGOUT_NID, 0, |
| 8825 | }; |
| 8826 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8827 | static struct alc_config_preset alc883_presets[] = { |
| 8828 | [ALC883_3ST_2ch_DIG] = { |
| 8829 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8830 | .init_verbs = { alc883_init_verbs }, |
| 8831 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8832 | .dac_nids = alc883_dac_nids, |
| 8833 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8834 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8835 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8836 | .channel_mode = alc883_3ST_2ch_modes, |
| 8837 | .input_mux = &alc883_capture_source, |
| 8838 | }, |
| 8839 | [ALC883_3ST_6ch_DIG] = { |
| 8840 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8841 | .init_verbs = { alc883_init_verbs }, |
| 8842 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8843 | .dac_nids = alc883_dac_nids, |
| 8844 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8845 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8846 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8847 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8848 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8849 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8850 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8851 | [ALC883_3ST_6ch] = { |
| 8852 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8853 | .init_verbs = { alc883_init_verbs }, |
| 8854 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8855 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8856 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8857 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8858 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8859 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8860 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8861 | [ALC883_3ST_6ch_INTEL] = { |
| 8862 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8863 | .init_verbs = { alc883_init_verbs }, |
| 8864 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8865 | .dac_nids = alc883_dac_nids, |
| 8866 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8867 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8868 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8869 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8870 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8871 | .need_dac_fix = 1, |
| 8872 | .input_mux = &alc883_3stack_6ch_intel, |
| 8873 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8874 | [ALC883_6ST_DIG] = { |
| 8875 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8876 | .init_verbs = { alc883_init_verbs }, |
| 8877 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8878 | .dac_nids = alc883_dac_nids, |
| 8879 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8880 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8881 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8882 | .channel_mode = alc883_sixstack_modes, |
| 8883 | .input_mux = &alc883_capture_source, |
| 8884 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8885 | [ALC883_TARGA_DIG] = { |
| 8886 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8887 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8888 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8889 | .dac_nids = alc883_dac_nids, |
| 8890 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8891 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8892 | .channel_mode = alc883_3ST_6ch_modes, |
| 8893 | .need_dac_fix = 1, |
| 8894 | .input_mux = &alc883_capture_source, |
| 8895 | .unsol_event = alc883_tagra_unsol_event, |
| 8896 | .init_hook = alc883_tagra_automute, |
| 8897 | }, |
| 8898 | [ALC883_TARGA_2ch_DIG] = { |
| 8899 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8900 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8901 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8902 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8903 | .adc_nids = alc883_adc_nids_alt, |
| 8904 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8905 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8906 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8907 | .channel_mode = alc883_3ST_2ch_modes, |
| 8908 | .input_mux = &alc883_capture_source, |
| 8909 | .unsol_event = alc883_tagra_unsol_event, |
| 8910 | .init_hook = alc883_tagra_automute, |
| 8911 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8912 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8913 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8914 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8915 | * and the headphone jack. Turn this on and rely on the |
| 8916 | * standard mute methods whenever the user wants to turn |
| 8917 | * these outputs off. |
| 8918 | */ |
| 8919 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8920 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8921 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8922 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8923 | .channel_mode = alc883_3ST_2ch_modes, |
| 8924 | .input_mux = &alc883_capture_source, |
| 8925 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8926 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8927 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8928 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8929 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8930 | .dac_nids = alc883_dac_nids, |
| 8931 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8932 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8933 | .channel_mode = alc883_3ST_2ch_modes, |
| 8934 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8935 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8936 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8937 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8938 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8939 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8940 | alc883_chmode_mixer }, |
| 8941 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8942 | alc888_acer_aspire_4930g_verbs }, |
| 8943 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8944 | .dac_nids = alc883_dac_nids, |
| 8945 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8946 | .adc_nids = alc883_adc_nids_rev, |
| 8947 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8948 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8949 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8950 | .channel_mode = alc883_3ST_6ch_modes, |
| 8951 | .need_dac_fix = 1, |
| 8952 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8953 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8954 | .input_mux = alc888_2_capture_sources, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8955 | .unsol_event = alc888_acer_aspire_4930g_unsol_event, |
| 8956 | .init_hook = alc888_acer_aspire_4930g_automute, |
| 8957 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8958 | [ALC883_MEDION] = { |
| 8959 | .mixers = { alc883_fivestack_mixer, |
| 8960 | alc883_chmode_mixer }, |
| 8961 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8962 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8963 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8964 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8965 | .adc_nids = alc883_adc_nids_alt, |
| 8966 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8967 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8968 | .channel_mode = alc883_sixstack_modes, |
| 8969 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8970 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8971 | [ALC883_MEDION_MD2] = { |
| 8972 | .mixers = { alc883_medion_md2_mixer}, |
| 8973 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8974 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8975 | .dac_nids = alc883_dac_nids, |
| 8976 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8977 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8978 | .channel_mode = alc883_3ST_2ch_modes, |
| 8979 | .input_mux = &alc883_capture_source, |
| 8980 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8981 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8982 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8983 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8984 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8985 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8986 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8987 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8988 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8989 | .channel_mode = alc883_3ST_2ch_modes, |
| 8990 | .input_mux = &alc883_capture_source, |
| 8991 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8992 | [ALC883_CLEVO_M720] = { |
| 8993 | .mixers = { alc883_clevo_m720_mixer }, |
| 8994 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8995 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8996 | .dac_nids = alc883_dac_nids, |
| 8997 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8998 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8999 | .channel_mode = alc883_3ST_2ch_modes, |
| 9000 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9001 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 9002 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9003 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9004 | [ALC883_LENOVO_101E_2ch] = { |
| 9005 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9006 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9007 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9008 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9009 | .adc_nids = alc883_adc_nids_alt, |
| 9010 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9011 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9012 | .channel_mode = alc883_3ST_2ch_modes, |
| 9013 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9014 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9015 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9016 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9017 | [ALC883_LENOVO_NB0763] = { |
| 9018 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9019 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9020 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9021 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9022 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9023 | .channel_mode = alc883_3ST_2ch_modes, |
| 9024 | .need_dac_fix = 1, |
| 9025 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 9026 | .unsol_event = alc883_medion_md2_unsol_event, |
| 9027 | .init_hook = alc883_medion_md2_automute, |
| 9028 | }, |
| 9029 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9030 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9031 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9032 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9033 | .dac_nids = alc883_dac_nids, |
| 9034 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9035 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9036 | .channel_mode = alc883_3ST_6ch_modes, |
| 9037 | .need_dac_fix = 1, |
| 9038 | .input_mux = &alc883_capture_source, |
| 9039 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9040 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9041 | }, |
| 9042 | [ALC883_HAIER_W66] = { |
| 9043 | .mixers = { alc883_tagra_2ch_mixer}, |
| 9044 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9045 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9046 | .dac_nids = alc883_dac_nids, |
| 9047 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9048 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9049 | .channel_mode = alc883_3ST_2ch_modes, |
| 9050 | .input_mux = &alc883_capture_source, |
| 9051 | .unsol_event = alc883_haier_w66_unsol_event, |
| 9052 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9053 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9054 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9055 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9056 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9057 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9058 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9059 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9060 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9061 | .need_dac_fix = 1, |
| 9062 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9063 | .unsol_event = alc888_3st_hp_unsol_event, |
| 9064 | .init_hook = alc888_3st_hp_front_automute, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9065 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9066 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9067 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9068 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9069 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9070 | .dac_nids = alc883_dac_nids, |
| 9071 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9072 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9073 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9074 | .channel_mode = alc883_sixstack_modes, |
| 9075 | .input_mux = &alc883_capture_source, |
| 9076 | .unsol_event = alc888_6st_dell_unsol_event, |
| 9077 | .init_hook = alc888_6st_dell_front_automute, |
| 9078 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9079 | [ALC883_MITAC] = { |
| 9080 | .mixers = { alc883_mitac_mixer }, |
| 9081 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9082 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9083 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9084 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9085 | .channel_mode = alc883_3ST_2ch_modes, |
| 9086 | .input_mux = &alc883_capture_source, |
| 9087 | .unsol_event = alc883_mitac_unsol_event, |
| 9088 | .init_hook = alc883_mitac_automute, |
| 9089 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9090 | [ALC883_FUJITSU_PI2515] = { |
| 9091 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9092 | .init_verbs = { alc883_init_verbs, |
| 9093 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9094 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9095 | .dac_nids = alc883_dac_nids, |
| 9096 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9097 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9098 | .channel_mode = alc883_3ST_2ch_modes, |
| 9099 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9100 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 9101 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 9102 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9103 | [ALC888_FUJITSU_XA3530] = { |
| 9104 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9105 | .init_verbs = { alc883_init_verbs, |
| 9106 | alc888_fujitsu_xa3530_verbs }, |
| 9107 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9108 | .dac_nids = alc883_dac_nids, |
| 9109 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9110 | .adc_nids = alc883_adc_nids_rev, |
| 9111 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9112 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9113 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9114 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9115 | .num_mux_defs = |
| 9116 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9117 | .input_mux = alc888_2_capture_sources, |
| 9118 | .unsol_event = alc888_fujitsu_xa3530_unsol_event, |
| 9119 | .init_hook = alc888_fujitsu_xa3530_automute, |
| 9120 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9121 | [ALC888_LENOVO_SKY] = { |
| 9122 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9123 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9124 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9125 | .dac_nids = alc883_dac_nids, |
| 9126 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9127 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9128 | .channel_mode = alc883_sixstack_modes, |
| 9129 | .need_dac_fix = 1, |
| 9130 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 9131 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 9132 | .init_hook = alc888_lenovo_sky_front_automute, |
| 9133 | }, |
| 9134 | [ALC888_ASUS_M90V] = { |
| 9135 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9136 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9137 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9138 | .dac_nids = alc883_dac_nids, |
| 9139 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9140 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9141 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9142 | .channel_mode = alc883_3ST_6ch_modes, |
| 9143 | .need_dac_fix = 1, |
| 9144 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9145 | .unsol_event = alc883_mode2_unsol_event, |
| 9146 | .init_hook = alc883_mode2_inithook, |
| 9147 | }, |
| 9148 | [ALC888_ASUS_EEE1601] = { |
| 9149 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9150 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9151 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9152 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9153 | .dac_nids = alc883_dac_nids, |
| 9154 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9155 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9156 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9157 | .channel_mode = alc883_3ST_2ch_modes, |
| 9158 | .need_dac_fix = 1, |
| 9159 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 9160 | .unsol_event = alc883_eee1601_unsol_event, |
| 9161 | .init_hook = alc883_eee1601_inithook, |
| 9162 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9163 | [ALC1200_ASUS_P5Q] = { |
| 9164 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9165 | .init_verbs = { alc883_init_verbs }, |
| 9166 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9167 | .dac_nids = alc883_dac_nids, |
| 9168 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9169 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9170 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9171 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9172 | .channel_mode = alc883_sixstack_modes, |
| 9173 | .input_mux = &alc883_capture_source, |
| 9174 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9175 | }; |
| 9176 | |
| 9177 | |
| 9178 | /* |
| 9179 | * BIOS auto configuration |
| 9180 | */ |
| 9181 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9182 | hda_nid_t nid, int pin_type, |
| 9183 | int dac_idx) |
| 9184 | { |
| 9185 | /* set as output */ |
| 9186 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9187 | int idx; |
| 9188 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9189 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9190 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9191 | idx = 4; |
| 9192 | else |
| 9193 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9194 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9195 | |
| 9196 | } |
| 9197 | |
| 9198 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 9199 | { |
| 9200 | struct alc_spec *spec = codec->spec; |
| 9201 | int i; |
| 9202 | |
| 9203 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9204 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9205 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9206 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9207 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9208 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9209 | } |
| 9210 | } |
| 9211 | |
| 9212 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 9213 | { |
| 9214 | struct alc_spec *spec = codec->spec; |
| 9215 | hda_nid_t pin; |
| 9216 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9217 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9218 | if (pin) /* connect to front */ |
| 9219 | /* use dac 0 */ |
| 9220 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9221 | pin = spec->autocfg.speaker_pins[0]; |
| 9222 | if (pin) |
| 9223 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9224 | } |
| 9225 | |
| 9226 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9227 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 9228 | |
| 9229 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 9230 | { |
| 9231 | struct alc_spec *spec = codec->spec; |
| 9232 | int i; |
| 9233 | |
| 9234 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9235 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9236 | if (alc883_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 9237 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 9238 | if (nid != ALC883_PIN_CD_NID && |
| 9239 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9240 | snd_hda_codec_write(codec, nid, 0, |
| 9241 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9242 | AMP_OUT_MUTE); |
| 9243 | } |
| 9244 | } |
| 9245 | } |
| 9246 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9247 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 9248 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9249 | /* almost identical with ALC880 parser... */ |
| 9250 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 9251 | { |
| 9252 | struct alc_spec *spec = codec->spec; |
| 9253 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9254 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 9255 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9256 | |
| 9257 | if (err < 0) |
| 9258 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9259 | else if (!err) |
| 9260 | return 0; /* no config found */ |
| 9261 | |
| 9262 | err = alc_auto_add_mic_boost(codec); |
| 9263 | if (err < 0) |
| 9264 | return err; |
| 9265 | |
| 9266 | /* hack - override the init verbs */ |
| 9267 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9268 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9269 | /* setup input_mux for ALC889 */ |
| 9270 | if (codec->vendor_id == 0x10ec0889) { |
| 9271 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9272 | * because it's under 0x18 |
| 9273 | */ |
| 9274 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9275 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9276 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9277 | for (i = 1; i < 3; i++) |
| 9278 | memcpy(&spec->private_imux[i], |
| 9279 | &spec->private_imux[0], |
| 9280 | sizeof(spec->private_imux[0])); |
| 9281 | imux->items[imux->num_items].label = "Int DMic"; |
| 9282 | imux->items[imux->num_items].index = 0x0b; |
| 9283 | imux->num_items++; |
| 9284 | spec->num_mux_defs = 3; |
| 9285 | spec->input_mux = spec->private_imux; |
| 9286 | } |
| 9287 | } |
| 9288 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9289 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9290 | } |
| 9291 | |
| 9292 | /* additional initialization for auto-configuration model */ |
| 9293 | static void alc883_auto_init(struct hda_codec *codec) |
| 9294 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9295 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9296 | alc883_auto_init_multi_out(codec); |
| 9297 | alc883_auto_init_hp_out(codec); |
| 9298 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9299 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9300 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9301 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9302 | } |
| 9303 | |
| 9304 | static int patch_alc883(struct hda_codec *codec) |
| 9305 | { |
| 9306 | struct alc_spec *spec; |
| 9307 | int err, board_config; |
| 9308 | |
| 9309 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9310 | if (spec == NULL) |
| 9311 | return -ENOMEM; |
| 9312 | |
| 9313 | codec->spec = spec; |
| 9314 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9315 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9316 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9317 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9318 | alc883_models, |
| 9319 | alc883_cfg_tbl); |
| 9320 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9321 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 9322 | "trying auto-probe from BIOS...\n"); |
| 9323 | board_config = ALC883_AUTO; |
| 9324 | } |
| 9325 | |
| 9326 | if (board_config == ALC883_AUTO) { |
| 9327 | /* automatic parse from the BIOS config */ |
| 9328 | err = alc883_parse_auto_config(codec); |
| 9329 | if (err < 0) { |
| 9330 | alc_free(codec); |
| 9331 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9332 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9333 | printk(KERN_INFO |
| 9334 | "hda_codec: Cannot set up configuration " |
| 9335 | "from BIOS. Using base mode...\n"); |
| 9336 | board_config = ALC883_3ST_2ch_DIG; |
| 9337 | } |
| 9338 | } |
| 9339 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9340 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9341 | if (err < 0) { |
| 9342 | alc_free(codec); |
| 9343 | return err; |
| 9344 | } |
| 9345 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9346 | if (board_config != ALC883_AUTO) |
| 9347 | setup_preset(spec, &alc883_presets[board_config]); |
| 9348 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9349 | switch (codec->vendor_id) { |
| 9350 | case 0x10ec0888: |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 9351 | if (codec->revision_id == 0x100101) { |
| 9352 | spec->stream_name_analog = "ALC1200 Analog"; |
| 9353 | spec->stream_name_digital = "ALC1200 Digital"; |
| 9354 | } else { |
| 9355 | spec->stream_name_analog = "ALC888 Analog"; |
| 9356 | spec->stream_name_digital = "ALC888 Digital"; |
| 9357 | } |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9358 | if (!spec->num_adc_nids) { |
| 9359 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9360 | spec->adc_nids = alc883_adc_nids; |
| 9361 | } |
| 9362 | if (!spec->capsrc_nids) |
| 9363 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9364 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame^] | 9365 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9366 | break; |
| 9367 | case 0x10ec0889: |
| 9368 | spec->stream_name_analog = "ALC889 Analog"; |
| 9369 | spec->stream_name_digital = "ALC889 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9370 | if (!spec->num_adc_nids) { |
| 9371 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9372 | spec->adc_nids = alc889_adc_nids; |
| 9373 | } |
| 9374 | if (!spec->capsrc_nids) |
| 9375 | spec->capsrc_nids = alc889_capsrc_nids; |
| 9376 | spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style |
| 9377 | capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9378 | break; |
| 9379 | default: |
| 9380 | spec->stream_name_analog = "ALC883 Analog"; |
| 9381 | spec->stream_name_digital = "ALC883 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9382 | if (!spec->num_adc_nids) { |
| 9383 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9384 | spec->adc_nids = alc883_adc_nids; |
| 9385 | } |
| 9386 | if (!spec->capsrc_nids) |
| 9387 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9388 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9389 | break; |
| 9390 | } |
| 9391 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9392 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9393 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9394 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9395 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9396 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9397 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9398 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9399 | if (!spec->cap_mixer) |
| 9400 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9401 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9402 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9403 | spec->vmaster_nid = 0x0c; |
| 9404 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9405 | codec->patch_ops = alc_patch_ops; |
| 9406 | if (board_config == ALC883_AUTO) |
| 9407 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9408 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9409 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9410 | if (!spec->loopback.amplist) |
| 9411 | spec->loopback.amplist = alc883_loopbacks; |
| 9412 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9413 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9414 | |
| 9415 | return 0; |
| 9416 | } |
| 9417 | |
| 9418 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9419 | * ALC262 support |
| 9420 | */ |
| 9421 | |
| 9422 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9423 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9424 | |
| 9425 | #define alc262_dac_nids alc260_dac_nids |
| 9426 | #define alc262_adc_nids alc882_adc_nids |
| 9427 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9428 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9429 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9430 | |
| 9431 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9432 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9433 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9434 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9435 | /* ADC0 */ |
| 9436 | 0x09 |
| 9437 | }; |
| 9438 | |
| 9439 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9440 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9441 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9442 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9443 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9444 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9445 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9446 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9447 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9448 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9449 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9450 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9451 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9452 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9453 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9454 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9455 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9456 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9457 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9458 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9459 | }; |
| 9460 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9461 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9462 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9463 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9464 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9465 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9466 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9467 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9468 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9469 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9470 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9471 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9472 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9473 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9474 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 9475 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9476 | { } /* end */ |
| 9477 | }; |
| 9478 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9479 | /* update HP, line and mono-out pins according to the master switch */ |
| 9480 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9481 | { |
| 9482 | struct alc_spec *spec = codec->spec; |
| 9483 | int val = spec->master_sw; |
| 9484 | |
| 9485 | /* HP & line-out */ |
| 9486 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9487 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9488 | val ? PIN_HP : 0); |
| 9489 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9490 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9491 | val ? PIN_HP : 0); |
| 9492 | /* mono (speaker) depending on the HP jack sense */ |
| 9493 | val = val && !spec->jack_present; |
| 9494 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9495 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9496 | val ? PIN_OUT : 0); |
| 9497 | } |
| 9498 | |
| 9499 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9500 | { |
| 9501 | struct alc_spec *spec = codec->spec; |
| 9502 | unsigned int presence; |
| 9503 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9504 | AC_VERB_GET_PIN_SENSE, 0); |
| 9505 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9506 | alc262_hp_master_update(codec); |
| 9507 | } |
| 9508 | |
| 9509 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9510 | { |
| 9511 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9512 | return; |
| 9513 | alc262_hp_bpc_automute(codec); |
| 9514 | } |
| 9515 | |
| 9516 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9517 | { |
| 9518 | struct alc_spec *spec = codec->spec; |
| 9519 | unsigned int presence; |
| 9520 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9521 | AC_VERB_GET_PIN_SENSE, 0); |
| 9522 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9523 | alc262_hp_master_update(codec); |
| 9524 | } |
| 9525 | |
| 9526 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9527 | unsigned int res) |
| 9528 | { |
| 9529 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9530 | return; |
| 9531 | alc262_hp_wildwest_automute(codec); |
| 9532 | } |
| 9533 | |
| 9534 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 9535 | struct snd_ctl_elem_value *ucontrol) |
| 9536 | { |
| 9537 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9538 | struct alc_spec *spec = codec->spec; |
| 9539 | *ucontrol->value.integer.value = spec->master_sw; |
| 9540 | return 0; |
| 9541 | } |
| 9542 | |
| 9543 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9544 | struct snd_ctl_elem_value *ucontrol) |
| 9545 | { |
| 9546 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9547 | struct alc_spec *spec = codec->spec; |
| 9548 | int val = !!*ucontrol->value.integer.value; |
| 9549 | |
| 9550 | if (val == spec->master_sw) |
| 9551 | return 0; |
| 9552 | spec->master_sw = val; |
| 9553 | alc262_hp_master_update(codec); |
| 9554 | return 1; |
| 9555 | } |
| 9556 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9557 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9558 | { |
| 9559 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9560 | .name = "Master Playback Switch", |
| 9561 | .info = snd_ctl_boolean_mono_info, |
| 9562 | .get = alc262_hp_master_sw_get, |
| 9563 | .put = alc262_hp_master_sw_put, |
| 9564 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9565 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9566 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9567 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9568 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9569 | HDA_OUTPUT), |
| 9570 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9571 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9572 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9573 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9574 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9575 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9576 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9577 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9578 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9579 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9580 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9581 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9582 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9583 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9584 | { } /* end */ |
| 9585 | }; |
| 9586 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9587 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9588 | { |
| 9589 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9590 | .name = "Master Playback Switch", |
| 9591 | .info = snd_ctl_boolean_mono_info, |
| 9592 | .get = alc262_hp_master_sw_get, |
| 9593 | .put = alc262_hp_master_sw_put, |
| 9594 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9595 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9596 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9597 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9598 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9599 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9600 | HDA_OUTPUT), |
| 9601 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9602 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9603 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9604 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9605 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9606 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9607 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9608 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9609 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9610 | { } /* end */ |
| 9611 | }; |
| 9612 | |
| 9613 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9614 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9615 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9616 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9617 | { } /* end */ |
| 9618 | }; |
| 9619 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9620 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9621 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 9622 | { |
| 9623 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9624 | |
| 9625 | if (force || !spec->sense_updated) { |
| 9626 | unsigned int present; |
| 9627 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9628 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9629 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9630 | spec->sense_updated = 1; |
| 9631 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9632 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 9633 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9634 | } |
| 9635 | |
| 9636 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 9637 | unsigned int res) |
| 9638 | { |
| 9639 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9640 | return; |
| 9641 | alc262_hp_t5735_automute(codec, 1); |
| 9642 | } |
| 9643 | |
| 9644 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 9645 | { |
| 9646 | alc262_hp_t5735_automute(codec, 1); |
| 9647 | } |
| 9648 | |
| 9649 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9650 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9651 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9652 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9653 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9654 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9655 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9656 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9657 | { } /* end */ |
| 9658 | }; |
| 9659 | |
| 9660 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9661 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9662 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9663 | |
| 9664 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9665 | { } |
| 9666 | }; |
| 9667 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9668 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9669 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9670 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9671 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9672 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9673 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9674 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9675 | { } /* end */ |
| 9676 | }; |
| 9677 | |
| 9678 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9679 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9680 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9681 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9682 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9683 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9684 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9685 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9686 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9687 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9688 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9689 | {} |
| 9690 | }; |
| 9691 | |
| 9692 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9693 | .num_items = 1, |
| 9694 | .items = { |
| 9695 | { "Line", 0x1 }, |
| 9696 | }, |
| 9697 | }; |
| 9698 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9699 | /* bind hp and internal speaker mute (with plug check) */ |
| 9700 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9701 | struct snd_ctl_elem_value *ucontrol) |
| 9702 | { |
| 9703 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9704 | long *valp = ucontrol->value.integer.value; |
| 9705 | int change; |
| 9706 | |
| 9707 | /* change hp mute */ |
| 9708 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9709 | HDA_AMP_MUTE, |
| 9710 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9711 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9712 | HDA_AMP_MUTE, |
| 9713 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9714 | if (change) { |
| 9715 | /* change speaker according to HP jack state */ |
| 9716 | struct alc_spec *spec = codec->spec; |
| 9717 | unsigned int mute; |
| 9718 | if (spec->jack_present) |
| 9719 | mute = HDA_AMP_MUTE; |
| 9720 | else |
| 9721 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9722 | HDA_OUTPUT, 0); |
| 9723 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9724 | HDA_AMP_MUTE, mute); |
| 9725 | } |
| 9726 | return change; |
| 9727 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9728 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9729 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9730 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9731 | { |
| 9732 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9733 | .name = "Master Playback Switch", |
| 9734 | .info = snd_hda_mixer_amp_switch_info, |
| 9735 | .get = snd_hda_mixer_amp_switch_get, |
| 9736 | .put = alc262_sony_master_sw_put, |
| 9737 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9738 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9739 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9740 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9741 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9742 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9743 | { } /* end */ |
| 9744 | }; |
| 9745 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9746 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9747 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9748 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9749 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9750 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9751 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9752 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9753 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9754 | { } /* end */ |
| 9755 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9756 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9757 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 9758 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9759 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9760 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9761 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9762 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9763 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9765 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9766 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9767 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9768 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9769 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9770 | { } /* end */ |
| 9771 | }; |
| 9772 | |
| 9773 | static struct hda_verb alc262_tyan_verbs[] = { |
| 9774 | /* Headphone automute */ |
| 9775 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9776 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9777 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9778 | |
| 9779 | /* P11 AUX_IN, white 4-pin connector */ |
| 9780 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9781 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 9782 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 9783 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 9784 | |
| 9785 | {} |
| 9786 | }; |
| 9787 | |
| 9788 | /* unsolicited event for HP jack sensing */ |
| 9789 | static void alc262_tyan_automute(struct hda_codec *codec) |
| 9790 | { |
| 9791 | unsigned int mute; |
| 9792 | unsigned int present; |
| 9793 | |
| 9794 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9795 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9796 | AC_VERB_GET_PIN_SENSE, 0); |
| 9797 | present = (present & 0x80000000) != 0; |
| 9798 | if (present) { |
| 9799 | /* mute line output on ATX panel */ |
| 9800 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9801 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9802 | } else { |
| 9803 | /* unmute line output if necessary */ |
| 9804 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9805 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9806 | HDA_AMP_MUTE, mute); |
| 9807 | } |
| 9808 | } |
| 9809 | |
| 9810 | static void alc262_tyan_unsol_event(struct hda_codec *codec, |
| 9811 | unsigned int res) |
| 9812 | { |
| 9813 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9814 | return; |
| 9815 | alc262_tyan_automute(codec); |
| 9816 | } |
| 9817 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9818 | #define alc262_capture_mixer alc882_capture_mixer |
| 9819 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9820 | |
| 9821 | /* |
| 9822 | * generic initialization of ADC, input mixers and output mixers |
| 9823 | */ |
| 9824 | static struct hda_verb alc262_init_verbs[] = { |
| 9825 | /* |
| 9826 | * Unmute ADC0-2 and set the default input to mic-in |
| 9827 | */ |
| 9828 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9829 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9830 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9831 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9832 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9833 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9834 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9835 | /* 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] | 9836 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9837 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9838 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9839 | */ |
| 9840 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9841 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9842 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9843 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9844 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9845 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9846 | |
| 9847 | /* |
| 9848 | * Set up output mixers (0x0c - 0x0e) |
| 9849 | */ |
| 9850 | /* set vol=0 to output mixers */ |
| 9851 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9852 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9853 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9854 | /* set up input amps for analog loopback */ |
| 9855 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9856 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9857 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9858 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9859 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9860 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9861 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9862 | |
| 9863 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9864 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9865 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9866 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9867 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9868 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9869 | |
| 9870 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9871 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9872 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9873 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9874 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9875 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9876 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9877 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
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 | /* FIXME: use matrix-type input source selection */ |
| 9880 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9881 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9882 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9883 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9884 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9885 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9886 | /* Input mixer2 */ |
| 9887 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9888 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9889 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9890 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9891 | /* Input mixer3 */ |
| 9892 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9893 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9894 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9895 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9896 | |
| 9897 | { } |
| 9898 | }; |
| 9899 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9900 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9901 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9902 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9903 | { } |
| 9904 | }; |
| 9905 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9906 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9907 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9908 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9909 | {} |
| 9910 | }; |
| 9911 | |
| 9912 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9913 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9914 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9915 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9916 | |
| 9917 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9918 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9919 | {} |
| 9920 | }; |
| 9921 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9922 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9923 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9924 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9925 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9926 | |
| 9927 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9928 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9929 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9930 | }; |
| 9931 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9932 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9933 | .num_items = 2, |
| 9934 | .items = { |
| 9935 | { "Int DMic", 0x9 }, |
| 9936 | { "Mic", 0x0 }, |
| 9937 | }, |
| 9938 | }; |
| 9939 | |
| 9940 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9941 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9942 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9943 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9944 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9945 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9946 | { } /* end */ |
| 9947 | }; |
| 9948 | |
| 9949 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9950 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9951 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9952 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9953 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9954 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9955 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9956 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9957 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9958 | {} |
| 9959 | }; |
| 9960 | |
| 9961 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9962 | { |
| 9963 | unsigned int present; |
| 9964 | |
| 9965 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9966 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9967 | snd_hda_codec_write(codec, 0x22, 0, |
| 9968 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9969 | } |
| 9970 | |
| 9971 | /* toggle speaker-output according to the hp-jack state */ |
| 9972 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9973 | { |
| 9974 | unsigned int present; |
| 9975 | unsigned char bits; |
| 9976 | |
| 9977 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9978 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9979 | bits = present ? 0 : PIN_OUT; |
| 9980 | snd_hda_codec_write(codec, 0x14, 0, |
| 9981 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9982 | } |
| 9983 | |
| 9984 | |
| 9985 | |
| 9986 | /* unsolicited event for HP jack sensing */ |
| 9987 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9988 | unsigned int res) |
| 9989 | { |
| 9990 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9991 | alc262_toshiba_s06_speaker_automute(codec); |
| 9992 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9993 | alc262_dmic_automute(codec); |
| 9994 | |
| 9995 | } |
| 9996 | |
| 9997 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9998 | { |
| 9999 | alc262_toshiba_s06_speaker_automute(codec); |
| 10000 | alc262_dmic_automute(codec); |
| 10001 | } |
| 10002 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10003 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10004 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10005 | { |
| 10006 | struct alc_spec *spec = codec->spec; |
| 10007 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10008 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10009 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10010 | /* need to execute and sync at first */ |
| 10011 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10012 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10013 | AC_VERB_GET_PIN_SENSE, 0); |
| 10014 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10015 | if (spec->jack_present) { |
| 10016 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10017 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10018 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10019 | } else { |
| 10020 | /* unmute internal speaker if necessary */ |
| 10021 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10022 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10023 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10024 | } |
| 10025 | } |
| 10026 | |
| 10027 | /* unsolicited event for HP jack sensing */ |
| 10028 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 10029 | unsigned int res) |
| 10030 | { |
| 10031 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10032 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10033 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10034 | } |
| 10035 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10036 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10037 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10038 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10039 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10040 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10041 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10042 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 10043 | AC_VERB_GET_PIN_SENSE, 0); |
| 10044 | present = (present & 0x80000000) != 0; |
| 10045 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10046 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10047 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10048 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10049 | } else { |
| 10050 | /* unmute internal speaker if necessary */ |
| 10051 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10052 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10053 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10054 | } |
| 10055 | } |
| 10056 | |
| 10057 | /* unsolicited event for HP jack sensing */ |
| 10058 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 10059 | unsigned int res) |
| 10060 | { |
| 10061 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10062 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10063 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10064 | } |
| 10065 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10066 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10067 | * nec model |
| 10068 | * 0x15 = headphone |
| 10069 | * 0x16 = internal speaker |
| 10070 | * 0x18 = external mic |
| 10071 | */ |
| 10072 | |
| 10073 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10074 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10075 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10076 | |
| 10077 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10078 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10079 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10080 | |
| 10081 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10082 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10083 | { } /* end */ |
| 10084 | }; |
| 10085 | |
| 10086 | static struct hda_verb alc262_nec_verbs[] = { |
| 10087 | /* Unmute Speaker */ |
| 10088 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10089 | |
| 10090 | /* Headphone */ |
| 10091 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10092 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10093 | |
| 10094 | /* External mic to headphone */ |
| 10095 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10096 | /* External mic to speaker */ |
| 10097 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10098 | {} |
| 10099 | }; |
| 10100 | |
| 10101 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10102 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10103 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10104 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10105 | */ |
| 10106 | |
| 10107 | #define ALC_HP_EVENT 0x37 |
| 10108 | |
| 10109 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10110 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10111 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10112 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10113 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10114 | {} |
| 10115 | }; |
| 10116 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10117 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10118 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10119 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10120 | {} |
| 10121 | }; |
| 10122 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10123 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10124 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10125 | .items = { |
| 10126 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10127 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10128 | { "CD", 0x4 }, |
| 10129 | }, |
| 10130 | }; |
| 10131 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10132 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10133 | .num_items = 5, |
| 10134 | .items = { |
| 10135 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10136 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10137 | { "Line", 0x2 }, |
| 10138 | { "CD", 0x4 }, |
| 10139 | { "AUX IN", 0x6 }, |
| 10140 | }, |
| 10141 | }; |
| 10142 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10143 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10144 | .num_items = 4, |
| 10145 | .items = { |
| 10146 | { "Mic", 0x0 }, |
| 10147 | { "Front Mic", 0x2 }, |
| 10148 | { "Line", 0x1 }, |
| 10149 | { "CD", 0x4 }, |
| 10150 | }, |
| 10151 | }; |
| 10152 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10153 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10154 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10155 | { |
| 10156 | struct alc_spec *spec = codec->spec; |
| 10157 | unsigned int mute; |
| 10158 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10159 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10160 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10161 | /* need to execute and sync at first */ |
| 10162 | 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] | 10163 | /* check laptop HP jack */ |
| 10164 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10165 | AC_VERB_GET_PIN_SENSE, 0); |
| 10166 | /* need to execute and sync at first */ |
| 10167 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10168 | /* check docking HP jack */ |
| 10169 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10170 | AC_VERB_GET_PIN_SENSE, 0); |
| 10171 | if (present & AC_PINSENSE_PRESENCE) |
| 10172 | spec->jack_present = 1; |
| 10173 | else |
| 10174 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10175 | spec->sense_updated = 1; |
| 10176 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10177 | /* unmute internal speaker only if both HPs are unplugged and |
| 10178 | * master switch is on |
| 10179 | */ |
| 10180 | if (spec->jack_present) |
| 10181 | mute = HDA_AMP_MUTE; |
| 10182 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10183 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10184 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10185 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10186 | } |
| 10187 | |
| 10188 | /* unsolicited event for HP jack sensing */ |
| 10189 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10190 | unsigned int res) |
| 10191 | { |
| 10192 | if ((res >> 26) != ALC_HP_EVENT) |
| 10193 | return; |
| 10194 | alc262_fujitsu_automute(codec, 1); |
| 10195 | } |
| 10196 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10197 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10198 | { |
| 10199 | alc262_fujitsu_automute(codec, 1); |
| 10200 | } |
| 10201 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10202 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10203 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10204 | .ops = &snd_hda_bind_vol, |
| 10205 | .values = { |
| 10206 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10207 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10208 | 0 |
| 10209 | }, |
| 10210 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10211 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10212 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10213 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10214 | { |
| 10215 | struct alc_spec *spec = codec->spec; |
| 10216 | unsigned int mute; |
| 10217 | |
| 10218 | if (force || !spec->sense_updated) { |
| 10219 | unsigned int present_int_hp; |
| 10220 | /* need to execute and sync at first */ |
| 10221 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10222 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10223 | AC_VERB_GET_PIN_SENSE, 0); |
| 10224 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10225 | spec->sense_updated = 1; |
| 10226 | } |
| 10227 | if (spec->jack_present) { |
| 10228 | /* mute internal speaker */ |
| 10229 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10230 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10231 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10232 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10233 | } else { |
| 10234 | /* unmute internal speaker if necessary */ |
| 10235 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10236 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10237 | HDA_AMP_MUTE, mute); |
| 10238 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10239 | HDA_AMP_MUTE, mute); |
| 10240 | } |
| 10241 | } |
| 10242 | |
| 10243 | /* unsolicited event for HP jack sensing */ |
| 10244 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10245 | unsigned int res) |
| 10246 | { |
| 10247 | if ((res >> 26) != ALC_HP_EVENT) |
| 10248 | return; |
| 10249 | alc262_lenovo_3000_automute(codec, 1); |
| 10250 | } |
| 10251 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10252 | /* bind hp and internal speaker mute (with plug check) */ |
| 10253 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10254 | struct snd_ctl_elem_value *ucontrol) |
| 10255 | { |
| 10256 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10257 | long *valp = ucontrol->value.integer.value; |
| 10258 | int change; |
| 10259 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10260 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10261 | HDA_AMP_MUTE, |
| 10262 | valp ? 0 : HDA_AMP_MUTE); |
| 10263 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10264 | HDA_AMP_MUTE, |
| 10265 | valp ? 0 : HDA_AMP_MUTE); |
| 10266 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10267 | if (change) |
| 10268 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10269 | return change; |
| 10270 | } |
| 10271 | |
| 10272 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10273 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10274 | { |
| 10275 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10276 | .name = "Master Playback Switch", |
| 10277 | .info = snd_hda_mixer_amp_switch_info, |
| 10278 | .get = snd_hda_mixer_amp_switch_get, |
| 10279 | .put = alc262_fujitsu_master_sw_put, |
| 10280 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10281 | }, |
| 10282 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10283 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10284 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10285 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10286 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10287 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10288 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10289 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10290 | { } /* end */ |
| 10291 | }; |
| 10292 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10293 | /* bind hp and internal speaker mute (with plug check) */ |
| 10294 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10295 | struct snd_ctl_elem_value *ucontrol) |
| 10296 | { |
| 10297 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10298 | long *valp = ucontrol->value.integer.value; |
| 10299 | int change; |
| 10300 | |
| 10301 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10302 | HDA_AMP_MUTE, |
| 10303 | valp ? 0 : HDA_AMP_MUTE); |
| 10304 | |
| 10305 | if (change) |
| 10306 | alc262_lenovo_3000_automute(codec, 0); |
| 10307 | return change; |
| 10308 | } |
| 10309 | |
| 10310 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10311 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10312 | { |
| 10313 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10314 | .name = "Master Playback Switch", |
| 10315 | .info = snd_hda_mixer_amp_switch_info, |
| 10316 | .get = snd_hda_mixer_amp_switch_get, |
| 10317 | .put = alc262_lenovo_3000_master_sw_put, |
| 10318 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10319 | }, |
| 10320 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10321 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10322 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10323 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10324 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10325 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10326 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10327 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10328 | { } /* end */ |
| 10329 | }; |
| 10330 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10331 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10332 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10333 | { |
| 10334 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10335 | .name = "Master Playback Switch", |
| 10336 | .info = snd_hda_mixer_amp_switch_info, |
| 10337 | .get = snd_hda_mixer_amp_switch_get, |
| 10338 | .put = alc262_sony_master_sw_put, |
| 10339 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 10340 | }, |
| 10341 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10342 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10343 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10344 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10345 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10346 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10347 | { } /* end */ |
| 10348 | }; |
| 10349 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10350 | /* additional init verbs for Benq laptops */ |
| 10351 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10352 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10353 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10354 | {} |
| 10355 | }; |
| 10356 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10357 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10358 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10359 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10360 | |
| 10361 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10362 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10363 | {} |
| 10364 | }; |
| 10365 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10366 | /* Samsung Q1 Ultra Vista model setup */ |
| 10367 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10368 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10369 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10370 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10371 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10372 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10373 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10374 | { } /* end */ |
| 10375 | }; |
| 10376 | |
| 10377 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10378 | /* output mixer */ |
| 10379 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10381 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10382 | /* speaker */ |
| 10383 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10384 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10385 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10386 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10387 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10388 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10389 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10390 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10391 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10392 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10393 | /* internal mic */ |
| 10394 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10395 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10396 | /* ADC, choose mic */ |
| 10397 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10398 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10399 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10400 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10401 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10402 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10403 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10404 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10405 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10406 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10407 | {} |
| 10408 | }; |
| 10409 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10410 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10411 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10412 | { |
| 10413 | struct alc_spec *spec = codec->spec; |
| 10414 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10415 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10416 | mute = 0; |
| 10417 | /* auto-mute only when HP is used as HP */ |
| 10418 | if (!spec->cur_mux[0]) { |
| 10419 | unsigned int present; |
| 10420 | /* need to execute and sync at first */ |
| 10421 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10422 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10423 | AC_VERB_GET_PIN_SENSE, 0); |
| 10424 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10425 | if (spec->jack_present) |
| 10426 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10427 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10428 | /* mute/unmute internal speaker */ |
| 10429 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10430 | HDA_AMP_MUTE, mute); |
| 10431 | /* mute/unmute HP */ |
| 10432 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10433 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10434 | } |
| 10435 | |
| 10436 | /* unsolicited event for HP jack sensing */ |
| 10437 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10438 | unsigned int res) |
| 10439 | { |
| 10440 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10441 | return; |
| 10442 | alc262_ultra_automute(codec); |
| 10443 | } |
| 10444 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10445 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10446 | .num_items = 2, |
| 10447 | .items = { |
| 10448 | { "Mic", 0x1 }, |
| 10449 | { "Headphone", 0x7 }, |
| 10450 | }, |
| 10451 | }; |
| 10452 | |
| 10453 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10454 | struct snd_ctl_elem_value *ucontrol) |
| 10455 | { |
| 10456 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10457 | struct alc_spec *spec = codec->spec; |
| 10458 | int ret; |
| 10459 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10460 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10461 | if (!ret) |
| 10462 | return 0; |
| 10463 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10464 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10465 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10466 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10467 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10468 | return ret; |
| 10469 | } |
| 10470 | |
| 10471 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10472 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10473 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10474 | { |
| 10475 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10476 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10477 | .info = alc_mux_enum_info, |
| 10478 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10479 | .put = alc262_ultra_mux_enum_put, |
| 10480 | }, |
| 10481 | { } /* end */ |
| 10482 | }; |
| 10483 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10484 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10485 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10486 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10487 | { |
| 10488 | hda_nid_t nid; |
| 10489 | int err; |
| 10490 | |
| 10491 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10492 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10493 | spec->multiout.dac_nids[0] = 2; |
| 10494 | |
| 10495 | nid = cfg->line_out_pins[0]; |
| 10496 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10497 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10498 | "Front Playback Volume", |
| 10499 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10500 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10501 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10502 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10503 | "Front Playback Switch", |
| 10504 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10505 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10506 | return err; |
| 10507 | } |
| 10508 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10509 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10510 | if (nid) { |
| 10511 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10512 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10513 | "Speaker Playback Volume", |
| 10514 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10515 | HDA_OUTPUT)); |
| 10516 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10517 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10518 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10519 | "Speaker Playback Switch", |
| 10520 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10521 | HDA_OUTPUT)); |
| 10522 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10523 | return err; |
| 10524 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10525 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10526 | "Speaker Playback Switch", |
| 10527 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10528 | HDA_OUTPUT)); |
| 10529 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10530 | return err; |
| 10531 | } |
| 10532 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10533 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10534 | if (nid) { |
| 10535 | /* spec->multiout.hp_nid = 2; */ |
| 10536 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10537 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10538 | "Headphone Playback Volume", |
| 10539 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10540 | HDA_OUTPUT)); |
| 10541 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10542 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10543 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10544 | "Headphone Playback Switch", |
| 10545 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10546 | HDA_OUTPUT)); |
| 10547 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10548 | return err; |
| 10549 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10550 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10551 | "Headphone Playback Switch", |
| 10552 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10553 | HDA_OUTPUT)); |
| 10554 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10555 | return err; |
| 10556 | } |
| 10557 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10558 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10559 | } |
| 10560 | |
| 10561 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10562 | #define alc262_auto_create_analog_input_ctls \ |
| 10563 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10564 | |
| 10565 | /* |
| 10566 | * generic initialization of ADC, input mixers and output mixers |
| 10567 | */ |
| 10568 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10569 | /* |
| 10570 | * Unmute ADC0-2 and set the default input to mic-in |
| 10571 | */ |
| 10572 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10573 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10574 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10575 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10576 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10577 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10578 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10579 | /* 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] | 10580 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10581 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10582 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10583 | */ |
| 10584 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10585 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10586 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10587 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10588 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10589 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10590 | |
| 10591 | /* |
| 10592 | * Set up output mixers (0x0c - 0x0f) |
| 10593 | */ |
| 10594 | /* set vol=0 to output mixers */ |
| 10595 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10596 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10597 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10598 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10599 | /* set up input amps for analog loopback */ |
| 10600 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10601 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10602 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10603 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10604 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10605 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10606 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10607 | |
| 10608 | /* FIXME: use matrix-type input source selection */ |
| 10609 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10610 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10611 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10612 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10613 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10614 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10615 | /* Input mixer2 */ |
| 10616 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10617 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10618 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10619 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10620 | /* Input mixer3 */ |
| 10621 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10622 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10623 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10625 | |
| 10626 | { } |
| 10627 | }; |
| 10628 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10629 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10630 | /* |
| 10631 | * Unmute ADC0-2 and set the default input to mic-in |
| 10632 | */ |
| 10633 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10634 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10635 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10636 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10637 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10638 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10639 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10640 | /* 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] | 10641 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10642 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10643 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10644 | */ |
| 10645 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10646 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10647 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10648 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10649 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10650 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10651 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10652 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10653 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10654 | /* |
| 10655 | * Set up output mixers (0x0c - 0x0e) |
| 10656 | */ |
| 10657 | /* set vol=0 to output mixers */ |
| 10658 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10659 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10660 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10661 | |
| 10662 | /* set up input amps for analog loopback */ |
| 10663 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10664 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10665 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10666 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10667 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10668 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10669 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10670 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10671 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10672 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10673 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10674 | |
| 10675 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10676 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10677 | |
| 10678 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10679 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10680 | |
| 10681 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10682 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10683 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10684 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10685 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10686 | |
| 10687 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10688 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10689 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10690 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10691 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10692 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10693 | |
| 10694 | |
| 10695 | /* FIXME: use matrix-type input source selection */ |
| 10696 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10697 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10698 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10699 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10700 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10701 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10702 | /* Input mixer2 */ |
| 10703 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10704 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10705 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10706 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10707 | /* Input mixer3 */ |
| 10708 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10709 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10710 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10711 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10712 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10713 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10714 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10715 | { } |
| 10716 | }; |
| 10717 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10718 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10719 | /* |
| 10720 | * Unmute ADC0-2 and set the default input to mic-in |
| 10721 | */ |
| 10722 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10723 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10724 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10725 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10726 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10727 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10728 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10729 | /* 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] | 10730 | * mixer widget |
| 10731 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10732 | * panel mic (mic 2) |
| 10733 | */ |
| 10734 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10735 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10736 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10737 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10738 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10739 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10740 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10741 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10742 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10743 | /* |
| 10744 | * Set up output mixers (0x0c - 0x0e) |
| 10745 | */ |
| 10746 | /* set vol=0 to output mixers */ |
| 10747 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10748 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10749 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10750 | |
| 10751 | /* set up input amps for analog loopback */ |
| 10752 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10753 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10754 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10755 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10756 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10757 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10758 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10759 | |
| 10760 | |
| 10761 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10762 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10763 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10764 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10765 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10766 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10767 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10768 | |
| 10769 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10770 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10771 | |
| 10772 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10773 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10774 | |
| 10775 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10776 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10777 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10778 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10779 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10780 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10781 | |
| 10782 | /* FIXME: use matrix-type input source selection */ |
| 10783 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10784 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10785 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10786 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10787 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10788 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10789 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10790 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10791 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10792 | /* Input mixer2 */ |
| 10793 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10794 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10795 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10796 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10797 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10798 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10799 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10800 | /* Input mixer3 */ |
| 10801 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10802 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10803 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10804 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10805 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10806 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10807 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10808 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10809 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10810 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10811 | { } |
| 10812 | }; |
| 10813 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10814 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10815 | |
| 10816 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10817 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10818 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10819 | |
| 10820 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10821 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10822 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10823 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10824 | |
| 10825 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10826 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10827 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10828 | {} |
| 10829 | }; |
| 10830 | |
| 10831 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10832 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10833 | #define alc262_loopbacks alc880_loopbacks |
| 10834 | #endif |
| 10835 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10836 | /* pcm configuration: identiacal with ALC880 */ |
| 10837 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10838 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10839 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10840 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10841 | |
| 10842 | /* |
| 10843 | * BIOS auto configuration |
| 10844 | */ |
| 10845 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10846 | { |
| 10847 | struct alc_spec *spec = codec->spec; |
| 10848 | int err; |
| 10849 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10850 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10851 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10852 | alc262_ignore); |
| 10853 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10854 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10855 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10856 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10857 | spec->multiout.max_channels = 2; |
| 10858 | spec->no_analog = 1; |
| 10859 | goto dig_only; |
| 10860 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10861 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10862 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10863 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10864 | if (err < 0) |
| 10865 | return err; |
| 10866 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10867 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10868 | return err; |
| 10869 | |
| 10870 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10871 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10872 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10873 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10874 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10875 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10876 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10877 | if (spec->autocfg.dig_in_pin) |
| 10878 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10879 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10880 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10881 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10882 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10883 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10884 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10885 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10886 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10887 | err = alc_auto_add_mic_boost(codec); |
| 10888 | if (err < 0) |
| 10889 | return err; |
| 10890 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame^] | 10891 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 10892 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10893 | return 1; |
| 10894 | } |
| 10895 | |
| 10896 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10897 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10898 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10899 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10900 | |
| 10901 | |
| 10902 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10903 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10904 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10905 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10906 | alc262_auto_init_multi_out(codec); |
| 10907 | alc262_auto_init_hp_out(codec); |
| 10908 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10909 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10910 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10911 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10912 | } |
| 10913 | |
| 10914 | /* |
| 10915 | * configuration and preset |
| 10916 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10917 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10918 | [ALC262_BASIC] = "basic", |
| 10919 | [ALC262_HIPPO] = "hippo", |
| 10920 | [ALC262_HIPPO_1] = "hippo_1", |
| 10921 | [ALC262_FUJITSU] = "fujitsu", |
| 10922 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10923 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10924 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10925 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10926 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10927 | [ALC262_BENQ_T31] = "benq-t31", |
| 10928 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10929 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10930 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10931 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10932 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10933 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10934 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10935 | [ALC262_AUTO] = "auto", |
| 10936 | }; |
| 10937 | |
| 10938 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10939 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10940 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10941 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 10942 | ALC262_HP_BPC), |
| 10943 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 10944 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 10945 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 10946 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10947 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10948 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10949 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10950 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10951 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10952 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10953 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10954 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10955 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10956 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10957 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10958 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10959 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10960 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10961 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10962 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10963 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 10964 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 10965 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 10966 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10967 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10968 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10969 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10970 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10971 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10972 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10973 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 10974 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 10975 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10976 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10977 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10978 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10979 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10980 | {} |
| 10981 | }; |
| 10982 | |
| 10983 | static struct alc_config_preset alc262_presets[] = { |
| 10984 | [ALC262_BASIC] = { |
| 10985 | .mixers = { alc262_base_mixer }, |
| 10986 | .init_verbs = { alc262_init_verbs }, |
| 10987 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10988 | .dac_nids = alc262_dac_nids, |
| 10989 | .hp_nid = 0x03, |
| 10990 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10991 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10992 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10993 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10994 | [ALC262_HIPPO] = { |
| 10995 | .mixers = { alc262_base_mixer }, |
| 10996 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10997 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10998 | .dac_nids = alc262_dac_nids, |
| 10999 | .hp_nid = 0x03, |
| 11000 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11001 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11002 | .channel_mode = alc262_modes, |
| 11003 | .input_mux = &alc262_capture_source, |
| 11004 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11005 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11006 | }, |
| 11007 | [ALC262_HIPPO_1] = { |
| 11008 | .mixers = { alc262_hippo1_mixer }, |
| 11009 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11010 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11011 | .dac_nids = alc262_dac_nids, |
| 11012 | .hp_nid = 0x02, |
| 11013 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11014 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11015 | .channel_mode = alc262_modes, |
| 11016 | .input_mux = &alc262_capture_source, |
| 11017 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11018 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11019 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11020 | [ALC262_FUJITSU] = { |
| 11021 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11022 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11023 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11024 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11025 | .dac_nids = alc262_dac_nids, |
| 11026 | .hp_nid = 0x03, |
| 11027 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11028 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11029 | .channel_mode = alc262_modes, |
| 11030 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11031 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11032 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11033 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11034 | [ALC262_HP_BPC] = { |
| 11035 | .mixers = { alc262_HP_BPC_mixer }, |
| 11036 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11037 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11038 | .dac_nids = alc262_dac_nids, |
| 11039 | .hp_nid = 0x03, |
| 11040 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11041 | .channel_mode = alc262_modes, |
| 11042 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11043 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11044 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11045 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11046 | [ALC262_HP_BPC_D7000_WF] = { |
| 11047 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11048 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11049 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11050 | .dac_nids = alc262_dac_nids, |
| 11051 | .hp_nid = 0x03, |
| 11052 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11053 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11054 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11055 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11056 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11057 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11058 | [ALC262_HP_BPC_D7000_WL] = { |
| 11059 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11060 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11061 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11062 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11063 | .dac_nids = alc262_dac_nids, |
| 11064 | .hp_nid = 0x03, |
| 11065 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11066 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11067 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11068 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11069 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11070 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11071 | [ALC262_HP_TC_T5735] = { |
| 11072 | .mixers = { alc262_hp_t5735_mixer }, |
| 11073 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11074 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11075 | .dac_nids = alc262_dac_nids, |
| 11076 | .hp_nid = 0x03, |
| 11077 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11078 | .channel_mode = alc262_modes, |
| 11079 | .input_mux = &alc262_capture_source, |
| 11080 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 11081 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11082 | }, |
| 11083 | [ALC262_HP_RP5700] = { |
| 11084 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11085 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11086 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11087 | .dac_nids = alc262_dac_nids, |
| 11088 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11089 | .channel_mode = alc262_modes, |
| 11090 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11091 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11092 | [ALC262_BENQ_ED8] = { |
| 11093 | .mixers = { alc262_base_mixer }, |
| 11094 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11095 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11096 | .dac_nids = alc262_dac_nids, |
| 11097 | .hp_nid = 0x03, |
| 11098 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11099 | .channel_mode = alc262_modes, |
| 11100 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11101 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11102 | [ALC262_SONY_ASSAMD] = { |
| 11103 | .mixers = { alc262_sony_mixer }, |
| 11104 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11105 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11106 | .dac_nids = alc262_dac_nids, |
| 11107 | .hp_nid = 0x02, |
| 11108 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11109 | .channel_mode = alc262_modes, |
| 11110 | .input_mux = &alc262_capture_source, |
| 11111 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11112 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11113 | }, |
| 11114 | [ALC262_BENQ_T31] = { |
| 11115 | .mixers = { alc262_benq_t31_mixer }, |
| 11116 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 11117 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11118 | .dac_nids = alc262_dac_nids, |
| 11119 | .hp_nid = 0x03, |
| 11120 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11121 | .channel_mode = alc262_modes, |
| 11122 | .input_mux = &alc262_capture_source, |
| 11123 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11124 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11125 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11126 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11127 | .mixers = { alc262_ultra_mixer }, |
| 11128 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11129 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11130 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11131 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11132 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11133 | .channel_mode = alc262_modes, |
| 11134 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11135 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11136 | .capsrc_nids = alc262_capsrc_nids, |
| 11137 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11138 | .unsol_event = alc262_ultra_unsol_event, |
| 11139 | .init_hook = alc262_ultra_automute, |
| 11140 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11141 | [ALC262_LENOVO_3000] = { |
| 11142 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11143 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11144 | alc262_lenovo_3000_unsol_verbs }, |
| 11145 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11146 | .dac_nids = alc262_dac_nids, |
| 11147 | .hp_nid = 0x03, |
| 11148 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11149 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11150 | .channel_mode = alc262_modes, |
| 11151 | .input_mux = &alc262_fujitsu_capture_source, |
| 11152 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11153 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11154 | [ALC262_NEC] = { |
| 11155 | .mixers = { alc262_nec_mixer }, |
| 11156 | .init_verbs = { alc262_nec_verbs }, |
| 11157 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11158 | .dac_nids = alc262_dac_nids, |
| 11159 | .hp_nid = 0x03, |
| 11160 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11161 | .channel_mode = alc262_modes, |
| 11162 | .input_mux = &alc262_capture_source, |
| 11163 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11164 | [ALC262_TOSHIBA_S06] = { |
| 11165 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11166 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11167 | alc262_eapd_verbs }, |
| 11168 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11169 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11170 | .dac_nids = alc262_dac_nids, |
| 11171 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 11172 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11173 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11174 | .channel_mode = alc262_modes, |
| 11175 | .input_mux = &alc262_dmic_capture_source, |
| 11176 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11177 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11178 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11179 | [ALC262_TOSHIBA_RX1] = { |
| 11180 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11181 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11182 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11183 | .dac_nids = alc262_dac_nids, |
| 11184 | .hp_nid = 0x03, |
| 11185 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11186 | .channel_mode = alc262_modes, |
| 11187 | .input_mux = &alc262_capture_source, |
| 11188 | .unsol_event = alc262_hippo_unsol_event, |
| 11189 | .init_hook = alc262_hippo_automute, |
| 11190 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11191 | [ALC262_TYAN] = { |
| 11192 | .mixers = { alc262_tyan_mixer }, |
| 11193 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11194 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11195 | .dac_nids = alc262_dac_nids, |
| 11196 | .hp_nid = 0x02, |
| 11197 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11198 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11199 | .channel_mode = alc262_modes, |
| 11200 | .input_mux = &alc262_capture_source, |
| 11201 | .unsol_event = alc262_tyan_unsol_event, |
| 11202 | .init_hook = alc262_tyan_automute, |
| 11203 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11204 | }; |
| 11205 | |
| 11206 | static int patch_alc262(struct hda_codec *codec) |
| 11207 | { |
| 11208 | struct alc_spec *spec; |
| 11209 | int board_config; |
| 11210 | int err; |
| 11211 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11212 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11213 | if (spec == NULL) |
| 11214 | return -ENOMEM; |
| 11215 | |
| 11216 | codec->spec = spec; |
| 11217 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11218 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11219 | * under-run |
| 11220 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11221 | { |
| 11222 | int tmp; |
| 11223 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11224 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11225 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11226 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11227 | } |
| 11228 | #endif |
| 11229 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11230 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11231 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11232 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11233 | alc262_models, |
| 11234 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11235 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11236 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11237 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 11238 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11239 | board_config = ALC262_AUTO; |
| 11240 | } |
| 11241 | |
| 11242 | if (board_config == ALC262_AUTO) { |
| 11243 | /* automatic parse from the BIOS config */ |
| 11244 | err = alc262_parse_auto_config(codec); |
| 11245 | if (err < 0) { |
| 11246 | alc_free(codec); |
| 11247 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11248 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11249 | printk(KERN_INFO |
| 11250 | "hda_codec: Cannot set up configuration " |
| 11251 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11252 | board_config = ALC262_BASIC; |
| 11253 | } |
| 11254 | } |
| 11255 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11256 | if (!spec->no_analog) { |
| 11257 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11258 | if (err < 0) { |
| 11259 | alc_free(codec); |
| 11260 | return err; |
| 11261 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11262 | } |
| 11263 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11264 | if (board_config != ALC262_AUTO) |
| 11265 | setup_preset(spec, &alc262_presets[board_config]); |
| 11266 | |
| 11267 | spec->stream_name_analog = "ALC262 Analog"; |
| 11268 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11269 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11270 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11271 | spec->stream_name_digital = "ALC262 Digital"; |
| 11272 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11273 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11274 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11275 | spec->capture_style = CAPT_MIX; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11276 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11277 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11278 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11279 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11280 | /* get type */ |
| 11281 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11282 | if (wcap != AC_WID_AUD_IN) { |
| 11283 | spec->adc_nids = alc262_adc_nids_alt; |
| 11284 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11285 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11286 | } else { |
| 11287 | spec->adc_nids = alc262_adc_nids; |
| 11288 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11289 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11290 | } |
| 11291 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11292 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11293 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11294 | if (!spec->no_analog) |
| 11295 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11296 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11297 | spec->vmaster_nid = 0x0c; |
| 11298 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11299 | codec->patch_ops = alc_patch_ops; |
| 11300 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11301 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11302 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11303 | if (!spec->loopback.amplist) |
| 11304 | spec->loopback.amplist = alc262_loopbacks; |
| 11305 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11306 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11307 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11308 | return 0; |
| 11309 | } |
| 11310 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11311 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11312 | * ALC268 channel source setting (2 channel) |
| 11313 | */ |
| 11314 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11315 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11316 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11317 | static hda_nid_t alc268_dac_nids[2] = { |
| 11318 | /* front, hp */ |
| 11319 | 0x02, 0x03 |
| 11320 | }; |
| 11321 | |
| 11322 | static hda_nid_t alc268_adc_nids[2] = { |
| 11323 | /* ADC0-1 */ |
| 11324 | 0x08, 0x07 |
| 11325 | }; |
| 11326 | |
| 11327 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11328 | /* ADC0 */ |
| 11329 | 0x08 |
| 11330 | }; |
| 11331 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11332 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11333 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11334 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11335 | /* output mixer control */ |
| 11336 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11337 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11338 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11339 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11340 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11341 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11342 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11343 | { } |
| 11344 | }; |
| 11345 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11346 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11347 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11348 | .ops = &snd_hda_bind_sw, |
| 11349 | .values = { |
| 11350 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11351 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11352 | 0 |
| 11353 | }, |
| 11354 | }; |
| 11355 | |
| 11356 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11357 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11358 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11359 | { } |
| 11360 | }; |
| 11361 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11362 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11363 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11364 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11365 | { } |
| 11366 | }; |
| 11367 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11368 | /* Toshiba specific */ |
| 11369 | #define alc268_toshiba_automute alc262_hippo_automute |
| 11370 | |
| 11371 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11372 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11373 | { } /* end */ |
| 11374 | }; |
| 11375 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11376 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11377 | .num_items = 2, |
| 11378 | .items = { |
| 11379 | { "i-Mic", 0x6 }, |
| 11380 | { "E-Mic", 0x0 }, |
| 11381 | }, |
| 11382 | }; |
| 11383 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11384 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11385 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11386 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11387 | .ops = &snd_hda_bind_vol, |
| 11388 | .values = { |
| 11389 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11390 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11391 | 0 |
| 11392 | }, |
| 11393 | }; |
| 11394 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11395 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11396 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11397 | { |
| 11398 | struct alc_spec *spec = codec->spec; |
| 11399 | unsigned int mute; |
| 11400 | |
| 11401 | if (force || !spec->sense_updated) { |
| 11402 | unsigned int present; |
| 11403 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11404 | AC_VERB_GET_PIN_SENSE, 0); |
| 11405 | spec->jack_present = (present & 0x80000000) != 0; |
| 11406 | spec->sense_updated = 1; |
| 11407 | } |
| 11408 | if (spec->jack_present) |
| 11409 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11410 | else /* unmute internal speaker if necessary */ |
| 11411 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11412 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11413 | HDA_AMP_MUTE, mute); |
| 11414 | } |
| 11415 | |
| 11416 | |
| 11417 | /* bind hp and internal speaker mute (with plug check) */ |
| 11418 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11419 | struct snd_ctl_elem_value *ucontrol) |
| 11420 | { |
| 11421 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11422 | long *valp = ucontrol->value.integer.value; |
| 11423 | int change; |
| 11424 | |
| 11425 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11426 | HDA_AMP_MUTE, |
| 11427 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11428 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11429 | HDA_AMP_MUTE, |
| 11430 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11431 | if (change) |
| 11432 | alc268_acer_automute(codec, 0); |
| 11433 | return change; |
| 11434 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11435 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11436 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11437 | /* output mixer control */ |
| 11438 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11439 | { |
| 11440 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11441 | .name = "Master Playback Switch", |
| 11442 | .info = snd_hda_mixer_amp_switch_info, |
| 11443 | .get = snd_hda_mixer_amp_switch_get, |
| 11444 | .put = alc268_acer_master_sw_put, |
| 11445 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11446 | }, |
| 11447 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11448 | { } |
| 11449 | }; |
| 11450 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11451 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11452 | /* output mixer control */ |
| 11453 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11454 | { |
| 11455 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11456 | .name = "Master Playback Switch", |
| 11457 | .info = snd_hda_mixer_amp_switch_info, |
| 11458 | .get = snd_hda_mixer_amp_switch_get, |
| 11459 | .put = alc268_acer_master_sw_put, |
| 11460 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11461 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11462 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11463 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11464 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11465 | { } |
| 11466 | }; |
| 11467 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11468 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11469 | /* output mixer control */ |
| 11470 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11471 | { |
| 11472 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11473 | .name = "Master Playback Switch", |
| 11474 | .info = snd_hda_mixer_amp_switch_info, |
| 11475 | .get = snd_hda_mixer_amp_switch_get, |
| 11476 | .put = alc268_acer_master_sw_put, |
| 11477 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11478 | }, |
| 11479 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11480 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11481 | { } |
| 11482 | }; |
| 11483 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11484 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11485 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11486 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11487 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11488 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11489 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11490 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11491 | { } |
| 11492 | }; |
| 11493 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11494 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11495 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11496 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11497 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11498 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11499 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11500 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11501 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11502 | { } |
| 11503 | }; |
| 11504 | |
| 11505 | /* unsolicited event for HP jack sensing */ |
| 11506 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 11507 | unsigned int res) |
| 11508 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11509 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11510 | return; |
| 11511 | alc268_toshiba_automute(codec); |
| 11512 | } |
| 11513 | |
| 11514 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11515 | unsigned int res) |
| 11516 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11517 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11518 | return; |
| 11519 | alc268_acer_automute(codec, 1); |
| 11520 | } |
| 11521 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11522 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11523 | { |
| 11524 | alc268_acer_automute(codec, 1); |
| 11525 | } |
| 11526 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11527 | /* toggle speaker-output according to the hp-jack state */ |
| 11528 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11529 | { |
| 11530 | unsigned int present; |
| 11531 | unsigned char bits; |
| 11532 | |
| 11533 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11534 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11535 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11536 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11537 | AMP_IN_MUTE(0), bits); |
| 11538 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11539 | AMP_IN_MUTE(0), bits); |
| 11540 | } |
| 11541 | |
| 11542 | |
| 11543 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11544 | { |
| 11545 | unsigned int present; |
| 11546 | |
| 11547 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11548 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11549 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11550 | present ? 0x0 : 0x6); |
| 11551 | } |
| 11552 | |
| 11553 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11554 | unsigned int res) |
| 11555 | { |
| 11556 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11557 | alc268_aspire_one_speaker_automute(codec); |
| 11558 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11559 | alc268_acer_mic_automute(codec); |
| 11560 | } |
| 11561 | |
| 11562 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11563 | { |
| 11564 | alc268_aspire_one_speaker_automute(codec); |
| 11565 | alc268_acer_mic_automute(codec); |
| 11566 | } |
| 11567 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11568 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11569 | /* output mixer control */ |
| 11570 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11571 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11572 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11573 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11574 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11575 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11576 | { } |
| 11577 | }; |
| 11578 | |
| 11579 | static struct hda_verb alc268_dell_verbs[] = { |
| 11580 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11581 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11582 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11583 | { } |
| 11584 | }; |
| 11585 | |
| 11586 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11587 | static void alc268_dell_automute(struct hda_codec *codec) |
| 11588 | { |
| 11589 | unsigned int present; |
| 11590 | unsigned int mute; |
| 11591 | |
| 11592 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 11593 | if (present & 0x80000000) |
| 11594 | mute = HDA_AMP_MUTE; |
| 11595 | else |
| 11596 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 11597 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11598 | HDA_AMP_MUTE, mute); |
| 11599 | } |
| 11600 | |
| 11601 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 11602 | unsigned int res) |
| 11603 | { |
| 11604 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11605 | return; |
| 11606 | alc268_dell_automute(codec); |
| 11607 | } |
| 11608 | |
| 11609 | #define alc268_dell_init_hook alc268_dell_automute |
| 11610 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11611 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11612 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11613 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11614 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11615 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11616 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11617 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11618 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11619 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11620 | { } |
| 11621 | }; |
| 11622 | |
| 11623 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11624 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11625 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11626 | { } |
| 11627 | }; |
| 11628 | |
| 11629 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 11630 | { |
| 11631 | unsigned int present; |
| 11632 | |
| 11633 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11634 | & AC_PINSENSE_PRESENCE; |
| 11635 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11636 | present ? 0 : PIN_OUT); |
| 11637 | } |
| 11638 | |
| 11639 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11640 | { |
| 11641 | unsigned int present; |
| 11642 | |
| 11643 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11644 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11645 | snd_hda_codec_write(codec, 0x23, 0, |
| 11646 | AC_VERB_SET_CONNECT_SEL, |
| 11647 | present ? 0x00 : 0x01); |
| 11648 | } |
| 11649 | |
| 11650 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 11651 | { |
| 11652 | alc267_quanta_il1_hp_automute(codec); |
| 11653 | alc267_quanta_il1_mic_automute(codec); |
| 11654 | } |
| 11655 | |
| 11656 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11657 | unsigned int res) |
| 11658 | { |
| 11659 | switch (res >> 26) { |
| 11660 | case ALC880_HP_EVENT: |
| 11661 | alc267_quanta_il1_hp_automute(codec); |
| 11662 | break; |
| 11663 | case ALC880_MIC_EVENT: |
| 11664 | alc267_quanta_il1_mic_automute(codec); |
| 11665 | break; |
| 11666 | } |
| 11667 | } |
| 11668 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11669 | /* |
| 11670 | * generic initialization of ADC, input mixers and output mixers |
| 11671 | */ |
| 11672 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11673 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11674 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11675 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11676 | |
| 11677 | /* |
| 11678 | * Set up output mixers (0x0c - 0x0e) |
| 11679 | */ |
| 11680 | /* set vol=0 to output mixers */ |
| 11681 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11682 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11683 | |
| 11684 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11685 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11686 | |
| 11687 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11688 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11689 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11690 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11691 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11692 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11693 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11694 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11695 | |
| 11696 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11697 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11698 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11699 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11700 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11701 | |
| 11702 | /* set PCBEEP vol = 0, mute connections */ |
| 11703 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11704 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11705 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11706 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11707 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11708 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11709 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11710 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11711 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11712 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11713 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11714 | { } |
| 11715 | }; |
| 11716 | |
| 11717 | /* |
| 11718 | * generic initialization of ADC, input mixers and output mixers |
| 11719 | */ |
| 11720 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11721 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11722 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11723 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11724 | |
| 11725 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11726 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11727 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11728 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11729 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11730 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11731 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11732 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11733 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11734 | |
| 11735 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11736 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11737 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11738 | /* set PCBEEP vol = 0, mute connections */ |
| 11739 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11740 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11741 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11742 | |
| 11743 | { } |
| 11744 | }; |
| 11745 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11746 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11747 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11748 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11749 | { |
| 11750 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11751 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11752 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11753 | */ |
| 11754 | /* .name = "Capture Source", */ |
| 11755 | .name = "Input Source", |
| 11756 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11757 | .info = alc_mux_enum_info, |
| 11758 | .get = alc_mux_enum_get, |
| 11759 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11760 | }, |
| 11761 | { } /* end */ |
| 11762 | }; |
| 11763 | |
| 11764 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11765 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11766 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11767 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11768 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11769 | { |
| 11770 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11771 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11772 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11773 | */ |
| 11774 | /* .name = "Capture Source", */ |
| 11775 | .name = "Input Source", |
| 11776 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11777 | .info = alc_mux_enum_info, |
| 11778 | .get = alc_mux_enum_get, |
| 11779 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11780 | }, |
| 11781 | { } /* end */ |
| 11782 | }; |
| 11783 | |
| 11784 | static struct hda_input_mux alc268_capture_source = { |
| 11785 | .num_items = 4, |
| 11786 | .items = { |
| 11787 | { "Mic", 0x0 }, |
| 11788 | { "Front Mic", 0x1 }, |
| 11789 | { "Line", 0x2 }, |
| 11790 | { "CD", 0x3 }, |
| 11791 | }, |
| 11792 | }; |
| 11793 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11794 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11795 | .num_items = 3, |
| 11796 | .items = { |
| 11797 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11798 | { "Internal Mic", 0x1 }, |
| 11799 | { "Line", 0x2 }, |
| 11800 | }, |
| 11801 | }; |
| 11802 | |
| 11803 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11804 | .num_items = 3, |
| 11805 | .items = { |
| 11806 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11807 | { "Internal Mic", 0x6 }, |
| 11808 | { "Line", 0x2 }, |
| 11809 | }, |
| 11810 | }; |
| 11811 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11812 | #ifdef CONFIG_SND_DEBUG |
| 11813 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11814 | /* Volume widgets */ |
| 11815 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11816 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11817 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11818 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11819 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11820 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11821 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11822 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11823 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11824 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11825 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11826 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11827 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11828 | /* The below appears problematic on some hardwares */ |
| 11829 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11830 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11831 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11832 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11833 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11834 | |
| 11835 | /* Modes for retasking pin widgets */ |
| 11836 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11837 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11838 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11839 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11840 | |
| 11841 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11842 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11843 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11844 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11845 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11846 | |
| 11847 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11848 | * The ALC268 does not have an SPDIF input. |
| 11849 | */ |
| 11850 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11851 | |
| 11852 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11853 | * this output to turn on an external amplifier. |
| 11854 | */ |
| 11855 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11856 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11857 | |
| 11858 | { } /* end */ |
| 11859 | }; |
| 11860 | #endif |
| 11861 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11862 | /* create input playback/capture controls for the given pin */ |
| 11863 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11864 | const char *ctlname, int idx) |
| 11865 | { |
| 11866 | char name[32]; |
| 11867 | int err; |
| 11868 | |
| 11869 | sprintf(name, "%s Playback Volume", ctlname); |
| 11870 | if (nid == 0x14) { |
| 11871 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11872 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11873 | HDA_OUTPUT)); |
| 11874 | if (err < 0) |
| 11875 | return err; |
| 11876 | } else if (nid == 0x15) { |
| 11877 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11878 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11879 | HDA_OUTPUT)); |
| 11880 | if (err < 0) |
| 11881 | return err; |
| 11882 | } else |
| 11883 | return -1; |
| 11884 | sprintf(name, "%s Playback Switch", ctlname); |
| 11885 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11886 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11887 | if (err < 0) |
| 11888 | return err; |
| 11889 | return 0; |
| 11890 | } |
| 11891 | |
| 11892 | /* add playback controls from the parsed DAC table */ |
| 11893 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11894 | const struct auto_pin_cfg *cfg) |
| 11895 | { |
| 11896 | hda_nid_t nid; |
| 11897 | int err; |
| 11898 | |
| 11899 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11900 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11901 | spec->multiout.dac_nids[0] = 2; |
| 11902 | spec->multiout.dac_nids[1] = 3; |
| 11903 | |
| 11904 | nid = cfg->line_out_pins[0]; |
| 11905 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11906 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11907 | |
| 11908 | nid = cfg->speaker_pins[0]; |
| 11909 | if (nid == 0x1d) { |
| 11910 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11911 | "Speaker Playback Volume", |
| 11912 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11913 | if (err < 0) |
| 11914 | return err; |
| 11915 | } |
| 11916 | nid = cfg->hp_pins[0]; |
| 11917 | if (nid) |
| 11918 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11919 | |
| 11920 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11921 | if (nid == 0x16) { |
| 11922 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11923 | "Mono Playback Switch", |
| 11924 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11925 | if (err < 0) |
| 11926 | return err; |
| 11927 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11928 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11929 | } |
| 11930 | |
| 11931 | /* create playback/capture controls for input pins */ |
| 11932 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11933 | const struct auto_pin_cfg *cfg) |
| 11934 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11935 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11936 | int i, idx1; |
| 11937 | |
| 11938 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11939 | switch(cfg->input_pins[i]) { |
| 11940 | case 0x18: |
| 11941 | idx1 = 0; /* Mic 1 */ |
| 11942 | break; |
| 11943 | case 0x19: |
| 11944 | idx1 = 1; /* Mic 2 */ |
| 11945 | break; |
| 11946 | case 0x1a: |
| 11947 | idx1 = 2; /* Line In */ |
| 11948 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11949 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11950 | idx1 = 3; /* CD */ |
| 11951 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11952 | case 0x12: |
| 11953 | case 0x13: |
| 11954 | idx1 = 6; /* digital mics */ |
| 11955 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11956 | default: |
| 11957 | continue; |
| 11958 | } |
| 11959 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11960 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11961 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11962 | } |
| 11963 | return 0; |
| 11964 | } |
| 11965 | |
| 11966 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11967 | { |
| 11968 | struct alc_spec *spec = codec->spec; |
| 11969 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11970 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11971 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11972 | unsigned int dac_vol1, dac_vol2; |
| 11973 | |
| 11974 | if (speaker_nid) { |
| 11975 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11976 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11977 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11978 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11979 | AMP_IN_UNMUTE(1)); |
| 11980 | snd_hda_codec_write(codec, 0x10, 0, |
| 11981 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11982 | AMP_IN_UNMUTE(1)); |
| 11983 | } else { |
| 11984 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11985 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11986 | snd_hda_codec_write(codec, 0x10, 0, |
| 11987 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11988 | } |
| 11989 | |
| 11990 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11991 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11992 | dac_vol2 = AMP_OUT_ZERO; |
| 11993 | else if (line_nid == 0x15) |
| 11994 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11995 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11996 | dac_vol2 = AMP_OUT_ZERO; |
| 11997 | else if (hp_nid == 0x15) |
| 11998 | dac_vol1 = AMP_OUT_ZERO; |
| 11999 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12000 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12001 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12002 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12003 | |
| 12004 | snd_hda_codec_write(codec, 0x02, 0, |
| 12005 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12006 | snd_hda_codec_write(codec, 0x03, 0, |
| 12007 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12008 | } |
| 12009 | |
| 12010 | /* pcm configuration: identiacal with ALC880 */ |
| 12011 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12012 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12013 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12014 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12015 | |
| 12016 | /* |
| 12017 | * BIOS auto configuration |
| 12018 | */ |
| 12019 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12020 | { |
| 12021 | struct alc_spec *spec = codec->spec; |
| 12022 | int err; |
| 12023 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12024 | |
| 12025 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12026 | alc268_ignore); |
| 12027 | if (err < 0) |
| 12028 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12029 | if (!spec->autocfg.line_outs) { |
| 12030 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12031 | spec->multiout.max_channels = 2; |
| 12032 | spec->no_analog = 1; |
| 12033 | goto dig_only; |
| 12034 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12035 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12036 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12037 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12038 | if (err < 0) |
| 12039 | return err; |
| 12040 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12041 | if (err < 0) |
| 12042 | return err; |
| 12043 | |
| 12044 | spec->multiout.max_channels = 2; |
| 12045 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12046 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12047 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12048 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12049 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12050 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12051 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12052 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12053 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12054 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12055 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12056 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12057 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12058 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12059 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12060 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12061 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12062 | err = alc_auto_add_mic_boost(codec); |
| 12063 | if (err < 0) |
| 12064 | return err; |
| 12065 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12066 | return 1; |
| 12067 | } |
| 12068 | |
| 12069 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12070 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12071 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12072 | |
| 12073 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12074 | static void alc268_auto_init(struct hda_codec *codec) |
| 12075 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12076 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12077 | alc268_auto_init_multi_out(codec); |
| 12078 | alc268_auto_init_hp_out(codec); |
| 12079 | alc268_auto_init_mono_speaker_out(codec); |
| 12080 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12081 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12082 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12083 | } |
| 12084 | |
| 12085 | /* |
| 12086 | * configuration and preset |
| 12087 | */ |
| 12088 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12089 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12090 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12091 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12092 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12093 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12094 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12095 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12096 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12097 | #ifdef CONFIG_SND_DEBUG |
| 12098 | [ALC268_TEST] = "test", |
| 12099 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12100 | [ALC268_AUTO] = "auto", |
| 12101 | }; |
| 12102 | |
| 12103 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12104 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12105 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12106 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12107 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12108 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12109 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12110 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12111 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12112 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12113 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12114 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12115 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 12116 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 12117 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12118 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12119 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12120 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12121 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12122 | {} |
| 12123 | }; |
| 12124 | |
| 12125 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12126 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12127 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12128 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12129 | alc267_quanta_il1_verbs }, |
| 12130 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12131 | .dac_nids = alc268_dac_nids, |
| 12132 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12133 | .adc_nids = alc268_adc_nids_alt, |
| 12134 | .hp_nid = 0x03, |
| 12135 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12136 | .channel_mode = alc268_modes, |
| 12137 | .input_mux = &alc268_capture_source, |
| 12138 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 12139 | .init_hook = alc267_quanta_il1_automute, |
| 12140 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12141 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12142 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12143 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12144 | .init_verbs = { alc268_base_init_verbs }, |
| 12145 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12146 | .dac_nids = alc268_dac_nids, |
| 12147 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12148 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12149 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12150 | .hp_nid = 0x03, |
| 12151 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12152 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12153 | .channel_mode = alc268_modes, |
| 12154 | .input_mux = &alc268_capture_source, |
| 12155 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12156 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12157 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12158 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12159 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12160 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12161 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12162 | .dac_nids = alc268_dac_nids, |
| 12163 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12164 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12165 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12166 | .hp_nid = 0x03, |
| 12167 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12168 | .channel_mode = alc268_modes, |
| 12169 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12170 | .unsol_event = alc268_toshiba_unsol_event, |
| 12171 | .init_hook = alc268_toshiba_automute, |
| 12172 | }, |
| 12173 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12174 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12175 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12176 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12177 | alc268_acer_verbs }, |
| 12178 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12179 | .dac_nids = alc268_dac_nids, |
| 12180 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12181 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12182 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12183 | .hp_nid = 0x02, |
| 12184 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12185 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12186 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12187 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12188 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12189 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12190 | [ALC268_ACER_DMIC] = { |
| 12191 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12192 | alc268_beep_mixer }, |
| 12193 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12194 | alc268_acer_verbs }, |
| 12195 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12196 | .dac_nids = alc268_dac_nids, |
| 12197 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12198 | .adc_nids = alc268_adc_nids_alt, |
| 12199 | .capsrc_nids = alc268_capsrc_nids, |
| 12200 | .hp_nid = 0x02, |
| 12201 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12202 | .channel_mode = alc268_modes, |
| 12203 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12204 | .unsol_event = alc268_acer_unsol_event, |
| 12205 | .init_hook = alc268_acer_init_hook, |
| 12206 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12207 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12208 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12209 | alc268_beep_mixer, |
| 12210 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12211 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12212 | alc268_acer_aspire_one_verbs }, |
| 12213 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12214 | .dac_nids = alc268_dac_nids, |
| 12215 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12216 | .adc_nids = alc268_adc_nids_alt, |
| 12217 | .capsrc_nids = alc268_capsrc_nids, |
| 12218 | .hp_nid = 0x03, |
| 12219 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12220 | .channel_mode = alc268_modes, |
| 12221 | .input_mux = &alc268_acer_lc_capture_source, |
| 12222 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12223 | .init_hook = alc268_acer_lc_init_hook, |
| 12224 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12225 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12226 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12227 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12228 | alc268_dell_verbs }, |
| 12229 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12230 | .dac_nids = alc268_dac_nids, |
| 12231 | .hp_nid = 0x02, |
| 12232 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12233 | .channel_mode = alc268_modes, |
| 12234 | .unsol_event = alc268_dell_unsol_event, |
| 12235 | .init_hook = alc268_dell_init_hook, |
| 12236 | .input_mux = &alc268_capture_source, |
| 12237 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12238 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12239 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12240 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12241 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12242 | alc268_toshiba_verbs }, |
| 12243 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12244 | .dac_nids = alc268_dac_nids, |
| 12245 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12246 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12247 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12248 | .hp_nid = 0x03, |
| 12249 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12250 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12251 | .channel_mode = alc268_modes, |
| 12252 | .input_mux = &alc268_capture_source, |
| 12253 | .unsol_event = alc268_toshiba_unsol_event, |
| 12254 | .init_hook = alc268_toshiba_automute |
| 12255 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12256 | #ifdef CONFIG_SND_DEBUG |
| 12257 | [ALC268_TEST] = { |
| 12258 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12259 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12260 | alc268_volume_init_verbs }, |
| 12261 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12262 | .dac_nids = alc268_dac_nids, |
| 12263 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12264 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12265 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12266 | .hp_nid = 0x03, |
| 12267 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12268 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12269 | .channel_mode = alc268_modes, |
| 12270 | .input_mux = &alc268_capture_source, |
| 12271 | }, |
| 12272 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12273 | }; |
| 12274 | |
| 12275 | static int patch_alc268(struct hda_codec *codec) |
| 12276 | { |
| 12277 | struct alc_spec *spec; |
| 12278 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12279 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12280 | |
| 12281 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12282 | if (spec == NULL) |
| 12283 | return -ENOMEM; |
| 12284 | |
| 12285 | codec->spec = spec; |
| 12286 | |
| 12287 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12288 | alc268_models, |
| 12289 | alc268_cfg_tbl); |
| 12290 | |
| 12291 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 12292 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 12293 | "trying auto-probe from BIOS...\n"); |
| 12294 | board_config = ALC268_AUTO; |
| 12295 | } |
| 12296 | |
| 12297 | if (board_config == ALC268_AUTO) { |
| 12298 | /* automatic parse from the BIOS config */ |
| 12299 | err = alc268_parse_auto_config(codec); |
| 12300 | if (err < 0) { |
| 12301 | alc_free(codec); |
| 12302 | return err; |
| 12303 | } else if (!err) { |
| 12304 | printk(KERN_INFO |
| 12305 | "hda_codec: Cannot set up configuration " |
| 12306 | "from BIOS. Using base mode...\n"); |
| 12307 | board_config = ALC268_3ST; |
| 12308 | } |
| 12309 | } |
| 12310 | |
| 12311 | if (board_config != ALC268_AUTO) |
| 12312 | setup_preset(spec, &alc268_presets[board_config]); |
| 12313 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 12314 | if (codec->vendor_id == 0x10ec0267) { |
| 12315 | spec->stream_name_analog = "ALC267 Analog"; |
| 12316 | spec->stream_name_digital = "ALC267 Digital"; |
| 12317 | } else { |
| 12318 | spec->stream_name_analog = "ALC268 Analog"; |
| 12319 | spec->stream_name_digital = "ALC268 Digital"; |
| 12320 | } |
| 12321 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12322 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12323 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12324 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12325 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12326 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12327 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12328 | has_beep = 0; |
| 12329 | for (i = 0; i < spec->num_mixers; i++) { |
| 12330 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12331 | has_beep = 1; |
| 12332 | break; |
| 12333 | } |
| 12334 | } |
| 12335 | |
| 12336 | if (has_beep) { |
| 12337 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12338 | if (err < 0) { |
| 12339 | alc_free(codec); |
| 12340 | return err; |
| 12341 | } |
| 12342 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12343 | /* override the amp caps for beep generator */ |
| 12344 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12345 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12346 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12347 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12348 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12349 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12350 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12351 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12352 | /* check whether NID 0x07 is valid */ |
| 12353 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12354 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12355 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12356 | /* get type */ |
| 12357 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12358 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12359 | spec->adc_nids = alc268_adc_nids_alt; |
| 12360 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12361 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12362 | } else { |
| 12363 | spec->adc_nids = alc268_adc_nids; |
| 12364 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12365 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12366 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12367 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12368 | /* set default input source */ |
| 12369 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12370 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12371 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12372 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12373 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12374 | |
| 12375 | spec->vmaster_nid = 0x02; |
| 12376 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12377 | codec->patch_ops = alc_patch_ops; |
| 12378 | if (board_config == ALC268_AUTO) |
| 12379 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12380 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12381 | codec->proc_widget_hook = print_realtek_coef; |
| 12382 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12383 | return 0; |
| 12384 | } |
| 12385 | |
| 12386 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12387 | * ALC269 channel source setting (2 channel) |
| 12388 | */ |
| 12389 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12390 | |
| 12391 | #define alc269_dac_nids alc260_dac_nids |
| 12392 | |
| 12393 | static hda_nid_t alc269_adc_nids[1] = { |
| 12394 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12395 | 0x08, |
| 12396 | }; |
| 12397 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12398 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12399 | 0x23, |
| 12400 | }; |
| 12401 | |
| 12402 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12403 | * not a mux! |
| 12404 | */ |
| 12405 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12406 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12407 | .num_items = 2, |
| 12408 | .items = { |
| 12409 | { "i-Mic", 0x5 }, |
| 12410 | { "e-Mic", 0x0 }, |
| 12411 | }, |
| 12412 | }; |
| 12413 | |
| 12414 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12415 | .num_items = 2, |
| 12416 | .items = { |
| 12417 | { "i-Mic", 0x1 }, |
| 12418 | { "e-Mic", 0x0 }, |
| 12419 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12420 | }; |
| 12421 | |
| 12422 | #define alc269_modes alc260_modes |
| 12423 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12424 | |
| 12425 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12426 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12427 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12428 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12429 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12431 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12432 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12433 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12434 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12435 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12436 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12437 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12438 | { } /* end */ |
| 12439 | }; |
| 12440 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12441 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12442 | /* output mixer control */ |
| 12443 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12444 | { |
| 12445 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12446 | .name = "Master Playback Switch", |
| 12447 | .info = snd_hda_mixer_amp_switch_info, |
| 12448 | .get = snd_hda_mixer_amp_switch_get, |
| 12449 | .put = alc268_acer_master_sw_put, |
| 12450 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12451 | }, |
| 12452 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12453 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12454 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12455 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12456 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12457 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12458 | { } |
| 12459 | }; |
| 12460 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12461 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12462 | /* output mixer control */ |
| 12463 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12464 | { |
| 12465 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12466 | .name = "Master Playback Switch", |
| 12467 | .info = snd_hda_mixer_amp_switch_info, |
| 12468 | .get = snd_hda_mixer_amp_switch_get, |
| 12469 | .put = alc268_acer_master_sw_put, |
| 12470 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12471 | }, |
| 12472 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12473 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12474 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12475 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12476 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12477 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12478 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12479 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12480 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12481 | { } |
| 12482 | }; |
| 12483 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12484 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12485 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12486 | .ops = &snd_hda_bind_vol, |
| 12487 | .values = { |
| 12488 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12489 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12490 | 0 |
| 12491 | }, |
| 12492 | }; |
| 12493 | |
| 12494 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12495 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12496 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12497 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12498 | { } /* end */ |
| 12499 | }; |
| 12500 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12501 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12502 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12503 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12504 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12505 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12506 | { } /* end */ |
| 12507 | }; |
| 12508 | |
| 12509 | /* FSC amilo */ |
| 12510 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12511 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12512 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12513 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12514 | { } /* end */ |
| 12515 | }; |
| 12516 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12517 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12518 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12519 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12520 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12521 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12522 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12523 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12524 | { } |
| 12525 | }; |
| 12526 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12527 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12528 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12529 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12530 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12531 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12532 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12533 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12534 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12535 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12536 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12537 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12538 | { } |
| 12539 | }; |
| 12540 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12541 | /* toggle speaker-output according to the hp-jack state */ |
| 12542 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12543 | { |
| 12544 | unsigned int present; |
| 12545 | unsigned char bits; |
| 12546 | |
| 12547 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12548 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12549 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12550 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12551 | AMP_IN_MUTE(0), bits); |
| 12552 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12553 | AMP_IN_MUTE(0), bits); |
| 12554 | |
| 12555 | snd_hda_codec_write(codec, 0x20, 0, |
| 12556 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12557 | snd_hda_codec_write(codec, 0x20, 0, |
| 12558 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12559 | |
| 12560 | snd_hda_codec_write(codec, 0x20, 0, |
| 12561 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12562 | snd_hda_codec_write(codec, 0x20, 0, |
| 12563 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12564 | } |
| 12565 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12566 | /* toggle speaker-output according to the hp-jacks state */ |
| 12567 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12568 | { |
| 12569 | unsigned int present; |
| 12570 | unsigned char bits; |
| 12571 | |
| 12572 | /* Check laptop headphone socket */ |
| 12573 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12574 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12575 | |
| 12576 | /* Check port replicator headphone socket */ |
| 12577 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12578 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12579 | |
| 12580 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12581 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12582 | AMP_IN_MUTE(0), bits); |
| 12583 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12584 | AMP_IN_MUTE(0), bits); |
| 12585 | |
| 12586 | snd_hda_codec_write(codec, 0x20, 0, |
| 12587 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12588 | snd_hda_codec_write(codec, 0x20, 0, |
| 12589 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12590 | |
| 12591 | snd_hda_codec_write(codec, 0x20, 0, |
| 12592 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12593 | snd_hda_codec_write(codec, 0x20, 0, |
| 12594 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12595 | } |
| 12596 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12597 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12598 | { |
| 12599 | unsigned int present; |
| 12600 | |
| 12601 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12602 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12603 | snd_hda_codec_write(codec, 0x23, 0, |
| 12604 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12605 | } |
| 12606 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12607 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12608 | { |
| 12609 | unsigned int present_laptop; |
| 12610 | unsigned int present_dock; |
| 12611 | |
| 12612 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12613 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12614 | |
| 12615 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12616 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12617 | |
| 12618 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12619 | if (present_dock) |
| 12620 | snd_hda_codec_write(codec, 0x23, 0, |
| 12621 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12622 | if (present_laptop) |
| 12623 | snd_hda_codec_write(codec, 0x23, 0, |
| 12624 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12625 | if (!present_dock && !present_laptop) |
| 12626 | snd_hda_codec_write(codec, 0x23, 0, |
| 12627 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12628 | } |
| 12629 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12630 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12631 | unsigned int res) |
| 12632 | { |
| 12633 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12634 | alc269_quanta_fl1_speaker_automute(codec); |
| 12635 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12636 | alc269_quanta_fl1_mic_automute(codec); |
| 12637 | } |
| 12638 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12639 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12640 | unsigned int res) |
| 12641 | { |
| 12642 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12643 | alc269_lifebook_speaker_automute(codec); |
| 12644 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12645 | alc269_lifebook_mic_autoswitch(codec); |
| 12646 | } |
| 12647 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12648 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12649 | { |
| 12650 | alc269_quanta_fl1_speaker_automute(codec); |
| 12651 | alc269_quanta_fl1_mic_automute(codec); |
| 12652 | } |
| 12653 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12654 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12655 | { |
| 12656 | alc269_lifebook_speaker_automute(codec); |
| 12657 | alc269_lifebook_mic_autoswitch(codec); |
| 12658 | } |
| 12659 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12660 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12661 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12662 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12663 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12664 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12665 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12666 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12667 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12668 | {} |
| 12669 | }; |
| 12670 | |
| 12671 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12672 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12673 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12674 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12675 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12676 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12677 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12678 | {} |
| 12679 | }; |
| 12680 | |
| 12681 | /* toggle speaker-output according to the hp-jack state */ |
| 12682 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12683 | { |
| 12684 | unsigned int present; |
| 12685 | unsigned char bits; |
| 12686 | |
| 12687 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12688 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12689 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12690 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12691 | AMP_IN_MUTE(0), bits); |
| 12692 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12693 | AMP_IN_MUTE(0), bits); |
| 12694 | } |
| 12695 | |
| 12696 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12697 | { |
| 12698 | unsigned int present; |
| 12699 | |
| 12700 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12701 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12702 | snd_hda_codec_write(codec, 0x23, 0, |
| 12703 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12704 | } |
| 12705 | |
| 12706 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12707 | { |
| 12708 | unsigned int present; |
| 12709 | |
| 12710 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12711 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12712 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12713 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12714 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12715 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12716 | } |
| 12717 | |
| 12718 | /* unsolicited event for HP jack sensing */ |
| 12719 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12720 | unsigned int res) |
| 12721 | { |
| 12722 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12723 | alc269_speaker_automute(codec); |
| 12724 | |
| 12725 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12726 | alc269_eeepc_dmic_automute(codec); |
| 12727 | } |
| 12728 | |
| 12729 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12730 | { |
| 12731 | alc269_speaker_automute(codec); |
| 12732 | alc269_eeepc_dmic_automute(codec); |
| 12733 | } |
| 12734 | |
| 12735 | /* unsolicited event for HP jack sensing */ |
| 12736 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12737 | unsigned int res) |
| 12738 | { |
| 12739 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12740 | alc269_speaker_automute(codec); |
| 12741 | |
| 12742 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12743 | alc269_eeepc_amic_automute(codec); |
| 12744 | } |
| 12745 | |
| 12746 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12747 | { |
| 12748 | alc269_speaker_automute(codec); |
| 12749 | alc269_eeepc_amic_automute(codec); |
| 12750 | } |
| 12751 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12752 | /* |
| 12753 | * generic initialization of ADC, input mixers and output mixers |
| 12754 | */ |
| 12755 | static struct hda_verb alc269_init_verbs[] = { |
| 12756 | /* |
| 12757 | * Unmute ADC0 and set the default input to mic-in |
| 12758 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12759 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12760 | |
| 12761 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12762 | * analog-loopback mixer widget |
| 12763 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12764 | * front panel mic (mic 2) |
| 12765 | */ |
| 12766 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12767 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12768 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12769 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12770 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12771 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12772 | |
| 12773 | /* |
| 12774 | * Set up output mixers (0x0c - 0x0e) |
| 12775 | */ |
| 12776 | /* set vol=0 to output mixers */ |
| 12777 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12778 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12779 | |
| 12780 | /* set up input amps for analog loopback */ |
| 12781 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12782 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12783 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12784 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12785 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12786 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12787 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12788 | |
| 12789 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12790 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12791 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12792 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12793 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12794 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12795 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12796 | |
| 12797 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12798 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12799 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12800 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12801 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12802 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12803 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12804 | |
| 12805 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12806 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12807 | |
| 12808 | /* FIXME: use matrix-type input source selection */ |
| 12809 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12810 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12811 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12812 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12813 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12814 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12815 | |
| 12816 | /* set EAPD */ |
| 12817 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12818 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12819 | { } |
| 12820 | }; |
| 12821 | |
| 12822 | /* add playback controls from the parsed DAC table */ |
| 12823 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12824 | const struct auto_pin_cfg *cfg) |
| 12825 | { |
| 12826 | hda_nid_t nid; |
| 12827 | int err; |
| 12828 | |
| 12829 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12830 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12831 | spec->multiout.dac_nids[0] = 2; |
| 12832 | |
| 12833 | nid = cfg->line_out_pins[0]; |
| 12834 | if (nid) { |
| 12835 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12836 | "Front Playback Volume", |
| 12837 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12838 | if (err < 0) |
| 12839 | return err; |
| 12840 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12841 | "Front Playback Switch", |
| 12842 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12843 | if (err < 0) |
| 12844 | return err; |
| 12845 | } |
| 12846 | |
| 12847 | nid = cfg->speaker_pins[0]; |
| 12848 | if (nid) { |
| 12849 | if (!cfg->line_out_pins[0]) { |
| 12850 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12851 | "Speaker Playback Volume", |
| 12852 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12853 | HDA_OUTPUT)); |
| 12854 | if (err < 0) |
| 12855 | return err; |
| 12856 | } |
| 12857 | if (nid == 0x16) { |
| 12858 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12859 | "Speaker Playback Switch", |
| 12860 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12861 | HDA_OUTPUT)); |
| 12862 | if (err < 0) |
| 12863 | return err; |
| 12864 | } else { |
| 12865 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12866 | "Speaker Playback Switch", |
| 12867 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12868 | HDA_OUTPUT)); |
| 12869 | if (err < 0) |
| 12870 | return err; |
| 12871 | } |
| 12872 | } |
| 12873 | nid = cfg->hp_pins[0]; |
| 12874 | if (nid) { |
| 12875 | /* spec->multiout.hp_nid = 2; */ |
| 12876 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12877 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12878 | "Headphone Playback Volume", |
| 12879 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12880 | HDA_OUTPUT)); |
| 12881 | if (err < 0) |
| 12882 | return err; |
| 12883 | } |
| 12884 | if (nid == 0x16) { |
| 12885 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12886 | "Headphone Playback Switch", |
| 12887 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12888 | HDA_OUTPUT)); |
| 12889 | if (err < 0) |
| 12890 | return err; |
| 12891 | } else { |
| 12892 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12893 | "Headphone Playback Switch", |
| 12894 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12895 | HDA_OUTPUT)); |
| 12896 | if (err < 0) |
| 12897 | return err; |
| 12898 | } |
| 12899 | } |
| 12900 | return 0; |
| 12901 | } |
| 12902 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12903 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12904 | const struct auto_pin_cfg *cfg) |
| 12905 | { |
| 12906 | int err; |
| 12907 | |
| 12908 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 12909 | if (err < 0) |
| 12910 | return err; |
| 12911 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 12912 | * because it's under 0x18 |
| 12913 | */ |
| 12914 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 12915 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12916 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12917 | imux->items[imux->num_items].label = "Int Mic"; |
| 12918 | imux->items[imux->num_items].index = 0x05; |
| 12919 | imux->num_items++; |
| 12920 | } |
| 12921 | return 0; |
| 12922 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12923 | |
| 12924 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12925 | #define alc269_loopbacks alc880_loopbacks |
| 12926 | #endif |
| 12927 | |
| 12928 | /* pcm configuration: identiacal with ALC880 */ |
| 12929 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12930 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12931 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12932 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12933 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 12934 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 12935 | .substreams = 1, |
| 12936 | .channels_min = 2, |
| 12937 | .channels_max = 8, |
| 12938 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 12939 | /* NID is set in alc_build_pcms */ |
| 12940 | .ops = { |
| 12941 | .open = alc880_playback_pcm_open, |
| 12942 | .prepare = alc880_playback_pcm_prepare, |
| 12943 | .cleanup = alc880_playback_pcm_cleanup |
| 12944 | }, |
| 12945 | }; |
| 12946 | |
| 12947 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 12948 | .substreams = 1, |
| 12949 | .channels_min = 2, |
| 12950 | .channels_max = 2, |
| 12951 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 12952 | /* NID is set in alc_build_pcms */ |
| 12953 | }; |
| 12954 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12955 | /* |
| 12956 | * BIOS auto configuration |
| 12957 | */ |
| 12958 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12959 | { |
| 12960 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 12961 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12962 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12963 | |
| 12964 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12965 | alc269_ignore); |
| 12966 | if (err < 0) |
| 12967 | return err; |
| 12968 | |
| 12969 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12970 | if (err < 0) |
| 12971 | return err; |
| 12972 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12973 | if (err < 0) |
| 12974 | return err; |
| 12975 | |
| 12976 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12977 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12978 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12979 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12980 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12981 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12982 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12983 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12984 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12985 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12986 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12987 | /* set default input source */ |
| 12988 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12989 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12990 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12991 | |
| 12992 | err = alc_auto_add_mic_boost(codec); |
| 12993 | if (err < 0) |
| 12994 | return err; |
| 12995 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12996 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12997 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12998 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12999 | return 1; |
| 13000 | } |
| 13001 | |
| 13002 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 13003 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 13004 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13005 | |
| 13006 | |
| 13007 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13008 | static void alc269_auto_init(struct hda_codec *codec) |
| 13009 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13010 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13011 | alc269_auto_init_multi_out(codec); |
| 13012 | alc269_auto_init_hp_out(codec); |
| 13013 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13014 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13015 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13016 | } |
| 13017 | |
| 13018 | /* |
| 13019 | * configuration and preset |
| 13020 | */ |
| 13021 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13022 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13023 | [ALC269_QUANTA_FL1] = "quanta", |
| 13024 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13025 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13026 | [ALC269_FUJITSU] = "fujitsu", |
| 13027 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13028 | }; |
| 13029 | |
| 13030 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13031 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13032 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13033 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13034 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13035 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13036 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13037 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13038 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13039 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13040 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13041 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13042 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13043 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13044 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13045 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13046 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13047 | {} |
| 13048 | }; |
| 13049 | |
| 13050 | static struct alc_config_preset alc269_presets[] = { |
| 13051 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13052 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13053 | .init_verbs = { alc269_init_verbs }, |
| 13054 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13055 | .dac_nids = alc269_dac_nids, |
| 13056 | .hp_nid = 0x03, |
| 13057 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13058 | .channel_mode = alc269_modes, |
| 13059 | .input_mux = &alc269_capture_source, |
| 13060 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13061 | [ALC269_QUANTA_FL1] = { |
| 13062 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13063 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13064 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13065 | .dac_nids = alc269_dac_nids, |
| 13066 | .hp_nid = 0x03, |
| 13067 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13068 | .channel_mode = alc269_modes, |
| 13069 | .input_mux = &alc269_capture_source, |
| 13070 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 13071 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13072 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13073 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13074 | .mixers = { alc269_eeepc_mixer }, |
| 13075 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13076 | .init_verbs = { alc269_init_verbs, |
| 13077 | alc269_eeepc_amic_init_verbs }, |
| 13078 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13079 | .dac_nids = alc269_dac_nids, |
| 13080 | .hp_nid = 0x03, |
| 13081 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13082 | .channel_mode = alc269_modes, |
| 13083 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 13084 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 13085 | .init_hook = alc269_eeepc_amic_inithook, |
| 13086 | }, |
| 13087 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13088 | .mixers = { alc269_eeepc_mixer }, |
| 13089 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13090 | .init_verbs = { alc269_init_verbs, |
| 13091 | alc269_eeepc_dmic_init_verbs }, |
| 13092 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13093 | .dac_nids = alc269_dac_nids, |
| 13094 | .hp_nid = 0x03, |
| 13095 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13096 | .channel_mode = alc269_modes, |
| 13097 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13098 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13099 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13100 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13101 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13102 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13103 | .cap_mixer = alc269_epc_capture_mixer, |
| 13104 | .init_verbs = { alc269_init_verbs, |
| 13105 | alc269_eeepc_dmic_init_verbs }, |
| 13106 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13107 | .dac_nids = alc269_dac_nids, |
| 13108 | .hp_nid = 0x03, |
| 13109 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13110 | .channel_mode = alc269_modes, |
| 13111 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13112 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13113 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13114 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13115 | [ALC269_LIFEBOOK] = { |
| 13116 | .mixers = { alc269_lifebook_mixer }, |
| 13117 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13118 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13119 | .dac_nids = alc269_dac_nids, |
| 13120 | .hp_nid = 0x03, |
| 13121 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13122 | .channel_mode = alc269_modes, |
| 13123 | .input_mux = &alc269_capture_source, |
| 13124 | .unsol_event = alc269_lifebook_unsol_event, |
| 13125 | .init_hook = alc269_lifebook_init_hook, |
| 13126 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13127 | }; |
| 13128 | |
| 13129 | static int patch_alc269(struct hda_codec *codec) |
| 13130 | { |
| 13131 | struct alc_spec *spec; |
| 13132 | int board_config; |
| 13133 | int err; |
| 13134 | |
| 13135 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13136 | if (spec == NULL) |
| 13137 | return -ENOMEM; |
| 13138 | |
| 13139 | codec->spec = spec; |
| 13140 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13141 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13142 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13143 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13144 | alc269_models, |
| 13145 | alc269_cfg_tbl); |
| 13146 | |
| 13147 | if (board_config < 0) { |
| 13148 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 13149 | "trying auto-probe from BIOS...\n"); |
| 13150 | board_config = ALC269_AUTO; |
| 13151 | } |
| 13152 | |
| 13153 | if (board_config == ALC269_AUTO) { |
| 13154 | /* automatic parse from the BIOS config */ |
| 13155 | err = alc269_parse_auto_config(codec); |
| 13156 | if (err < 0) { |
| 13157 | alc_free(codec); |
| 13158 | return err; |
| 13159 | } else if (!err) { |
| 13160 | printk(KERN_INFO |
| 13161 | "hda_codec: Cannot set up configuration " |
| 13162 | "from BIOS. Using base mode...\n"); |
| 13163 | board_config = ALC269_BASIC; |
| 13164 | } |
| 13165 | } |
| 13166 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13167 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13168 | if (err < 0) { |
| 13169 | alc_free(codec); |
| 13170 | return err; |
| 13171 | } |
| 13172 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13173 | if (board_config != ALC269_AUTO) |
| 13174 | setup_preset(spec, &alc269_presets[board_config]); |
| 13175 | |
| 13176 | spec->stream_name_analog = "ALC269 Analog"; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13177 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13178 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13179 | * fix the sample rate of analog I/O to 44.1kHz |
| 13180 | */ |
| 13181 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13182 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13183 | } else { |
| 13184 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13185 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13186 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13187 | spec->stream_name_digital = "ALC269 Digital"; |
| 13188 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13189 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13190 | |
| 13191 | spec->adc_nids = alc269_adc_nids; |
| 13192 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13193 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13194 | if (!spec->cap_mixer) |
| 13195 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13196 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13197 | |
| 13198 | codec->patch_ops = alc_patch_ops; |
| 13199 | if (board_config == ALC269_AUTO) |
| 13200 | spec->init_hook = alc269_auto_init; |
| 13201 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13202 | if (!spec->loopback.amplist) |
| 13203 | spec->loopback.amplist = alc269_loopbacks; |
| 13204 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13205 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13206 | |
| 13207 | return 0; |
| 13208 | } |
| 13209 | |
| 13210 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13211 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13212 | */ |
| 13213 | |
| 13214 | /* |
| 13215 | * set the path ways for 2 channel output |
| 13216 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13217 | */ |
| 13218 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13219 | /* set pin widget 1Ah (line in) for input */ |
| 13220 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13221 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13222 | * the vref |
| 13223 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13224 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13225 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13226 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13227 | #if 0 |
| 13228 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13229 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13230 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13231 | { } /* end */ |
| 13232 | }; |
| 13233 | /* |
| 13234 | * 6ch mode |
| 13235 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13236 | */ |
| 13237 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13238 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13239 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13240 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13241 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13242 | |
| 13243 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13244 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13245 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13246 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13247 | #if 0 |
| 13248 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13249 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13250 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13251 | { } /* end */ |
| 13252 | }; |
| 13253 | |
| 13254 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13255 | { 2, alc861_threestack_ch2_init }, |
| 13256 | { 6, alc861_threestack_ch6_init }, |
| 13257 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13258 | /* Set mic1 as input and unmute the mixer */ |
| 13259 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13260 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13261 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13262 | { } /* end */ |
| 13263 | }; |
| 13264 | /* Set mic1 as output and mute mixer */ |
| 13265 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13266 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13267 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13268 | { } /* end */ |
| 13269 | }; |
| 13270 | |
| 13271 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13272 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13273 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13274 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13275 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13276 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13277 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13278 | /* set pin widget 1Ah (line in) for input */ |
| 13279 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13280 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13281 | * the vref |
| 13282 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13283 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13284 | |
| 13285 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13286 | #if 0 |
| 13287 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13288 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13289 | #endif |
| 13290 | { } /* end */ |
| 13291 | }; |
| 13292 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13293 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13294 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13295 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13296 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13297 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13298 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13299 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13300 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13301 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13302 | |
| 13303 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13304 | #if 0 |
| 13305 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13306 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13307 | #endif |
| 13308 | { } /* end */ |
| 13309 | }; |
| 13310 | |
| 13311 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13312 | { 2, alc861_asus_ch2_init }, |
| 13313 | { 6, alc861_asus_ch6_init }, |
| 13314 | }; |
| 13315 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13316 | /* patch-ALC861 */ |
| 13317 | |
| 13318 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13319 | /* output mixer control */ |
| 13320 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13321 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13322 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13323 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13324 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13325 | |
| 13326 | /*Input mixer control */ |
| 13327 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13328 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13329 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13330 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13331 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13332 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13333 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13334 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13335 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13336 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13337 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13338 | { } /* end */ |
| 13339 | }; |
| 13340 | |
| 13341 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13342 | /* output mixer control */ |
| 13343 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13344 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13345 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13346 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13347 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13348 | |
| 13349 | /* Input mixer control */ |
| 13350 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13351 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13352 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13353 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13354 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13355 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13356 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13357 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13358 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13359 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13360 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13361 | { |
| 13362 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13363 | .name = "Channel Mode", |
| 13364 | .info = alc_ch_mode_info, |
| 13365 | .get = alc_ch_mode_get, |
| 13366 | .put = alc_ch_mode_put, |
| 13367 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13368 | }, |
| 13369 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13370 | }; |
| 13371 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13372 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13373 | /* output mixer control */ |
| 13374 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13375 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13376 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13377 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13378 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13379 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13380 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13381 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13382 | /* output mixer control */ |
| 13383 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13384 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13385 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13386 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13387 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13388 | |
| 13389 | /* Input mixer control */ |
| 13390 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13391 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13392 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13393 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13394 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13395 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13396 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13397 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13398 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13399 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13400 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13401 | { |
| 13402 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13403 | .name = "Channel Mode", |
| 13404 | .info = alc_ch_mode_info, |
| 13405 | .get = alc_ch_mode_get, |
| 13406 | .put = alc_ch_mode_put, |
| 13407 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13408 | }, |
| 13409 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13410 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13411 | |
| 13412 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13413 | /* output mixer control */ |
| 13414 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13415 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13416 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13417 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13418 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13419 | |
| 13420 | /* Input mixer control */ |
| 13421 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13422 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13423 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13424 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13425 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13426 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13427 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13428 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13429 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13430 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13431 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13432 | { |
| 13433 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13434 | .name = "Channel Mode", |
| 13435 | .info = alc_ch_mode_info, |
| 13436 | .get = alc_ch_mode_get, |
| 13437 | .put = alc_ch_mode_put, |
| 13438 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13439 | }, |
| 13440 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13441 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13442 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13443 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13444 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13445 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13446 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13447 | { } |
| 13448 | }; |
| 13449 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13450 | /* |
| 13451 | * generic initialization of ADC, input mixers and output mixers |
| 13452 | */ |
| 13453 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13454 | /* |
| 13455 | * Unmute ADC0 and set the default input to mic-in |
| 13456 | */ |
| 13457 | /* port-A for surround (rear panel) */ |
| 13458 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13459 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13460 | /* port-B for mic-in (rear panel) with vref */ |
| 13461 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13462 | /* port-C for line-in (rear panel) */ |
| 13463 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13464 | /* port-D for Front */ |
| 13465 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13466 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13467 | /* port-E for HP out (front panel) */ |
| 13468 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13469 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13470 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13471 | /* port-F for mic-in (front panel) with vref */ |
| 13472 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13473 | /* port-G for CLFE (rear panel) */ |
| 13474 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13475 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13476 | /* port-H for side (rear panel) */ |
| 13477 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13478 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13479 | /* CD-in */ |
| 13480 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13481 | /* route front mic to ADC1*/ |
| 13482 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13483 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13484 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13485 | /* Unmute DAC0~3 & spdif out*/ |
| 13486 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13487 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13488 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13489 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13490 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13491 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13492 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13493 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13494 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13495 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13496 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13497 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13498 | /* Unmute Stereo Mixer 15 */ |
| 13499 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13500 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13501 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13502 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13503 | |
| 13504 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13505 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13506 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13507 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13508 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13509 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13510 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13511 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13512 | /* hp used DAC 3 (Front) */ |
| 13513 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13514 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13515 | |
| 13516 | { } |
| 13517 | }; |
| 13518 | |
| 13519 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13520 | /* |
| 13521 | * Unmute ADC0 and set the default input to mic-in |
| 13522 | */ |
| 13523 | /* port-A for surround (rear panel) */ |
| 13524 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13525 | /* port-B for mic-in (rear panel) with vref */ |
| 13526 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13527 | /* port-C for line-in (rear panel) */ |
| 13528 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13529 | /* port-D for Front */ |
| 13530 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13531 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13532 | /* port-E for HP out (front panel) */ |
| 13533 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13534 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13535 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13536 | /* port-F for mic-in (front panel) with vref */ |
| 13537 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13538 | /* port-G for CLFE (rear panel) */ |
| 13539 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13540 | /* port-H for side (rear panel) */ |
| 13541 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13542 | /* CD-in */ |
| 13543 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13544 | /* route front mic to ADC1*/ |
| 13545 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13546 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13547 | /* Unmute DAC0~3 & spdif out*/ |
| 13548 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13549 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13550 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13551 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13552 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13553 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13554 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13555 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13556 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13557 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13558 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13559 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13560 | /* Unmute Stereo Mixer 15 */ |
| 13561 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13562 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13563 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13564 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13565 | |
| 13566 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13567 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13568 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13569 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13570 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13571 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13572 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13573 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13574 | /* hp used DAC 3 (Front) */ |
| 13575 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13576 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13577 | { } |
| 13578 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13579 | |
| 13580 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13581 | /* |
| 13582 | * Unmute ADC0 and set the default input to mic-in |
| 13583 | */ |
| 13584 | /* port-A for surround (rear panel) */ |
| 13585 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13586 | /* port-B for mic-in (rear panel) with vref */ |
| 13587 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13588 | /* port-C for line-in (rear panel) */ |
| 13589 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13590 | /* port-D for Front */ |
| 13591 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13592 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13593 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13594 | /* this has to be set to VREF80 */ |
| 13595 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13596 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13597 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13598 | /* port-F for mic-in (front panel) with vref */ |
| 13599 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13600 | /* port-G for CLFE (rear panel) */ |
| 13601 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13602 | /* port-H for side (rear panel) */ |
| 13603 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13604 | /* CD-in */ |
| 13605 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13606 | /* route front mic to ADC1*/ |
| 13607 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13608 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13609 | /* Unmute DAC0~3 & spdif out*/ |
| 13610 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13611 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13612 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13613 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13614 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13615 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13616 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13617 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13618 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13619 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13620 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13621 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13622 | /* Unmute Stereo Mixer 15 */ |
| 13623 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13624 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13625 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13626 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13627 | |
| 13628 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13629 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13630 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13631 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13632 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13633 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13634 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13635 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13636 | /* hp used DAC 3 (Front) */ |
| 13637 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13638 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13639 | { } |
| 13640 | }; |
| 13641 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13642 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13643 | /* |
| 13644 | * Unmute ADC0 and set the default input to mic-in |
| 13645 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13646 | /* port-A for surround (rear panel) |
| 13647 | * according to codec#0 this is the HP jack |
| 13648 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13649 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13650 | /* route front PCM to HP */ |
| 13651 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13652 | /* port-B for mic-in (rear panel) with vref */ |
| 13653 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13654 | /* port-C for line-in (rear panel) */ |
| 13655 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13656 | /* port-D for Front */ |
| 13657 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13658 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13659 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13660 | /* this has to be set to VREF80 */ |
| 13661 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13662 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13663 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13664 | /* port-F for mic-in (front panel) with vref */ |
| 13665 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13666 | /* port-G for CLFE (rear panel) */ |
| 13667 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13668 | /* port-H for side (rear panel) */ |
| 13669 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13670 | /* CD-in */ |
| 13671 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13672 | /* route front mic to ADC1*/ |
| 13673 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13674 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13675 | /* Unmute DAC0~3 & spdif out*/ |
| 13676 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13677 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13678 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13679 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13680 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13681 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13682 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13683 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13684 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13685 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13686 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13687 | /* Unmute Stereo Mixer 15 */ |
| 13688 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13689 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13690 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13691 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13692 | |
| 13693 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13694 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13695 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13696 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13697 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13698 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13699 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13700 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13701 | /* hp used DAC 3 (Front) */ |
| 13702 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13703 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13704 | { } |
| 13705 | }; |
| 13706 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13707 | /* additional init verbs for ASUS laptops */ |
| 13708 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13709 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13710 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13711 | { } |
| 13712 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13713 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13714 | /* |
| 13715 | * generic initialization of ADC, input mixers and output mixers |
| 13716 | */ |
| 13717 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13718 | /* |
| 13719 | * Unmute ADC0 and set the default input to mic-in |
| 13720 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13721 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13722 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13723 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13724 | /* Unmute DAC0~3 & spdif out*/ |
| 13725 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13726 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13727 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13728 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13729 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13730 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13731 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13732 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13733 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13734 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13735 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13736 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13737 | /* Unmute Stereo Mixer 15 */ |
| 13738 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13739 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13740 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13742 | |
| 13743 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13744 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13745 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13746 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13747 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13748 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13749 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13750 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13751 | |
| 13752 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13753 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13754 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13755 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13756 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13757 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13758 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13759 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13760 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13761 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13762 | |
| 13763 | { } |
| 13764 | }; |
| 13765 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13766 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13767 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13768 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13769 | { } |
| 13770 | }; |
| 13771 | |
| 13772 | /* toggle speaker-output according to the hp-jack state */ |
| 13773 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13774 | { |
| 13775 | unsigned int present; |
| 13776 | |
| 13777 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13778 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13779 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13780 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13781 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13782 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13783 | } |
| 13784 | |
| 13785 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13786 | unsigned int res) |
| 13787 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13788 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13789 | alc861_toshiba_automute(codec); |
| 13790 | } |
| 13791 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13792 | /* pcm configuration: identiacal with ALC880 */ |
| 13793 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13794 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13795 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13796 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13797 | |
| 13798 | |
| 13799 | #define ALC861_DIGOUT_NID 0x07 |
| 13800 | |
| 13801 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13802 | { 8, NULL } |
| 13803 | }; |
| 13804 | |
| 13805 | static hda_nid_t alc861_dac_nids[4] = { |
| 13806 | /* front, surround, clfe, side */ |
| 13807 | 0x03, 0x06, 0x05, 0x04 |
| 13808 | }; |
| 13809 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13810 | static hda_nid_t alc660_dac_nids[3] = { |
| 13811 | /* front, clfe, surround */ |
| 13812 | 0x03, 0x05, 0x06 |
| 13813 | }; |
| 13814 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13815 | static hda_nid_t alc861_adc_nids[1] = { |
| 13816 | /* ADC0-2 */ |
| 13817 | 0x08, |
| 13818 | }; |
| 13819 | |
| 13820 | static struct hda_input_mux alc861_capture_source = { |
| 13821 | .num_items = 5, |
| 13822 | .items = { |
| 13823 | { "Mic", 0x0 }, |
| 13824 | { "Front Mic", 0x3 }, |
| 13825 | { "Line", 0x1 }, |
| 13826 | { "CD", 0x4 }, |
| 13827 | { "Mixer", 0x5 }, |
| 13828 | }, |
| 13829 | }; |
| 13830 | |
| 13831 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13832 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13833 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13834 | { |
| 13835 | int i; |
| 13836 | hda_nid_t nid; |
| 13837 | |
| 13838 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13839 | for (i = 0; i < cfg->line_outs; i++) { |
| 13840 | nid = cfg->line_out_pins[i]; |
| 13841 | if (nid) { |
| 13842 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13843 | continue; |
| 13844 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13845 | } |
| 13846 | } |
| 13847 | spec->multiout.num_dacs = cfg->line_outs; |
| 13848 | return 0; |
| 13849 | } |
| 13850 | |
| 13851 | /* add playback controls from the parsed DAC table */ |
| 13852 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13853 | const struct auto_pin_cfg *cfg) |
| 13854 | { |
| 13855 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13856 | static const char *chname[4] = { |
| 13857 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13858 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13859 | hda_nid_t nid; |
| 13860 | int i, idx, err; |
| 13861 | |
| 13862 | for (i = 0; i < cfg->line_outs; i++) { |
| 13863 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13864 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13865 | continue; |
| 13866 | if (nid == 0x05) { |
| 13867 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13868 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13869 | "Center Playback Switch", |
| 13870 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13871 | HDA_OUTPUT)); |
| 13872 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13873 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13874 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13875 | "LFE Playback Switch", |
| 13876 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13877 | HDA_OUTPUT)); |
| 13878 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13879 | return err; |
| 13880 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13881 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13882 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13883 | if (nid == alc861_dac_nids[idx]) |
| 13884 | break; |
| 13885 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13886 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13887 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13888 | HDA_OUTPUT)); |
| 13889 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13890 | return err; |
| 13891 | } |
| 13892 | } |
| 13893 | return 0; |
| 13894 | } |
| 13895 | |
| 13896 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13897 | { |
| 13898 | int err; |
| 13899 | hda_nid_t nid; |
| 13900 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13901 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13902 | return 0; |
| 13903 | |
| 13904 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13905 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13906 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13907 | "Headphone Playback Switch", |
| 13908 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13909 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13910 | return err; |
| 13911 | spec->multiout.hp_nid = nid; |
| 13912 | } |
| 13913 | return 0; |
| 13914 | } |
| 13915 | |
| 13916 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13917 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13918 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13919 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13920 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13921 | int i, err, idx, idx1; |
| 13922 | |
| 13923 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13924 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13925 | case 0x0c: |
| 13926 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13927 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13928 | break; |
| 13929 | case 0x0f: |
| 13930 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13931 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13932 | break; |
| 13933 | case 0x0d: |
| 13934 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13935 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13936 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13937 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13938 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13939 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13940 | break; |
| 13941 | case 0x11: |
| 13942 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13943 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13944 | break; |
| 13945 | default: |
| 13946 | continue; |
| 13947 | } |
| 13948 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13949 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13950 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13951 | if (err < 0) |
| 13952 | return err; |
| 13953 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13954 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13955 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13956 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13957 | } |
| 13958 | return 0; |
| 13959 | } |
| 13960 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13961 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13962 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13963 | int pin_type, int dac_idx) |
| 13964 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13965 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13966 | pin_type); |
| 13967 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13968 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13969 | } |
| 13970 | |
| 13971 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13972 | { |
| 13973 | struct alc_spec *spec = codec->spec; |
| 13974 | int i; |
| 13975 | |
| 13976 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13977 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13978 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13979 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13980 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13981 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13982 | } |
| 13983 | } |
| 13984 | |
| 13985 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13986 | { |
| 13987 | struct alc_spec *spec = codec->spec; |
| 13988 | hda_nid_t pin; |
| 13989 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13990 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13991 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13992 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13993 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13994 | pin = spec->autocfg.speaker_pins[0]; |
| 13995 | if (pin) |
| 13996 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13997 | } |
| 13998 | |
| 13999 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14000 | { |
| 14001 | struct alc_spec *spec = codec->spec; |
| 14002 | int i; |
| 14003 | |
| 14004 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14005 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14006 | if (nid >= 0x0c && nid <= 0x11) |
| 14007 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14008 | } |
| 14009 | } |
| 14010 | |
| 14011 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14012 | /* return 1 if successful, 0 if the proper config is not found, |
| 14013 | * or a negative error code |
| 14014 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14015 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14016 | { |
| 14017 | struct alc_spec *spec = codec->spec; |
| 14018 | int err; |
| 14019 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14020 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14021 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14022 | alc861_ignore); |
| 14023 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14024 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14025 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14026 | return 0; /* can't find valid BIOS pin config */ |
| 14027 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14028 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14029 | if (err < 0) |
| 14030 | return err; |
| 14031 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14032 | if (err < 0) |
| 14033 | return err; |
| 14034 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 14035 | if (err < 0) |
| 14036 | return err; |
| 14037 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14038 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14039 | return err; |
| 14040 | |
| 14041 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14042 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14043 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14044 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14045 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14046 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14047 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14048 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14049 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14050 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14051 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14052 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14053 | |
| 14054 | spec->adc_nids = alc861_adc_nids; |
| 14055 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14056 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14057 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame^] | 14058 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14059 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14060 | return 1; |
| 14061 | } |
| 14062 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14063 | /* additional initialization for auto-configuration model */ |
| 14064 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14065 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14066 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14067 | alc861_auto_init_multi_out(codec); |
| 14068 | alc861_auto_init_hp_out(codec); |
| 14069 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14070 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14071 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14072 | } |
| 14073 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14074 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14075 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14076 | { 0x15, HDA_INPUT, 0 }, |
| 14077 | { 0x15, HDA_INPUT, 1 }, |
| 14078 | { 0x15, HDA_INPUT, 2 }, |
| 14079 | { 0x15, HDA_INPUT, 3 }, |
| 14080 | { } /* end */ |
| 14081 | }; |
| 14082 | #endif |
| 14083 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14084 | |
| 14085 | /* |
| 14086 | * configuration and preset |
| 14087 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14088 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14089 | [ALC861_3ST] = "3stack", |
| 14090 | [ALC660_3ST] = "3stack-660", |
| 14091 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14092 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14093 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14094 | [ALC861_TOSHIBA] = "toshiba", |
| 14095 | [ALC861_ASUS] = "asus", |
| 14096 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14097 | [ALC861_AUTO] = "auto", |
| 14098 | }; |
| 14099 | |
| 14100 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14101 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14102 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14103 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14104 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14105 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14106 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14107 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14108 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14109 | * Any other models that need this preset? |
| 14110 | */ |
| 14111 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14112 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14113 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14114 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14115 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14116 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14117 | /* FIXME: the below seems conflict */ |
| 14118 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14119 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14120 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14121 | {} |
| 14122 | }; |
| 14123 | |
| 14124 | static struct alc_config_preset alc861_presets[] = { |
| 14125 | [ALC861_3ST] = { |
| 14126 | .mixers = { alc861_3ST_mixer }, |
| 14127 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14128 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14129 | .dac_nids = alc861_dac_nids, |
| 14130 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14131 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14132 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14133 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14134 | .adc_nids = alc861_adc_nids, |
| 14135 | .input_mux = &alc861_capture_source, |
| 14136 | }, |
| 14137 | [ALC861_3ST_DIG] = { |
| 14138 | .mixers = { alc861_base_mixer }, |
| 14139 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14140 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14141 | .dac_nids = alc861_dac_nids, |
| 14142 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14143 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14144 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14145 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14146 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14147 | .adc_nids = alc861_adc_nids, |
| 14148 | .input_mux = &alc861_capture_source, |
| 14149 | }, |
| 14150 | [ALC861_6ST_DIG] = { |
| 14151 | .mixers = { alc861_base_mixer }, |
| 14152 | .init_verbs = { alc861_base_init_verbs }, |
| 14153 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14154 | .dac_nids = alc861_dac_nids, |
| 14155 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14156 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14157 | .channel_mode = alc861_8ch_modes, |
| 14158 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14159 | .adc_nids = alc861_adc_nids, |
| 14160 | .input_mux = &alc861_capture_source, |
| 14161 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14162 | [ALC660_3ST] = { |
| 14163 | .mixers = { alc861_3ST_mixer }, |
| 14164 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14165 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14166 | .dac_nids = alc660_dac_nids, |
| 14167 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14168 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14169 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14170 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14171 | .adc_nids = alc861_adc_nids, |
| 14172 | .input_mux = &alc861_capture_source, |
| 14173 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14174 | [ALC861_UNIWILL_M31] = { |
| 14175 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14176 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14177 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14178 | .dac_nids = alc861_dac_nids, |
| 14179 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14180 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14181 | .channel_mode = alc861_uniwill_m31_modes, |
| 14182 | .need_dac_fix = 1, |
| 14183 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14184 | .adc_nids = alc861_adc_nids, |
| 14185 | .input_mux = &alc861_capture_source, |
| 14186 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14187 | [ALC861_TOSHIBA] = { |
| 14188 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14189 | .init_verbs = { alc861_base_init_verbs, |
| 14190 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14191 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14192 | .dac_nids = alc861_dac_nids, |
| 14193 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14194 | .channel_mode = alc883_3ST_2ch_modes, |
| 14195 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14196 | .adc_nids = alc861_adc_nids, |
| 14197 | .input_mux = &alc861_capture_source, |
| 14198 | .unsol_event = alc861_toshiba_unsol_event, |
| 14199 | .init_hook = alc861_toshiba_automute, |
| 14200 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14201 | [ALC861_ASUS] = { |
| 14202 | .mixers = { alc861_asus_mixer }, |
| 14203 | .init_verbs = { alc861_asus_init_verbs }, |
| 14204 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14205 | .dac_nids = alc861_dac_nids, |
| 14206 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14207 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14208 | .channel_mode = alc861_asus_modes, |
| 14209 | .need_dac_fix = 1, |
| 14210 | .hp_nid = 0x06, |
| 14211 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14212 | .adc_nids = alc861_adc_nids, |
| 14213 | .input_mux = &alc861_capture_source, |
| 14214 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14215 | [ALC861_ASUS_LAPTOP] = { |
| 14216 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14217 | .init_verbs = { alc861_asus_init_verbs, |
| 14218 | alc861_asus_laptop_init_verbs }, |
| 14219 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14220 | .dac_nids = alc861_dac_nids, |
| 14221 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14222 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14223 | .channel_mode = alc883_3ST_2ch_modes, |
| 14224 | .need_dac_fix = 1, |
| 14225 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14226 | .adc_nids = alc861_adc_nids, |
| 14227 | .input_mux = &alc861_capture_source, |
| 14228 | }, |
| 14229 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14230 | |
| 14231 | |
| 14232 | static int patch_alc861(struct hda_codec *codec) |
| 14233 | { |
| 14234 | struct alc_spec *spec; |
| 14235 | int board_config; |
| 14236 | int err; |
| 14237 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14238 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14239 | if (spec == NULL) |
| 14240 | return -ENOMEM; |
| 14241 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14242 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14243 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14244 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14245 | alc861_models, |
| 14246 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14247 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14248 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14249 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 14250 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14251 | board_config = ALC861_AUTO; |
| 14252 | } |
| 14253 | |
| 14254 | if (board_config == ALC861_AUTO) { |
| 14255 | /* automatic parse from the BIOS config */ |
| 14256 | err = alc861_parse_auto_config(codec); |
| 14257 | if (err < 0) { |
| 14258 | alc_free(codec); |
| 14259 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14260 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14261 | printk(KERN_INFO |
| 14262 | "hda_codec: Cannot set up configuration " |
| 14263 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14264 | board_config = ALC861_3ST_DIG; |
| 14265 | } |
| 14266 | } |
| 14267 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14268 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14269 | if (err < 0) { |
| 14270 | alc_free(codec); |
| 14271 | return err; |
| 14272 | } |
| 14273 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14274 | if (board_config != ALC861_AUTO) |
| 14275 | setup_preset(spec, &alc861_presets[board_config]); |
| 14276 | |
| 14277 | spec->stream_name_analog = "ALC861 Analog"; |
| 14278 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14279 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14280 | |
| 14281 | spec->stream_name_digital = "ALC861 Digital"; |
| 14282 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14283 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14284 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14285 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14286 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14287 | spec->vmaster_nid = 0x03; |
| 14288 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14289 | codec->patch_ops = alc_patch_ops; |
| 14290 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14291 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14292 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14293 | if (!spec->loopback.amplist) |
| 14294 | spec->loopback.amplist = alc861_loopbacks; |
| 14295 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14296 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14297 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14298 | return 0; |
| 14299 | } |
| 14300 | |
| 14301 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14302 | * ALC861-VD support |
| 14303 | * |
| 14304 | * Based on ALC882 |
| 14305 | * |
| 14306 | * In addition, an independent DAC |
| 14307 | */ |
| 14308 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14309 | |
| 14310 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14311 | /* front, surr, clfe, side surr */ |
| 14312 | 0x02, 0x03, 0x04, 0x05 |
| 14313 | }; |
| 14314 | |
| 14315 | /* dac_nids for ALC660vd are in a different order - according to |
| 14316 | * Realtek's driver. |
| 14317 | * This should probably tesult in a different mixer for 6stack models |
| 14318 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14319 | * - and it is the same as in 861vd. |
| 14320 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14321 | */ |
| 14322 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14323 | /* front, rear, clfe, rear_surr */ |
| 14324 | 0x02, 0x04, 0x03 |
| 14325 | }; |
| 14326 | |
| 14327 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14328 | /* ADC0 */ |
| 14329 | 0x09, |
| 14330 | }; |
| 14331 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14332 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14333 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14334 | /* input MUX */ |
| 14335 | /* FIXME: should be a matrix-type input source selection */ |
| 14336 | static struct hda_input_mux alc861vd_capture_source = { |
| 14337 | .num_items = 4, |
| 14338 | .items = { |
| 14339 | { "Mic", 0x0 }, |
| 14340 | { "Front Mic", 0x1 }, |
| 14341 | { "Line", 0x2 }, |
| 14342 | { "CD", 0x4 }, |
| 14343 | }, |
| 14344 | }; |
| 14345 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14346 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14347 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14348 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14349 | { "Ext Mic", 0x0 }, |
| 14350 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14351 | }, |
| 14352 | }; |
| 14353 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14354 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14355 | .num_items = 2, |
| 14356 | .items = { |
| 14357 | { "Front Mic", 0x0 }, |
| 14358 | { "ATAPI Mic", 0x1 }, |
| 14359 | }, |
| 14360 | }; |
| 14361 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14362 | /* |
| 14363 | * 2ch mode |
| 14364 | */ |
| 14365 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14366 | { 2, NULL } |
| 14367 | }; |
| 14368 | |
| 14369 | /* |
| 14370 | * 6ch mode |
| 14371 | */ |
| 14372 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14373 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14374 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14375 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14376 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14377 | { } /* end */ |
| 14378 | }; |
| 14379 | |
| 14380 | /* |
| 14381 | * 8ch mode |
| 14382 | */ |
| 14383 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14384 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14385 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14386 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14387 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14388 | { } /* end */ |
| 14389 | }; |
| 14390 | |
| 14391 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14392 | { 6, alc861vd_6stack_ch6_init }, |
| 14393 | { 8, alc861vd_6stack_ch8_init }, |
| 14394 | }; |
| 14395 | |
| 14396 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14397 | { |
| 14398 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14399 | .name = "Channel Mode", |
| 14400 | .info = alc_ch_mode_info, |
| 14401 | .get = alc_ch_mode_get, |
| 14402 | .put = alc_ch_mode_put, |
| 14403 | }, |
| 14404 | { } /* end */ |
| 14405 | }; |
| 14406 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14407 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14408 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14409 | */ |
| 14410 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14411 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14412 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14413 | |
| 14414 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14415 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14416 | |
| 14417 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14418 | HDA_OUTPUT), |
| 14419 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14420 | HDA_OUTPUT), |
| 14421 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14422 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14423 | |
| 14424 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14425 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14426 | |
| 14427 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14428 | |
| 14429 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14431 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14432 | |
| 14433 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14434 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14435 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14436 | |
| 14437 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14438 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14439 | |
| 14440 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14441 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14442 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14443 | { } /* end */ |
| 14444 | }; |
| 14445 | |
| 14446 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14447 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14448 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14449 | |
| 14450 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14451 | |
| 14452 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14453 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14454 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14455 | |
| 14456 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14457 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14458 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14459 | |
| 14460 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14461 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14462 | |
| 14463 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14464 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14465 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14466 | { } /* end */ |
| 14467 | }; |
| 14468 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14469 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14470 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14471 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14472 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14473 | |
| 14474 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14475 | |
| 14476 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14477 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14478 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14479 | |
| 14480 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14481 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14482 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14483 | |
| 14484 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14485 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14486 | |
| 14487 | { } /* end */ |
| 14488 | }; |
| 14489 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14490 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14491 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14492 | */ |
| 14493 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14494 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14495 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14496 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14497 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14498 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14499 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14500 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14501 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14502 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14503 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14504 | { } /* end */ |
| 14505 | }; |
| 14506 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14507 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14508 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14509 | */ |
| 14510 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14511 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14512 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14513 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14514 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14515 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14516 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14517 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14518 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14519 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14520 | { } /* end */ |
| 14521 | }; |
| 14522 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14523 | /* |
| 14524 | * generic initialization of ADC, input mixers and output mixers |
| 14525 | */ |
| 14526 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14527 | /* |
| 14528 | * Unmute ADC0 and set the default input to mic-in |
| 14529 | */ |
| 14530 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14531 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14532 | |
| 14533 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14534 | * the analog-loopback mixer widget |
| 14535 | */ |
| 14536 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14537 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14538 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14539 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14540 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14541 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14542 | |
| 14543 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14544 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14545 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14546 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14547 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14548 | |
| 14549 | /* |
| 14550 | * Set up output mixers (0x02 - 0x05) |
| 14551 | */ |
| 14552 | /* set vol=0 to output mixers */ |
| 14553 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14554 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14555 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14556 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14557 | |
| 14558 | /* set up input amps for analog loopback */ |
| 14559 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14560 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14561 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14562 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14563 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14564 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14565 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14566 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14567 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14568 | |
| 14569 | { } |
| 14570 | }; |
| 14571 | |
| 14572 | /* |
| 14573 | * 3-stack pin configuration: |
| 14574 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14575 | */ |
| 14576 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14577 | /* |
| 14578 | * Set pin mode and muting |
| 14579 | */ |
| 14580 | /* set front pin widgets 0x14 for output */ |
| 14581 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14582 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14583 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14584 | |
| 14585 | /* Mic (rear) pin: input vref at 80% */ |
| 14586 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14587 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14588 | /* Front Mic pin: input vref at 80% */ |
| 14589 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14590 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14591 | /* Line In pin: input */ |
| 14592 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14593 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14594 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14595 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14596 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14597 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14598 | /* CD pin widget for input */ |
| 14599 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14600 | |
| 14601 | { } |
| 14602 | }; |
| 14603 | |
| 14604 | /* |
| 14605 | * 6-stack pin configuration: |
| 14606 | */ |
| 14607 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14608 | /* |
| 14609 | * Set pin mode and muting |
| 14610 | */ |
| 14611 | /* set front pin widgets 0x14 for output */ |
| 14612 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14613 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14614 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14615 | |
| 14616 | /* Rear Pin: output 1 (0x0d) */ |
| 14617 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14618 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14619 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14620 | /* CLFE Pin: output 2 (0x0e) */ |
| 14621 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14622 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14623 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14624 | /* Side Pin: output 3 (0x0f) */ |
| 14625 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14626 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14627 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14628 | |
| 14629 | /* Mic (rear) pin: input vref at 80% */ |
| 14630 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14631 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14632 | /* Front Mic pin: input vref at 80% */ |
| 14633 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14634 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14635 | /* Line In pin: input */ |
| 14636 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14637 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14638 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14639 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14640 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14641 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14642 | /* CD pin widget for input */ |
| 14643 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14644 | |
| 14645 | { } |
| 14646 | }; |
| 14647 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14648 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14649 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14650 | { } |
| 14651 | }; |
| 14652 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14653 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14654 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14655 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14656 | { } |
| 14657 | }; |
| 14658 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14659 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14660 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14661 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14662 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14663 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14664 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14665 | {} |
| 14666 | }; |
| 14667 | |
| 14668 | /* toggle speaker-output according to the hp-jack state */ |
| 14669 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 14670 | { |
| 14671 | unsigned int present; |
| 14672 | unsigned char bits; |
| 14673 | |
| 14674 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14675 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14676 | bits = present ? HDA_AMP_MUTE : 0; |
| 14677 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14678 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14679 | } |
| 14680 | |
| 14681 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14682 | { |
| 14683 | unsigned int present; |
| 14684 | unsigned char bits; |
| 14685 | |
| 14686 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14687 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14688 | bits = present ? HDA_AMP_MUTE : 0; |
| 14689 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14690 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14691 | } |
| 14692 | |
| 14693 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 14694 | { |
| 14695 | alc861vd_lenovo_hp_automute(codec); |
| 14696 | alc861vd_lenovo_mic_automute(codec); |
| 14697 | } |
| 14698 | |
| 14699 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14700 | unsigned int res) |
| 14701 | { |
| 14702 | switch (res >> 26) { |
| 14703 | case ALC880_HP_EVENT: |
| 14704 | alc861vd_lenovo_hp_automute(codec); |
| 14705 | break; |
| 14706 | case ALC880_MIC_EVENT: |
| 14707 | alc861vd_lenovo_mic_automute(codec); |
| 14708 | break; |
| 14709 | } |
| 14710 | } |
| 14711 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14712 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14713 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14714 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14715 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14716 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14717 | |
| 14718 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14719 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14720 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14721 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14722 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14723 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14724 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14725 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14726 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14727 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14728 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14729 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14730 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14731 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14732 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14733 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14734 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14735 | |
| 14736 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14737 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14738 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14739 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14740 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14741 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14742 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14743 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14744 | |
| 14745 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14746 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14747 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14748 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14749 | |
| 14750 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14751 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14752 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14753 | |
| 14754 | { } /* end */ |
| 14755 | }; |
| 14756 | |
| 14757 | /* toggle speaker-output according to the hp-jack state */ |
| 14758 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 14759 | { |
| 14760 | unsigned int present; |
| 14761 | |
| 14762 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14763 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14764 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14765 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14766 | } |
| 14767 | |
| 14768 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 14769 | { |
| 14770 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14771 | alc861vd_dallas_automute(codec); |
| 14772 | } |
| 14773 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14774 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14775 | #define alc861vd_loopbacks alc880_loopbacks |
| 14776 | #endif |
| 14777 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14778 | /* pcm configuration: identiacal with ALC880 */ |
| 14779 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14780 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14781 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14782 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14783 | |
| 14784 | /* |
| 14785 | * configuration and preset |
| 14786 | */ |
| 14787 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14788 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14789 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14790 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14791 | [ALC861VD_3ST] = "3stack", |
| 14792 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14793 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14794 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14795 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14796 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14797 | [ALC861VD_AUTO] = "auto", |
| 14798 | }; |
| 14799 | |
| 14800 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14801 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14802 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14803 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14804 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14805 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14806 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14807 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14808 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14809 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14810 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14811 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14812 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14813 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 14814 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14815 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14816 | {} |
| 14817 | }; |
| 14818 | |
| 14819 | static struct alc_config_preset alc861vd_presets[] = { |
| 14820 | [ALC660VD_3ST] = { |
| 14821 | .mixers = { alc861vd_3st_mixer }, |
| 14822 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14823 | alc861vd_3stack_init_verbs }, |
| 14824 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14825 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14826 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14827 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14828 | .input_mux = &alc861vd_capture_source, |
| 14829 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14830 | [ALC660VD_3ST_DIG] = { |
| 14831 | .mixers = { alc861vd_3st_mixer }, |
| 14832 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14833 | alc861vd_3stack_init_verbs }, |
| 14834 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14835 | .dac_nids = alc660vd_dac_nids, |
| 14836 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14837 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14838 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14839 | .input_mux = &alc861vd_capture_source, |
| 14840 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14841 | [ALC861VD_3ST] = { |
| 14842 | .mixers = { alc861vd_3st_mixer }, |
| 14843 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14844 | alc861vd_3stack_init_verbs }, |
| 14845 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14846 | .dac_nids = alc861vd_dac_nids, |
| 14847 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14848 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14849 | .input_mux = &alc861vd_capture_source, |
| 14850 | }, |
| 14851 | [ALC861VD_3ST_DIG] = { |
| 14852 | .mixers = { alc861vd_3st_mixer }, |
| 14853 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14854 | alc861vd_3stack_init_verbs }, |
| 14855 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14856 | .dac_nids = alc861vd_dac_nids, |
| 14857 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14858 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14859 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14860 | .input_mux = &alc861vd_capture_source, |
| 14861 | }, |
| 14862 | [ALC861VD_6ST_DIG] = { |
| 14863 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14864 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14865 | alc861vd_6stack_init_verbs }, |
| 14866 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14867 | .dac_nids = alc861vd_dac_nids, |
| 14868 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14869 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14870 | .channel_mode = alc861vd_6stack_modes, |
| 14871 | .input_mux = &alc861vd_capture_source, |
| 14872 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14873 | [ALC861VD_LENOVO] = { |
| 14874 | .mixers = { alc861vd_lenovo_mixer }, |
| 14875 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14876 | alc861vd_3stack_init_verbs, |
| 14877 | alc861vd_eapd_verbs, |
| 14878 | alc861vd_lenovo_unsol_verbs }, |
| 14879 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14880 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14881 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14882 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14883 | .input_mux = &alc861vd_capture_source, |
| 14884 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14885 | .init_hook = alc861vd_lenovo_automute, |
| 14886 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14887 | [ALC861VD_DALLAS] = { |
| 14888 | .mixers = { alc861vd_dallas_mixer }, |
| 14889 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14890 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14891 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14892 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14893 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14894 | .input_mux = &alc861vd_dallas_capture_source, |
| 14895 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14896 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14897 | }, |
| 14898 | [ALC861VD_HP] = { |
| 14899 | .mixers = { alc861vd_hp_mixer }, |
| 14900 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14901 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14902 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14903 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14904 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14905 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14906 | .input_mux = &alc861vd_hp_capture_source, |
| 14907 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14908 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14909 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14910 | [ALC660VD_ASUS_V1S] = { |
| 14911 | .mixers = { alc861vd_lenovo_mixer }, |
| 14912 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14913 | alc861vd_3stack_init_verbs, |
| 14914 | alc861vd_eapd_verbs, |
| 14915 | alc861vd_lenovo_unsol_verbs }, |
| 14916 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14917 | .dac_nids = alc660vd_dac_nids, |
| 14918 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14919 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14920 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14921 | .input_mux = &alc861vd_capture_source, |
| 14922 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14923 | .init_hook = alc861vd_lenovo_automute, |
| 14924 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14925 | }; |
| 14926 | |
| 14927 | /* |
| 14928 | * BIOS auto configuration |
| 14929 | */ |
| 14930 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14931 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14932 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14933 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14934 | } |
| 14935 | |
| 14936 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14937 | { |
| 14938 | struct alc_spec *spec = codec->spec; |
| 14939 | int i; |
| 14940 | |
| 14941 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14942 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14943 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14944 | if (nid) |
| 14945 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14946 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14947 | } |
| 14948 | } |
| 14949 | |
| 14950 | |
| 14951 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14952 | { |
| 14953 | struct alc_spec *spec = codec->spec; |
| 14954 | hda_nid_t pin; |
| 14955 | |
| 14956 | pin = spec->autocfg.hp_pins[0]; |
| 14957 | if (pin) /* connect to front and use dac 0 */ |
| 14958 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14959 | pin = spec->autocfg.speaker_pins[0]; |
| 14960 | if (pin) |
| 14961 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14962 | } |
| 14963 | |
| 14964 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14965 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14966 | |
| 14967 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14968 | { |
| 14969 | struct alc_spec *spec = codec->spec; |
| 14970 | int i; |
| 14971 | |
| 14972 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14973 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14974 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14975 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 14976 | if (nid != ALC861VD_PIN_CD_NID && |
| 14977 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14978 | snd_hda_codec_write(codec, nid, 0, |
| 14979 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14980 | AMP_OUT_MUTE); |
| 14981 | } |
| 14982 | } |
| 14983 | } |
| 14984 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14985 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14986 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14987 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14988 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14989 | |
| 14990 | /* add playback controls from the parsed DAC table */ |
| 14991 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14992 | * different NIDs for mute/unmute switch and volume control */ |
| 14993 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14994 | const struct auto_pin_cfg *cfg) |
| 14995 | { |
| 14996 | char name[32]; |
| 14997 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14998 | hda_nid_t nid_v, nid_s; |
| 14999 | int i, err; |
| 15000 | |
| 15001 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15002 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15003 | continue; |
| 15004 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15005 | alc880_dac_to_idx( |
| 15006 | spec->multiout.dac_nids[i])); |
| 15007 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15008 | alc880_dac_to_idx( |
| 15009 | spec->multiout.dac_nids[i])); |
| 15010 | |
| 15011 | if (i == 2) { |
| 15012 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15013 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15014 | "Center Playback Volume", |
| 15015 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15016 | HDA_OUTPUT)); |
| 15017 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15018 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15019 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15020 | "LFE Playback Volume", |
| 15021 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15022 | HDA_OUTPUT)); |
| 15023 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15024 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15025 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15026 | "Center Playback Switch", |
| 15027 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15028 | HDA_INPUT)); |
| 15029 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15030 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15031 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15032 | "LFE Playback Switch", |
| 15033 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15034 | HDA_INPUT)); |
| 15035 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15036 | return err; |
| 15037 | } else { |
| 15038 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15039 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15040 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15041 | HDA_OUTPUT)); |
| 15042 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15043 | return err; |
| 15044 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15045 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15046 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15047 | HDA_INPUT)); |
| 15048 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15049 | return err; |
| 15050 | } |
| 15051 | } |
| 15052 | return 0; |
| 15053 | } |
| 15054 | |
| 15055 | /* add playback controls for speaker and HP outputs */ |
| 15056 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15057 | * different NIDs for mute/unmute switch and volume control */ |
| 15058 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15059 | hda_nid_t pin, const char *pfx) |
| 15060 | { |
| 15061 | hda_nid_t nid_v, nid_s; |
| 15062 | int err; |
| 15063 | char name[32]; |
| 15064 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15065 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15066 | return 0; |
| 15067 | |
| 15068 | if (alc880_is_fixed_pin(pin)) { |
| 15069 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15070 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15071 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15072 | spec->multiout.hp_nid = nid_v; |
| 15073 | else |
| 15074 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15075 | /* control HP volume/switch on the output mixer amp */ |
| 15076 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15077 | alc880_fixed_pin_idx(pin)); |
| 15078 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15079 | alc880_fixed_pin_idx(pin)); |
| 15080 | |
| 15081 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15082 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15083 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15084 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15085 | return err; |
| 15086 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15087 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15088 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15089 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15090 | return err; |
| 15091 | } else if (alc880_is_multi_pin(pin)) { |
| 15092 | /* set manual connection */ |
| 15093 | /* we have only a switch on HP-out PIN */ |
| 15094 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15095 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15096 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15097 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15098 | return err; |
| 15099 | } |
| 15100 | return 0; |
| 15101 | } |
| 15102 | |
| 15103 | /* parse the BIOS configuration and set up the alc_spec |
| 15104 | * return 1 if successful, 0 if the proper config is not found, |
| 15105 | * or a negative error code |
| 15106 | * Based on ALC880 version - had to change it to override |
| 15107 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15108 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15109 | { |
| 15110 | struct alc_spec *spec = codec->spec; |
| 15111 | int err; |
| 15112 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15113 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15114 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15115 | alc861vd_ignore); |
| 15116 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15117 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15118 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15119 | return 0; /* can't find valid BIOS pin config */ |
| 15120 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15121 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15122 | if (err < 0) |
| 15123 | return err; |
| 15124 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15125 | if (err < 0) |
| 15126 | return err; |
| 15127 | err = alc861vd_auto_create_extra_out(spec, |
| 15128 | spec->autocfg.speaker_pins[0], |
| 15129 | "Speaker"); |
| 15130 | if (err < 0) |
| 15131 | return err; |
| 15132 | err = alc861vd_auto_create_extra_out(spec, |
| 15133 | spec->autocfg.hp_pins[0], |
| 15134 | "Headphone"); |
| 15135 | if (err < 0) |
| 15136 | return err; |
| 15137 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15138 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15139 | return err; |
| 15140 | |
| 15141 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15142 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15143 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15144 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15145 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15146 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15147 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15148 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15149 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15150 | |
| 15151 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15152 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15153 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15154 | err = alc_auto_add_mic_boost(codec); |
| 15155 | if (err < 0) |
| 15156 | return err; |
| 15157 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame^] | 15158 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15159 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15160 | return 1; |
| 15161 | } |
| 15162 | |
| 15163 | /* additional initialization for auto-configuration model */ |
| 15164 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15165 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15166 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15167 | alc861vd_auto_init_multi_out(codec); |
| 15168 | alc861vd_auto_init_hp_out(codec); |
| 15169 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15170 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15171 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15172 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15173 | } |
| 15174 | |
| 15175 | static int patch_alc861vd(struct hda_codec *codec) |
| 15176 | { |
| 15177 | struct alc_spec *spec; |
| 15178 | int err, board_config; |
| 15179 | |
| 15180 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15181 | if (spec == NULL) |
| 15182 | return -ENOMEM; |
| 15183 | |
| 15184 | codec->spec = spec; |
| 15185 | |
| 15186 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15187 | alc861vd_models, |
| 15188 | alc861vd_cfg_tbl); |
| 15189 | |
| 15190 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 15191 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 15192 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 15193 | board_config = ALC861VD_AUTO; |
| 15194 | } |
| 15195 | |
| 15196 | if (board_config == ALC861VD_AUTO) { |
| 15197 | /* automatic parse from the BIOS config */ |
| 15198 | err = alc861vd_parse_auto_config(codec); |
| 15199 | if (err < 0) { |
| 15200 | alc_free(codec); |
| 15201 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15202 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15203 | printk(KERN_INFO |
| 15204 | "hda_codec: Cannot set up configuration " |
| 15205 | "from BIOS. Using base mode...\n"); |
| 15206 | board_config = ALC861VD_3ST; |
| 15207 | } |
| 15208 | } |
| 15209 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15210 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15211 | if (err < 0) { |
| 15212 | alc_free(codec); |
| 15213 | return err; |
| 15214 | } |
| 15215 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15216 | if (board_config != ALC861VD_AUTO) |
| 15217 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15218 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15219 | if (codec->vendor_id == 0x10ec0660) { |
| 15220 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 15221 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15222 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15223 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15224 | } else { |
| 15225 | spec->stream_name_analog = "ALC861VD Analog"; |
| 15226 | spec->stream_name_digital = "ALC861VD Digital"; |
| 15227 | } |
| 15228 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15229 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15230 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15231 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15232 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15233 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15234 | |
| 15235 | spec->adc_nids = alc861vd_adc_nids; |
| 15236 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15237 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15238 | spec->capture_style = CAPT_MIX; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15239 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15240 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15241 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15242 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15243 | spec->vmaster_nid = 0x02; |
| 15244 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15245 | codec->patch_ops = alc_patch_ops; |
| 15246 | |
| 15247 | if (board_config == ALC861VD_AUTO) |
| 15248 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15249 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15250 | if (!spec->loopback.amplist) |
| 15251 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15252 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15253 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15254 | |
| 15255 | return 0; |
| 15256 | } |
| 15257 | |
| 15258 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15259 | * ALC662 support |
| 15260 | * |
| 15261 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15262 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15263 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15264 | * 6-channel independent captures. |
| 15265 | * |
| 15266 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15267 | * driver yet). |
| 15268 | */ |
| 15269 | #define ALC662_DIGOUT_NID 0x06 |
| 15270 | #define ALC662_DIGIN_NID 0x0a |
| 15271 | |
| 15272 | static hda_nid_t alc662_dac_nids[4] = { |
| 15273 | /* front, rear, clfe, rear_surr */ |
| 15274 | 0x02, 0x03, 0x04 |
| 15275 | }; |
| 15276 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15277 | static hda_nid_t alc272_dac_nids[2] = { |
| 15278 | 0x02, 0x03 |
| 15279 | }; |
| 15280 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15281 | static hda_nid_t alc662_adc_nids[1] = { |
| 15282 | /* ADC1-2 */ |
| 15283 | 0x09, |
| 15284 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15285 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15286 | static hda_nid_t alc272_adc_nids[1] = { |
| 15287 | /* ADC1-2 */ |
| 15288 | 0x08, |
| 15289 | }; |
| 15290 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15291 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15292 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15293 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15294 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15295 | /* input MUX */ |
| 15296 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15297 | static struct hda_input_mux alc662_capture_source = { |
| 15298 | .num_items = 4, |
| 15299 | .items = { |
| 15300 | { "Mic", 0x0 }, |
| 15301 | { "Front Mic", 0x1 }, |
| 15302 | { "Line", 0x2 }, |
| 15303 | { "CD", 0x4 }, |
| 15304 | }, |
| 15305 | }; |
| 15306 | |
| 15307 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15308 | .num_items = 2, |
| 15309 | .items = { |
| 15310 | { "Mic", 0x1 }, |
| 15311 | { "Line", 0x2 }, |
| 15312 | }, |
| 15313 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15314 | |
| 15315 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15316 | .num_items = 2, |
| 15317 | .items = { |
| 15318 | { "i-Mic", 0x1 }, |
| 15319 | { "e-Mic", 0x0 }, |
| 15320 | }, |
| 15321 | }; |
| 15322 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15323 | static struct hda_input_mux alc663_capture_source = { |
| 15324 | .num_items = 3, |
| 15325 | .items = { |
| 15326 | { "Mic", 0x0 }, |
| 15327 | { "Front Mic", 0x1 }, |
| 15328 | { "Line", 0x2 }, |
| 15329 | }, |
| 15330 | }; |
| 15331 | |
| 15332 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15333 | .num_items = 2, |
| 15334 | .items = { |
| 15335 | { "Ext-Mic", 0x0 }, |
| 15336 | { "D-Mic", 0x9 }, |
| 15337 | }, |
| 15338 | }; |
| 15339 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15340 | /* |
| 15341 | * 2ch mode |
| 15342 | */ |
| 15343 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15344 | { 2, NULL } |
| 15345 | }; |
| 15346 | |
| 15347 | /* |
| 15348 | * 2ch mode |
| 15349 | */ |
| 15350 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15351 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15352 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15353 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15354 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15355 | { } /* end */ |
| 15356 | }; |
| 15357 | |
| 15358 | /* |
| 15359 | * 6ch mode |
| 15360 | */ |
| 15361 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15362 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15363 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15364 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15365 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15366 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15367 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15368 | { } /* end */ |
| 15369 | }; |
| 15370 | |
| 15371 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15372 | { 2, alc662_3ST_ch2_init }, |
| 15373 | { 6, alc662_3ST_ch6_init }, |
| 15374 | }; |
| 15375 | |
| 15376 | /* |
| 15377 | * 2ch mode |
| 15378 | */ |
| 15379 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15380 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15381 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15382 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15383 | { } /* end */ |
| 15384 | }; |
| 15385 | |
| 15386 | /* |
| 15387 | * 6ch mode |
| 15388 | */ |
| 15389 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15390 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15391 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15392 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15393 | { } /* end */ |
| 15394 | }; |
| 15395 | |
| 15396 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15397 | { 2, alc662_sixstack_ch6_init }, |
| 15398 | { 6, alc662_sixstack_ch8_init }, |
| 15399 | }; |
| 15400 | |
| 15401 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15402 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15403 | */ |
| 15404 | |
| 15405 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15406 | /* output mixer control */ |
| 15407 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15408 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15409 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15410 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15411 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15412 | 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] | 15413 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15414 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15415 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15416 | |
| 15417 | /*Input mixer control */ |
| 15418 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15419 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15420 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15421 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15422 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15423 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15424 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15425 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15426 | { } /* end */ |
| 15427 | }; |
| 15428 | |
| 15429 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15430 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15431 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15432 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15433 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15434 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15435 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15436 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15437 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15438 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15439 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15440 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15441 | { } /* end */ |
| 15442 | }; |
| 15443 | |
| 15444 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15445 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15446 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15447 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15448 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15449 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15450 | 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] | 15451 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15452 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15453 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15454 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15455 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15456 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15457 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15458 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15459 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15460 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15461 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15462 | { } /* end */ |
| 15463 | }; |
| 15464 | |
| 15465 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15466 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15467 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15468 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15469 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15470 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15471 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15472 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15473 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15474 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15475 | { } /* end */ |
| 15476 | }; |
| 15477 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15478 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15479 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15480 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 15481 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15482 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15483 | |
| 15484 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15485 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15486 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15487 | |
| 15488 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15489 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15490 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15491 | { } /* end */ |
| 15492 | }; |
| 15493 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15494 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 15495 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15496 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15497 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15498 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 15499 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15500 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 15501 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 15502 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15503 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15504 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15505 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15506 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15507 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15508 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15509 | { } /* end */ |
| 15510 | }; |
| 15511 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15512 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15513 | .ops = &snd_hda_bind_vol, |
| 15514 | .values = { |
| 15515 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15516 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15517 | 0 |
| 15518 | }, |
| 15519 | }; |
| 15520 | |
| 15521 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15522 | .ops = &snd_hda_bind_sw, |
| 15523 | .values = { |
| 15524 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15525 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15526 | 0 |
| 15527 | }, |
| 15528 | }; |
| 15529 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15530 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15531 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15532 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15533 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15534 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15535 | { } /* end */ |
| 15536 | }; |
| 15537 | |
| 15538 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15539 | .ops = &snd_hda_bind_sw, |
| 15540 | .values = { |
| 15541 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15542 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15543 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15544 | 0 |
| 15545 | }, |
| 15546 | }; |
| 15547 | |
| 15548 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15549 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15550 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15551 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15552 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15553 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15554 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15555 | |
| 15556 | { } /* end */ |
| 15557 | }; |
| 15558 | |
| 15559 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15560 | .ops = &snd_hda_bind_sw, |
| 15561 | .values = { |
| 15562 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15563 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15564 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15565 | 0 |
| 15566 | }, |
| 15567 | }; |
| 15568 | |
| 15569 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15570 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15571 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15572 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15573 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15574 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15575 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15576 | { } /* end */ |
| 15577 | }; |
| 15578 | |
| 15579 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15580 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15581 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15582 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15583 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15584 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15585 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15586 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15587 | { } /* end */ |
| 15588 | }; |
| 15589 | |
| 15590 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15591 | .ops = &snd_hda_bind_vol, |
| 15592 | .values = { |
| 15593 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15594 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15595 | 0 |
| 15596 | }, |
| 15597 | }; |
| 15598 | |
| 15599 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15600 | .ops = &snd_hda_bind_sw, |
| 15601 | .values = { |
| 15602 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15603 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15604 | 0 |
| 15605 | }, |
| 15606 | }; |
| 15607 | |
| 15608 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15609 | HDA_BIND_VOL("Master Playback Volume", |
| 15610 | &alc663_asus_two_bind_master_vol), |
| 15611 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15612 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15613 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15614 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15615 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15616 | { } /* end */ |
| 15617 | }; |
| 15618 | |
| 15619 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15620 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15621 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15622 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15623 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15624 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15625 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15626 | { } /* end */ |
| 15627 | }; |
| 15628 | |
| 15629 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15630 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15631 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15632 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15633 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15634 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15635 | |
| 15636 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15637 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15638 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15639 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15640 | { } /* end */ |
| 15641 | }; |
| 15642 | |
| 15643 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15644 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15645 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15646 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15647 | |
| 15648 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15649 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15650 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15651 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15652 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15653 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15654 | { } /* end */ |
| 15655 | }; |
| 15656 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15657 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15658 | { |
| 15659 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15660 | .name = "Channel Mode", |
| 15661 | .info = alc_ch_mode_info, |
| 15662 | .get = alc_ch_mode_get, |
| 15663 | .put = alc_ch_mode_put, |
| 15664 | }, |
| 15665 | { } /* end */ |
| 15666 | }; |
| 15667 | |
| 15668 | static struct hda_verb alc662_init_verbs[] = { |
| 15669 | /* ADC: mute amp left and right */ |
| 15670 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15671 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15672 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15673 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15674 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15675 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15676 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15677 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15678 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15679 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15680 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15681 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15682 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15683 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15684 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15685 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15686 | |
| 15687 | /* Front Pin: output 0 (0x0c) */ |
| 15688 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15689 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15690 | |
| 15691 | /* Rear Pin: output 1 (0x0d) */ |
| 15692 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15693 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15694 | |
| 15695 | /* CLFE Pin: output 2 (0x0e) */ |
| 15696 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15697 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15698 | |
| 15699 | /* Mic (rear) pin: input vref at 80% */ |
| 15700 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15701 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15702 | /* Front Mic pin: input vref at 80% */ |
| 15703 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15704 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15705 | /* Line In pin: input */ |
| 15706 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15707 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15708 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15709 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15710 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15711 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15712 | /* CD pin widget for input */ |
| 15713 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15714 | |
| 15715 | /* FIXME: use matrix-type input source selection */ |
| 15716 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15717 | /* Input mixer */ |
| 15718 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15719 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15720 | |
| 15721 | /* always trun on EAPD */ |
| 15722 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15723 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15724 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15725 | { } |
| 15726 | }; |
| 15727 | |
| 15728 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15729 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15730 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15731 | {} |
| 15732 | }; |
| 15733 | |
| 15734 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15735 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15736 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15737 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15738 | }; |
| 15739 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15740 | /* Set Unsolicited Event*/ |
| 15741 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15742 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15743 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15744 | {} |
| 15745 | }; |
| 15746 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15747 | /* |
| 15748 | * generic initialization of ADC, input mixers and output mixers |
| 15749 | */ |
| 15750 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15751 | /* |
| 15752 | * Unmute ADC and set the default input to mic-in |
| 15753 | */ |
| 15754 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15755 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15756 | |
| 15757 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15758 | * mixer widget |
| 15759 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15760 | * panel mic (mic 2) |
| 15761 | */ |
| 15762 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15763 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15764 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15765 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15766 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15767 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15768 | |
| 15769 | /* |
| 15770 | * Set up output mixers (0x0c - 0x0f) |
| 15771 | */ |
| 15772 | /* set vol=0 to output mixers */ |
| 15773 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15774 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15775 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15776 | |
| 15777 | /* set up input amps for analog loopback */ |
| 15778 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15779 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15780 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15781 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15782 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15783 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15784 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15785 | |
| 15786 | |
| 15787 | /* FIXME: use matrix-type input source selection */ |
| 15788 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15789 | /* Input mixer */ |
| 15790 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15791 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15792 | { } |
| 15793 | }; |
| 15794 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15795 | /* additional verbs for ALC663 */ |
| 15796 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15797 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15798 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15799 | { } |
| 15800 | }; |
| 15801 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15802 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15803 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15804 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15805 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15806 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15807 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15808 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15809 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15810 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15811 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15812 | {} |
| 15813 | }; |
| 15814 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15815 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15816 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15817 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15818 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15819 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15820 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15821 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15822 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15823 | {} |
| 15824 | }; |
| 15825 | |
| 15826 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15827 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15828 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15829 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15830 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15831 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15832 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15833 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15834 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15835 | {} |
| 15836 | }; |
| 15837 | |
| 15838 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15839 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15840 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15841 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15842 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15843 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15844 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15845 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15846 | {} |
| 15847 | }; |
| 15848 | |
| 15849 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15850 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15851 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15852 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15853 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15854 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15855 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15856 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15857 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15858 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15859 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15860 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15861 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15862 | {} |
| 15863 | }; |
| 15864 | |
| 15865 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15866 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15867 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15868 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15869 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15870 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15871 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15872 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15873 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15874 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15875 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15876 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15877 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15878 | {} |
| 15879 | }; |
| 15880 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15881 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15882 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15883 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15884 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15885 | |
| 15886 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15887 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15888 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15889 | |
| 15890 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15891 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15892 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15893 | {} |
| 15894 | }; |
| 15895 | |
| 15896 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15897 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15898 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15899 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15900 | |
| 15901 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15902 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15903 | {} |
| 15904 | }; |
| 15905 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15906 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15907 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15908 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15909 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15910 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15911 | {} |
| 15912 | }; |
| 15913 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15914 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 15915 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15916 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15917 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15918 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15919 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15920 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15921 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15922 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15923 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 15924 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15925 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15926 | {} |
| 15927 | }; |
| 15928 | |
| 15929 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 15930 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15931 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15932 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15933 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15934 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15935 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15936 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15937 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15938 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 15939 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15940 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15941 | {} |
| 15942 | }; |
| 15943 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15944 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15945 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15946 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15947 | { } /* end */ |
| 15948 | }; |
| 15949 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15950 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 15951 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 15952 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 15953 | { } /* end */ |
| 15954 | }; |
| 15955 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15956 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15957 | { |
| 15958 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15959 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15960 | |
| 15961 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15962 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15963 | bits = present ? HDA_AMP_MUTE : 0; |
| 15964 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15965 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15966 | } |
| 15967 | |
| 15968 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15969 | { |
| 15970 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15971 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15972 | |
| 15973 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15974 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15975 | bits = present ? HDA_AMP_MUTE : 0; |
| 15976 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15977 | HDA_AMP_MUTE, bits); |
| 15978 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15979 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15980 | } |
| 15981 | |
| 15982 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15983 | unsigned int res) |
| 15984 | { |
| 15985 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15986 | alc662_lenovo_101e_all_automute(codec); |
| 15987 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15988 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15989 | } |
| 15990 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15991 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15992 | { |
| 15993 | unsigned int present; |
| 15994 | |
| 15995 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15996 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15997 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15998 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15999 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16000 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16001 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16002 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16003 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16004 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16005 | } |
| 16006 | |
| 16007 | /* unsolicited event for HP jack sensing */ |
| 16008 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16009 | unsigned int res) |
| 16010 | { |
| 16011 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16012 | alc262_hippo1_automute( codec ); |
| 16013 | |
| 16014 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 16015 | alc662_eeepc_mic_automute(codec); |
| 16016 | } |
| 16017 | |
| 16018 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16019 | { |
| 16020 | alc262_hippo1_automute( codec ); |
| 16021 | alc662_eeepc_mic_automute(codec); |
| 16022 | } |
| 16023 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16024 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 16025 | { |
| 16026 | unsigned int mute; |
| 16027 | unsigned int present; |
| 16028 | |
| 16029 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 16030 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16031 | AC_VERB_GET_PIN_SENSE, 0); |
| 16032 | present = (present & 0x80000000) != 0; |
| 16033 | if (present) { |
| 16034 | /* mute internal speaker */ |
| 16035 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16036 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16037 | } else { |
| 16038 | /* unmute internal speaker if necessary */ |
| 16039 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 16040 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16041 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16042 | } |
| 16043 | } |
| 16044 | |
| 16045 | /* unsolicited event for HP jack sensing */ |
| 16046 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 16047 | unsigned int res) |
| 16048 | { |
| 16049 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16050 | alc662_eeepc_ep20_automute(codec); |
| 16051 | } |
| 16052 | |
| 16053 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 16054 | { |
| 16055 | alc662_eeepc_ep20_automute(codec); |
| 16056 | } |
| 16057 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16058 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16059 | { |
| 16060 | unsigned int present; |
| 16061 | unsigned char bits; |
| 16062 | |
| 16063 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16064 | AC_VERB_GET_PIN_SENSE, 0) |
| 16065 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16066 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16067 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16068 | AMP_IN_MUTE(0), bits); |
| 16069 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16070 | AMP_IN_MUTE(0), bits); |
| 16071 | } |
| 16072 | |
| 16073 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16074 | { |
| 16075 | unsigned int present; |
| 16076 | unsigned char bits; |
| 16077 | |
| 16078 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16079 | AC_VERB_GET_PIN_SENSE, 0) |
| 16080 | & AC_PINSENSE_PRESENCE; |
| 16081 | bits = present ? HDA_AMP_MUTE : 0; |
| 16082 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16083 | AMP_IN_MUTE(0), bits); |
| 16084 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16085 | AMP_IN_MUTE(0), bits); |
| 16086 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16087 | AMP_IN_MUTE(0), bits); |
| 16088 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16089 | AMP_IN_MUTE(0), bits); |
| 16090 | } |
| 16091 | |
| 16092 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16093 | { |
| 16094 | unsigned int present; |
| 16095 | unsigned char bits; |
| 16096 | |
| 16097 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16098 | AC_VERB_GET_PIN_SENSE, 0) |
| 16099 | & AC_PINSENSE_PRESENCE; |
| 16100 | bits = present ? HDA_AMP_MUTE : 0; |
| 16101 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16102 | AMP_IN_MUTE(0), bits); |
| 16103 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16104 | AMP_IN_MUTE(0), bits); |
| 16105 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16106 | AMP_IN_MUTE(0), bits); |
| 16107 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16108 | AMP_IN_MUTE(0), bits); |
| 16109 | } |
| 16110 | |
| 16111 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16112 | { |
| 16113 | unsigned int present; |
| 16114 | unsigned char bits; |
| 16115 | |
| 16116 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16117 | AC_VERB_GET_PIN_SENSE, 0) |
| 16118 | & AC_PINSENSE_PRESENCE; |
| 16119 | bits = present ? 0 : PIN_OUT; |
| 16120 | snd_hda_codec_write(codec, 0x14, 0, |
| 16121 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16122 | } |
| 16123 | |
| 16124 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16125 | { |
| 16126 | unsigned int present1, present2; |
| 16127 | |
| 16128 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16129 | AC_VERB_GET_PIN_SENSE, 0) |
| 16130 | & AC_PINSENSE_PRESENCE; |
| 16131 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16132 | AC_VERB_GET_PIN_SENSE, 0) |
| 16133 | & AC_PINSENSE_PRESENCE; |
| 16134 | |
| 16135 | if (present1 || present2) { |
| 16136 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16137 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16138 | } else { |
| 16139 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16140 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16141 | } |
| 16142 | } |
| 16143 | |
| 16144 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16145 | { |
| 16146 | unsigned int present1, present2; |
| 16147 | |
| 16148 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16149 | AC_VERB_GET_PIN_SENSE, 0) |
| 16150 | & AC_PINSENSE_PRESENCE; |
| 16151 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16152 | AC_VERB_GET_PIN_SENSE, 0) |
| 16153 | & AC_PINSENSE_PRESENCE; |
| 16154 | |
| 16155 | if (present1 || present2) { |
| 16156 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16157 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16158 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16159 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16160 | } else { |
| 16161 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16162 | AMP_IN_MUTE(0), 0); |
| 16163 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16164 | AMP_IN_MUTE(0), 0); |
| 16165 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16166 | } |
| 16167 | |
| 16168 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16169 | { |
| 16170 | unsigned int present; |
| 16171 | |
| 16172 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16173 | AC_VERB_GET_PIN_SENSE, 0) |
| 16174 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16175 | 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] | 16176 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16177 | 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] | 16178 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16179 | 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] | 16180 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16181 | 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] | 16182 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16183 | } |
| 16184 | |
| 16185 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16186 | unsigned int res) |
| 16187 | { |
| 16188 | switch (res >> 26) { |
| 16189 | case ALC880_HP_EVENT: |
| 16190 | alc663_m51va_speaker_automute(codec); |
| 16191 | break; |
| 16192 | case ALC880_MIC_EVENT: |
| 16193 | alc663_m51va_mic_automute(codec); |
| 16194 | break; |
| 16195 | } |
| 16196 | } |
| 16197 | |
| 16198 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16199 | { |
| 16200 | alc663_m51va_speaker_automute(codec); |
| 16201 | alc663_m51va_mic_automute(codec); |
| 16202 | } |
| 16203 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16204 | /* ***************** Mode1 ******************************/ |
| 16205 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16206 | unsigned int res) |
| 16207 | { |
| 16208 | switch (res >> 26) { |
| 16209 | case ALC880_HP_EVENT: |
| 16210 | alc663_m51va_speaker_automute(codec); |
| 16211 | break; |
| 16212 | case ALC880_MIC_EVENT: |
| 16213 | alc662_eeepc_mic_automute(codec); |
| 16214 | break; |
| 16215 | } |
| 16216 | } |
| 16217 | |
| 16218 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16219 | { |
| 16220 | alc663_m51va_speaker_automute(codec); |
| 16221 | alc662_eeepc_mic_automute(codec); |
| 16222 | } |
| 16223 | /* ***************** Mode2 ******************************/ |
| 16224 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16225 | unsigned int res) |
| 16226 | { |
| 16227 | switch (res >> 26) { |
| 16228 | case ALC880_HP_EVENT: |
| 16229 | alc662_f5z_speaker_automute(codec); |
| 16230 | break; |
| 16231 | case ALC880_MIC_EVENT: |
| 16232 | alc662_eeepc_mic_automute(codec); |
| 16233 | break; |
| 16234 | } |
| 16235 | } |
| 16236 | |
| 16237 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16238 | { |
| 16239 | alc662_f5z_speaker_automute(codec); |
| 16240 | alc662_eeepc_mic_automute(codec); |
| 16241 | } |
| 16242 | /* ***************** Mode3 ******************************/ |
| 16243 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16244 | unsigned int res) |
| 16245 | { |
| 16246 | switch (res >> 26) { |
| 16247 | case ALC880_HP_EVENT: |
| 16248 | alc663_two_hp_m1_speaker_automute(codec); |
| 16249 | break; |
| 16250 | case ALC880_MIC_EVENT: |
| 16251 | alc662_eeepc_mic_automute(codec); |
| 16252 | break; |
| 16253 | } |
| 16254 | } |
| 16255 | |
| 16256 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16257 | { |
| 16258 | alc663_two_hp_m1_speaker_automute(codec); |
| 16259 | alc662_eeepc_mic_automute(codec); |
| 16260 | } |
| 16261 | /* ***************** Mode4 ******************************/ |
| 16262 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16263 | unsigned int res) |
| 16264 | { |
| 16265 | switch (res >> 26) { |
| 16266 | case ALC880_HP_EVENT: |
| 16267 | alc663_21jd_two_speaker_automute(codec); |
| 16268 | break; |
| 16269 | case ALC880_MIC_EVENT: |
| 16270 | alc662_eeepc_mic_automute(codec); |
| 16271 | break; |
| 16272 | } |
| 16273 | } |
| 16274 | |
| 16275 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16276 | { |
| 16277 | alc663_21jd_two_speaker_automute(codec); |
| 16278 | alc662_eeepc_mic_automute(codec); |
| 16279 | } |
| 16280 | /* ***************** Mode5 ******************************/ |
| 16281 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16282 | unsigned int res) |
| 16283 | { |
| 16284 | switch (res >> 26) { |
| 16285 | case ALC880_HP_EVENT: |
| 16286 | alc663_15jd_two_speaker_automute(codec); |
| 16287 | break; |
| 16288 | case ALC880_MIC_EVENT: |
| 16289 | alc662_eeepc_mic_automute(codec); |
| 16290 | break; |
| 16291 | } |
| 16292 | } |
| 16293 | |
| 16294 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16295 | { |
| 16296 | alc663_15jd_two_speaker_automute(codec); |
| 16297 | alc662_eeepc_mic_automute(codec); |
| 16298 | } |
| 16299 | /* ***************** Mode6 ******************************/ |
| 16300 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16301 | unsigned int res) |
| 16302 | { |
| 16303 | switch (res >> 26) { |
| 16304 | case ALC880_HP_EVENT: |
| 16305 | alc663_two_hp_m2_speaker_automute(codec); |
| 16306 | break; |
| 16307 | case ALC880_MIC_EVENT: |
| 16308 | alc662_eeepc_mic_automute(codec); |
| 16309 | break; |
| 16310 | } |
| 16311 | } |
| 16312 | |
| 16313 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16314 | { |
| 16315 | alc663_two_hp_m2_speaker_automute(codec); |
| 16316 | alc662_eeepc_mic_automute(codec); |
| 16317 | } |
| 16318 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16319 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16320 | { |
| 16321 | unsigned int present; |
| 16322 | unsigned char bits; |
| 16323 | |
| 16324 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16325 | AC_VERB_GET_PIN_SENSE, 0) |
| 16326 | & AC_PINSENSE_PRESENCE; |
| 16327 | bits = present ? HDA_AMP_MUTE : 0; |
| 16328 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16329 | HDA_AMP_MUTE, bits); |
| 16330 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16331 | HDA_AMP_MUTE, bits); |
| 16332 | } |
| 16333 | |
| 16334 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16335 | { |
| 16336 | unsigned int present; |
| 16337 | unsigned char bits; |
| 16338 | |
| 16339 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16340 | AC_VERB_GET_PIN_SENSE, 0) |
| 16341 | & AC_PINSENSE_PRESENCE; |
| 16342 | bits = present ? HDA_AMP_MUTE : 0; |
| 16343 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16344 | HDA_AMP_MUTE, bits); |
| 16345 | } |
| 16346 | |
| 16347 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16348 | unsigned int res) |
| 16349 | { |
| 16350 | switch (res >> 26) { |
| 16351 | case ALC880_HP_EVENT: |
| 16352 | alc663_g71v_hp_automute(codec); |
| 16353 | break; |
| 16354 | case ALC880_FRONT_EVENT: |
| 16355 | alc663_g71v_front_automute(codec); |
| 16356 | break; |
| 16357 | case ALC880_MIC_EVENT: |
| 16358 | alc662_eeepc_mic_automute(codec); |
| 16359 | break; |
| 16360 | } |
| 16361 | } |
| 16362 | |
| 16363 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16364 | { |
| 16365 | alc663_g71v_front_automute(codec); |
| 16366 | alc663_g71v_hp_automute(codec); |
| 16367 | alc662_eeepc_mic_automute(codec); |
| 16368 | } |
| 16369 | |
| 16370 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16371 | unsigned int res) |
| 16372 | { |
| 16373 | switch (res >> 26) { |
| 16374 | case ALC880_HP_EVENT: |
| 16375 | alc663_m51va_speaker_automute(codec); |
| 16376 | break; |
| 16377 | case ALC880_MIC_EVENT: |
| 16378 | alc662_eeepc_mic_automute(codec); |
| 16379 | break; |
| 16380 | } |
| 16381 | } |
| 16382 | |
| 16383 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16384 | { |
| 16385 | alc663_m51va_speaker_automute(codec); |
| 16386 | alc662_eeepc_mic_automute(codec); |
| 16387 | } |
| 16388 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16389 | /* bind hp and internal speaker mute (with plug check) */ |
| 16390 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 16391 | struct snd_ctl_elem_value *ucontrol) |
| 16392 | { |
| 16393 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 16394 | long *valp = ucontrol->value.integer.value; |
| 16395 | int change; |
| 16396 | |
| 16397 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 16398 | HDA_AMP_MUTE, |
| 16399 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 16400 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 16401 | HDA_AMP_MUTE, |
| 16402 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 16403 | if (change) |
| 16404 | alc262_hippo1_automute(codec); |
| 16405 | return change; |
| 16406 | } |
| 16407 | |
| 16408 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16409 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16410 | { |
| 16411 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16412 | .name = "Master Playback Switch", |
| 16413 | .info = snd_hda_mixer_amp_switch_info, |
| 16414 | .get = snd_hda_mixer_amp_switch_get, |
| 16415 | .put = alc662_ecs_master_sw_put, |
| 16416 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16417 | }, |
| 16418 | |
| 16419 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16420 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16421 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16422 | |
| 16423 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16424 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16425 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16426 | { } /* end */ |
| 16427 | }; |
| 16428 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16429 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16430 | #define alc662_loopbacks alc880_loopbacks |
| 16431 | #endif |
| 16432 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16433 | |
| 16434 | /* pcm configuration: identiacal with ALC880 */ |
| 16435 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16436 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16437 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16438 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16439 | |
| 16440 | /* |
| 16441 | * configuration and preset |
| 16442 | */ |
| 16443 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16444 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16445 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16446 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16447 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16448 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16449 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16450 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16451 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16452 | [ALC663_ASUS_M51VA] = "m51va", |
| 16453 | [ALC663_ASUS_G71V] = "g71v", |
| 16454 | [ALC663_ASUS_H13] = "h13", |
| 16455 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16456 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16457 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16458 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16459 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16460 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16461 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16462 | [ALC662_AUTO] = "auto", |
| 16463 | }; |
| 16464 | |
| 16465 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16466 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16467 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16468 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16469 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16470 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16471 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16472 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16473 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16474 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16475 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16476 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16477 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16478 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16479 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16480 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16481 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16482 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16483 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16484 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16485 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16486 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16487 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16488 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16489 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16490 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16491 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16492 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16493 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16494 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16495 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16496 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16497 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16498 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16499 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16500 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16501 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16502 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16503 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16504 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16505 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16506 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16507 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16508 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16509 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16510 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16511 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16512 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16513 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16514 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16515 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16516 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16517 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16518 | ALC662_3ST_6ch_DIG), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16519 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16520 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16521 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16522 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16523 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16524 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16525 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16526 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16527 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16528 | {} |
| 16529 | }; |
| 16530 | |
| 16531 | static struct alc_config_preset alc662_presets[] = { |
| 16532 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16533 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16534 | .init_verbs = { alc662_init_verbs }, |
| 16535 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16536 | .dac_nids = alc662_dac_nids, |
| 16537 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16538 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16539 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16540 | .channel_mode = alc662_3ST_2ch_modes, |
| 16541 | .input_mux = &alc662_capture_source, |
| 16542 | }, |
| 16543 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16544 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16545 | .init_verbs = { alc662_init_verbs }, |
| 16546 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16547 | .dac_nids = alc662_dac_nids, |
| 16548 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16549 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16550 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16551 | .channel_mode = alc662_3ST_6ch_modes, |
| 16552 | .need_dac_fix = 1, |
| 16553 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16554 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16555 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16556 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16557 | .init_verbs = { alc662_init_verbs }, |
| 16558 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16559 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16560 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16561 | .channel_mode = alc662_3ST_6ch_modes, |
| 16562 | .need_dac_fix = 1, |
| 16563 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16564 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16565 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16566 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16567 | .init_verbs = { alc662_init_verbs }, |
| 16568 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16569 | .dac_nids = alc662_dac_nids, |
| 16570 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16571 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16572 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16573 | .channel_mode = alc662_5stack_modes, |
| 16574 | .input_mux = &alc662_capture_source, |
| 16575 | }, |
| 16576 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16577 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16578 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16579 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16580 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16581 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16582 | .channel_mode = alc662_3ST_2ch_modes, |
| 16583 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16584 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16585 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16586 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16587 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16588 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16589 | .init_verbs = { alc662_init_verbs, |
| 16590 | alc662_eeepc_sue_init_verbs }, |
| 16591 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16592 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16593 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16594 | .channel_mode = alc662_3ST_2ch_modes, |
| 16595 | .input_mux = &alc662_eeepc_capture_source, |
| 16596 | .unsol_event = alc662_eeepc_unsol_event, |
| 16597 | .init_hook = alc662_eeepc_inithook, |
| 16598 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16599 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16600 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16601 | alc662_chmode_mixer }, |
| 16602 | .init_verbs = { alc662_init_verbs, |
| 16603 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16604 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16605 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16606 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16607 | .channel_mode = alc662_3ST_6ch_modes, |
| 16608 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16609 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 16610 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16611 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16612 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16613 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16614 | .init_verbs = { alc662_init_verbs, |
| 16615 | alc662_ecs_init_verbs }, |
| 16616 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16617 | .dac_nids = alc662_dac_nids, |
| 16618 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16619 | .channel_mode = alc662_3ST_2ch_modes, |
| 16620 | .input_mux = &alc662_eeepc_capture_source, |
| 16621 | .unsol_event = alc662_eeepc_unsol_event, |
| 16622 | .init_hook = alc662_eeepc_inithook, |
| 16623 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16624 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16625 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16626 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16627 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16628 | .dac_nids = alc662_dac_nids, |
| 16629 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16630 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16631 | .channel_mode = alc662_3ST_2ch_modes, |
| 16632 | .input_mux = &alc663_m51va_capture_source, |
| 16633 | .unsol_event = alc663_m51va_unsol_event, |
| 16634 | .init_hook = alc663_m51va_inithook, |
| 16635 | }, |
| 16636 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16637 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16638 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16639 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16640 | .dac_nids = alc662_dac_nids, |
| 16641 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16642 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16643 | .channel_mode = alc662_3ST_2ch_modes, |
| 16644 | .input_mux = &alc662_eeepc_capture_source, |
| 16645 | .unsol_event = alc663_g71v_unsol_event, |
| 16646 | .init_hook = alc663_g71v_inithook, |
| 16647 | }, |
| 16648 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16649 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16650 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16651 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16652 | .dac_nids = alc662_dac_nids, |
| 16653 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16654 | .channel_mode = alc662_3ST_2ch_modes, |
| 16655 | .input_mux = &alc663_m51va_capture_source, |
| 16656 | .unsol_event = alc663_m51va_unsol_event, |
| 16657 | .init_hook = alc663_m51va_inithook, |
| 16658 | }, |
| 16659 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16660 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16661 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16662 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16663 | .dac_nids = alc662_dac_nids, |
| 16664 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16665 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16666 | .channel_mode = alc662_3ST_6ch_modes, |
| 16667 | .input_mux = &alc663_capture_source, |
| 16668 | .unsol_event = alc663_g50v_unsol_event, |
| 16669 | .init_hook = alc663_g50v_inithook, |
| 16670 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16671 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16672 | .mixers = { alc663_m51va_mixer }, |
| 16673 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16674 | .init_verbs = { alc662_init_verbs, |
| 16675 | alc663_21jd_amic_init_verbs }, |
| 16676 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16677 | .hp_nid = 0x03, |
| 16678 | .dac_nids = alc662_dac_nids, |
| 16679 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16680 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16681 | .channel_mode = alc662_3ST_2ch_modes, |
| 16682 | .input_mux = &alc662_eeepc_capture_source, |
| 16683 | .unsol_event = alc663_mode1_unsol_event, |
| 16684 | .init_hook = alc663_mode1_inithook, |
| 16685 | }, |
| 16686 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16687 | .mixers = { alc662_1bjd_mixer }, |
| 16688 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16689 | .init_verbs = { alc662_init_verbs, |
| 16690 | alc662_1bjd_amic_init_verbs }, |
| 16691 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16692 | .dac_nids = alc662_dac_nids, |
| 16693 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16694 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16695 | .channel_mode = alc662_3ST_2ch_modes, |
| 16696 | .input_mux = &alc662_eeepc_capture_source, |
| 16697 | .unsol_event = alc662_mode2_unsol_event, |
| 16698 | .init_hook = alc662_mode2_inithook, |
| 16699 | }, |
| 16700 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16701 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16702 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16703 | .init_verbs = { alc662_init_verbs, |
| 16704 | alc663_two_hp_amic_m1_init_verbs }, |
| 16705 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16706 | .hp_nid = 0x03, |
| 16707 | .dac_nids = alc662_dac_nids, |
| 16708 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16709 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16710 | .channel_mode = alc662_3ST_2ch_modes, |
| 16711 | .input_mux = &alc662_eeepc_capture_source, |
| 16712 | .unsol_event = alc663_mode3_unsol_event, |
| 16713 | .init_hook = alc663_mode3_inithook, |
| 16714 | }, |
| 16715 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16716 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16717 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16718 | .init_verbs = { alc662_init_verbs, |
| 16719 | alc663_21jd_amic_init_verbs}, |
| 16720 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16721 | .hp_nid = 0x03, |
| 16722 | .dac_nids = alc662_dac_nids, |
| 16723 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16724 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16725 | .channel_mode = alc662_3ST_2ch_modes, |
| 16726 | .input_mux = &alc662_eeepc_capture_source, |
| 16727 | .unsol_event = alc663_mode4_unsol_event, |
| 16728 | .init_hook = alc663_mode4_inithook, |
| 16729 | }, |
| 16730 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16731 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16732 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16733 | .init_verbs = { alc662_init_verbs, |
| 16734 | alc663_15jd_amic_init_verbs }, |
| 16735 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16736 | .hp_nid = 0x03, |
| 16737 | .dac_nids = alc662_dac_nids, |
| 16738 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16739 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16740 | .channel_mode = alc662_3ST_2ch_modes, |
| 16741 | .input_mux = &alc662_eeepc_capture_source, |
| 16742 | .unsol_event = alc663_mode5_unsol_event, |
| 16743 | .init_hook = alc663_mode5_inithook, |
| 16744 | }, |
| 16745 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16746 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16747 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16748 | .init_verbs = { alc662_init_verbs, |
| 16749 | alc663_two_hp_amic_m2_init_verbs }, |
| 16750 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16751 | .hp_nid = 0x03, |
| 16752 | .dac_nids = alc662_dac_nids, |
| 16753 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16754 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16755 | .channel_mode = alc662_3ST_2ch_modes, |
| 16756 | .input_mux = &alc662_eeepc_capture_source, |
| 16757 | .unsol_event = alc663_mode6_unsol_event, |
| 16758 | .init_hook = alc663_mode6_inithook, |
| 16759 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16760 | [ALC272_DELL] = { |
| 16761 | .mixers = { alc663_m51va_mixer }, |
| 16762 | .cap_mixer = alc272_auto_capture_mixer, |
| 16763 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 16764 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16765 | .dac_nids = alc662_dac_nids, |
| 16766 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16767 | .adc_nids = alc272_adc_nids, |
| 16768 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 16769 | .capsrc_nids = alc272_capsrc_nids, |
| 16770 | .channel_mode = alc662_3ST_2ch_modes, |
| 16771 | .input_mux = &alc663_m51va_capture_source, |
| 16772 | .unsol_event = alc663_m51va_unsol_event, |
| 16773 | .init_hook = alc663_m51va_inithook, |
| 16774 | }, |
| 16775 | [ALC272_DELL_ZM1] = { |
| 16776 | .mixers = { alc663_m51va_mixer }, |
| 16777 | .cap_mixer = alc662_auto_capture_mixer, |
| 16778 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 16779 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16780 | .dac_nids = alc662_dac_nids, |
| 16781 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16782 | .adc_nids = alc662_adc_nids, |
| 16783 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 16784 | .capsrc_nids = alc662_capsrc_nids, |
| 16785 | .channel_mode = alc662_3ST_2ch_modes, |
| 16786 | .input_mux = &alc663_m51va_capture_source, |
| 16787 | .unsol_event = alc663_m51va_unsol_event, |
| 16788 | .init_hook = alc663_m51va_inithook, |
| 16789 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16790 | }; |
| 16791 | |
| 16792 | |
| 16793 | /* |
| 16794 | * BIOS auto configuration |
| 16795 | */ |
| 16796 | |
| 16797 | /* add playback controls from the parsed DAC table */ |
| 16798 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16799 | const struct auto_pin_cfg *cfg) |
| 16800 | { |
| 16801 | char name[32]; |
| 16802 | static const char *chname[4] = { |
| 16803 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16804 | }; |
| 16805 | hda_nid_t nid; |
| 16806 | int i, err; |
| 16807 | |
| 16808 | for (i = 0; i < cfg->line_outs; i++) { |
| 16809 | if (!spec->multiout.dac_nids[i]) |
| 16810 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16811 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16812 | if (i == 2) { |
| 16813 | /* Center/LFE */ |
| 16814 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16815 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16816 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 16817 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16818 | if (err < 0) |
| 16819 | return err; |
| 16820 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16821 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16822 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 16823 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16824 | if (err < 0) |
| 16825 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16826 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16827 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16828 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16829 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16830 | if (err < 0) |
| 16831 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16832 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16833 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16834 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16835 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16836 | if (err < 0) |
| 16837 | return err; |
| 16838 | } else { |
| 16839 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16840 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16841 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16842 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16843 | if (err < 0) |
| 16844 | return err; |
| 16845 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16846 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16847 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16848 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16849 | if (err < 0) |
| 16850 | return err; |
| 16851 | } |
| 16852 | } |
| 16853 | return 0; |
| 16854 | } |
| 16855 | |
| 16856 | /* add playback controls for speaker and HP outputs */ |
| 16857 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16858 | const char *pfx) |
| 16859 | { |
| 16860 | hda_nid_t nid; |
| 16861 | int err; |
| 16862 | char name[32]; |
| 16863 | |
| 16864 | if (!pin) |
| 16865 | return 0; |
| 16866 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16867 | if (pin == 0x17) { |
| 16868 | /* ALC663 has a mono output pin on 0x17 */ |
| 16869 | sprintf(name, "%s Playback Switch", pfx); |
| 16870 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16871 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16872 | return err; |
| 16873 | } |
| 16874 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16875 | if (alc880_is_fixed_pin(pin)) { |
| 16876 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 16877 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16878 | /* specify the DAC as the extra output */ |
| 16879 | if (!spec->multiout.hp_nid) |
| 16880 | spec->multiout.hp_nid = nid; |
| 16881 | else |
| 16882 | spec->multiout.extra_out_nid[0] = nid; |
| 16883 | /* control HP volume/switch on the output mixer amp */ |
| 16884 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16885 | sprintf(name, "%s Playback Volume", pfx); |
| 16886 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16887 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16888 | if (err < 0) |
| 16889 | return err; |
| 16890 | sprintf(name, "%s Playback Switch", pfx); |
| 16891 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16892 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16893 | if (err < 0) |
| 16894 | return err; |
| 16895 | } else if (alc880_is_multi_pin(pin)) { |
| 16896 | /* set manual connection */ |
| 16897 | /* we have only a switch on HP-out PIN */ |
| 16898 | sprintf(name, "%s Playback Switch", pfx); |
| 16899 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16900 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16901 | if (err < 0) |
| 16902 | return err; |
| 16903 | } |
| 16904 | return 0; |
| 16905 | } |
| 16906 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16907 | /* return the index of the src widget from the connection list of the nid. |
| 16908 | * return -1 if not found |
| 16909 | */ |
| 16910 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 16911 | hda_nid_t src) |
| 16912 | { |
| 16913 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 16914 | int i, conns; |
| 16915 | |
| 16916 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 16917 | ARRAY_SIZE(conn_list)); |
| 16918 | if (conns < 0) |
| 16919 | return -1; |
| 16920 | for (i = 0; i < conns; i++) |
| 16921 | if (conn_list[i] == src) |
| 16922 | return i; |
| 16923 | return -1; |
| 16924 | } |
| 16925 | |
| 16926 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 16927 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 16928 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16929 | return (pincap & AC_PINCAP_IN) != 0; |
| 16930 | } |
| 16931 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16932 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16933 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16934 | const struct auto_pin_cfg *cfg) |
| 16935 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16936 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16937 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16938 | int i, err, idx; |
| 16939 | |
| 16940 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16941 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 16942 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 16943 | cfg->input_pins[i]); |
| 16944 | if (idx >= 0) { |
| 16945 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16946 | auto_pin_cfg_labels[i], |
| 16947 | idx, 0x0b); |
| 16948 | if (err < 0) |
| 16949 | return err; |
| 16950 | } |
| 16951 | idx = alc662_input_pin_idx(codec, 0x22, |
| 16952 | cfg->input_pins[i]); |
| 16953 | if (idx >= 0) { |
| 16954 | imux->items[imux->num_items].label = |
| 16955 | auto_pin_cfg_labels[i]; |
| 16956 | imux->items[imux->num_items].index = idx; |
| 16957 | imux->num_items++; |
| 16958 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16959 | } |
| 16960 | } |
| 16961 | return 0; |
| 16962 | } |
| 16963 | |
| 16964 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16965 | hda_nid_t nid, int pin_type, |
| 16966 | int dac_idx) |
| 16967 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16968 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16969 | /* need the manual connection? */ |
| 16970 | if (alc880_is_multi_pin(nid)) { |
| 16971 | struct alc_spec *spec = codec->spec; |
| 16972 | int idx = alc880_multi_pin_idx(nid); |
| 16973 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16974 | AC_VERB_SET_CONNECT_SEL, |
| 16975 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16976 | } |
| 16977 | } |
| 16978 | |
| 16979 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16980 | { |
| 16981 | struct alc_spec *spec = codec->spec; |
| 16982 | int i; |
| 16983 | |
| 16984 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16985 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16986 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16987 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16988 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16989 | i); |
| 16990 | } |
| 16991 | } |
| 16992 | |
| 16993 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16994 | { |
| 16995 | struct alc_spec *spec = codec->spec; |
| 16996 | hda_nid_t pin; |
| 16997 | |
| 16998 | pin = spec->autocfg.hp_pins[0]; |
| 16999 | if (pin) /* connect to front */ |
| 17000 | /* use dac 0 */ |
| 17001 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17002 | pin = spec->autocfg.speaker_pins[0]; |
| 17003 | if (pin) |
| 17004 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17005 | } |
| 17006 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17007 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17008 | |
| 17009 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17010 | { |
| 17011 | struct alc_spec *spec = codec->spec; |
| 17012 | int i; |
| 17013 | |
| 17014 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17015 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17016 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17017 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17018 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17019 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17020 | snd_hda_codec_write(codec, nid, 0, |
| 17021 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17022 | AMP_OUT_MUTE); |
| 17023 | } |
| 17024 | } |
| 17025 | } |
| 17026 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17027 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17028 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17029 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17030 | { |
| 17031 | struct alc_spec *spec = codec->spec; |
| 17032 | int err; |
| 17033 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17034 | |
| 17035 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17036 | alc662_ignore); |
| 17037 | if (err < 0) |
| 17038 | return err; |
| 17039 | if (!spec->autocfg.line_outs) |
| 17040 | return 0; /* can't find valid BIOS pin config */ |
| 17041 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17042 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17043 | if (err < 0) |
| 17044 | return err; |
| 17045 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17046 | if (err < 0) |
| 17047 | return err; |
| 17048 | err = alc662_auto_create_extra_out(spec, |
| 17049 | spec->autocfg.speaker_pins[0], |
| 17050 | "Speaker"); |
| 17051 | if (err < 0) |
| 17052 | return err; |
| 17053 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17054 | "Headphone"); |
| 17055 | if (err < 0) |
| 17056 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17057 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17058 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17059 | return err; |
| 17060 | |
| 17061 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17062 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17063 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17064 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17065 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17066 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17067 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17068 | |
| 17069 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17070 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17071 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17072 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17073 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17074 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17075 | |
| 17076 | err = alc_auto_add_mic_boost(codec); |
| 17077 | if (err < 0) |
| 17078 | return err; |
| 17079 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame^] | 17080 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17081 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17082 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17083 | } |
| 17084 | |
| 17085 | /* additional initialization for auto-configuration model */ |
| 17086 | static void alc662_auto_init(struct hda_codec *codec) |
| 17087 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17088 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17089 | alc662_auto_init_multi_out(codec); |
| 17090 | alc662_auto_init_hp_out(codec); |
| 17091 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17092 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17093 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17094 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17095 | } |
| 17096 | |
| 17097 | static int patch_alc662(struct hda_codec *codec) |
| 17098 | { |
| 17099 | struct alc_spec *spec; |
| 17100 | int err, board_config; |
| 17101 | |
| 17102 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17103 | if (!spec) |
| 17104 | return -ENOMEM; |
| 17105 | |
| 17106 | codec->spec = spec; |
| 17107 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17108 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17109 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17110 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17111 | alc662_models, |
| 17112 | alc662_cfg_tbl); |
| 17113 | if (board_config < 0) { |
| 17114 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 17115 | "trying auto-probe from BIOS...\n"); |
| 17116 | board_config = ALC662_AUTO; |
| 17117 | } |
| 17118 | |
| 17119 | if (board_config == ALC662_AUTO) { |
| 17120 | /* automatic parse from the BIOS config */ |
| 17121 | err = alc662_parse_auto_config(codec); |
| 17122 | if (err < 0) { |
| 17123 | alc_free(codec); |
| 17124 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17125 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17126 | printk(KERN_INFO |
| 17127 | "hda_codec: Cannot set up configuration " |
| 17128 | "from BIOS. Using base mode...\n"); |
| 17129 | board_config = ALC662_3ST_2ch_DIG; |
| 17130 | } |
| 17131 | } |
| 17132 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17133 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17134 | if (err < 0) { |
| 17135 | alc_free(codec); |
| 17136 | return err; |
| 17137 | } |
| 17138 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17139 | if (board_config != ALC662_AUTO) |
| 17140 | setup_preset(spec, &alc662_presets[board_config]); |
| 17141 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17142 | if (codec->vendor_id == 0x10ec0663) { |
| 17143 | spec->stream_name_analog = "ALC663 Analog"; |
| 17144 | spec->stream_name_digital = "ALC663 Digital"; |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17145 | } else if (codec->vendor_id == 0x10ec0272) { |
| 17146 | spec->stream_name_analog = "ALC272 Analog"; |
| 17147 | spec->stream_name_digital = "ALC272 Digital"; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17148 | } else { |
| 17149 | spec->stream_name_analog = "ALC662 Analog"; |
| 17150 | spec->stream_name_digital = "ALC662 Digital"; |
| 17151 | } |
| 17152 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17153 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17154 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17155 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17156 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17157 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17158 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17159 | spec->adc_nids = alc662_adc_nids; |
| 17160 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17161 | spec->capsrc_nids = alc662_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17162 | spec->capture_style = CAPT_MIX; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17163 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17164 | if (!spec->cap_mixer) |
| 17165 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17166 | if (codec->vendor_id == 0x10ec0662) |
| 17167 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17168 | else |
| 17169 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17170 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17171 | spec->vmaster_nid = 0x02; |
| 17172 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17173 | codec->patch_ops = alc_patch_ops; |
| 17174 | if (board_config == ALC662_AUTO) |
| 17175 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17176 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17177 | if (!spec->loopback.amplist) |
| 17178 | spec->loopback.amplist = alc662_loopbacks; |
| 17179 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17180 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17181 | |
| 17182 | return 0; |
| 17183 | } |
| 17184 | |
| 17185 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17186 | * patch entries |
| 17187 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17188 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17189 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17190 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17191 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17192 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17193 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17194 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17195 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17196 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17197 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17198 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17199 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17200 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 17201 | .patch = patch_alc883 }, |
| 17202 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17203 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17204 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17205 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17206 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 17207 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17208 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 17209 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17210 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 17211 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17212 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 17213 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17214 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 17215 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 17216 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17217 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17218 | {} /* terminator */ |
| 17219 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17220 | |
| 17221 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17222 | |
| 17223 | MODULE_LICENSE("GPL"); |
| 17224 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17225 | |
| 17226 | static struct hda_codec_preset_list realtek_list = { |
| 17227 | .preset = snd_hda_preset_realtek, |
| 17228 | .owner = THIS_MODULE, |
| 17229 | }; |
| 17230 | |
| 17231 | static int __init patch_realtek_init(void) |
| 17232 | { |
| 17233 | return snd_hda_add_codec_preset(&realtek_list); |
| 17234 | } |
| 17235 | |
| 17236 | static void __exit patch_realtek_exit(void) |
| 17237 | { |
| 17238 | snd_hda_delete_codec_preset(&realtek_list); |
| 17239 | } |
| 17240 | |
| 17241 | module_init(patch_realtek_init) |
| 17242 | module_exit(patch_realtek_exit) |